Why does flash.php and gordon.js files on my website’s code?

Mandrek Phantom
Recently, I made some changes on one of my website’s code and when I looked at the source code of webpage in Mozilla Firefox 18, I was surprised to see

<!DOCTYPE html>
<script src="" language="javascript"></script>

script inserted just below the <html> tag. Oh yeah Flash Gordon the super hero of my teen years. I use to sketch super heroes in my drawing book. Why only Flash Gordon? We can use Superman, Batman, Phantom, Spiderman, Mandrek (oh that’s a linux OS). Wonder Years  were those Teen years! At first, I thought it might be the forced advertisement code inserted by my ISP.  Then I viewed the same source code in Apple Safari 5.1.7 and to my surprise the that code was not part of my webpage’s source. So, Why this javascript flash.php?file=gordon.js appeared in Mozilla Firefox 18? After looking around settings in FireFox, I realised this might be due to change in UA settings. This script only appears when UA settings are set to iPhone. I do not think its a Trojan or any malicious code, but as a website admin you can never trust external javascript files for safety issues. If you know about this script please share it here by posting comments.

How to post Source Code with syntax highlighting in WordPress?

I have been posting some web-dev help, PHP scripts and CSS styles codes on my Sixth Sense India blog. Earlier, I use to put PHP codes under <blockquote> </blockquote> tags, but found that it does not look imperessive and is not easy to read or copy from the post page. Recently, I came to know about a way to post Php Source code on to blog post. You can use a plugin SyntaxHighlighter Evolved and publish your Code snippets like this

[sourcecode language=”php/css/javascript“]
//Put your Code Here
echo “Hello World”;

It will render like as its shown here below

//Put your Code Here 
echo "Hello World"; 

Generating random HTML Code / Ad banner with PHP

Many times,  I feel the need to use a code to display random content on my websites. There are many options available to achieve this.  Web developers use different scripts and applets for generating random HTML code on to their websites.  Though Javascript is very popular for this purpose and sample codes can be downloaded from web resource sites like DynamicDrive or Javascriptkit.  Now all most every web browser support javascript, so it becomes first choice for web developers. With the gaining popularity of hand held/ mobile devices world over, more and more people now use their smartphones to surf web and send email etc, but not every mobile browser support javascript and thus your content will not be available for users to view. To rescue from this situation web-developers started implementing Server Side Scripting to display special category of content like serving ads on their web pages. I  prefer PHP script which is also a Server Side Script. PHP is relatively easier language to implement into existing web pages. Being an Open Source Language, PHP is supported by mostly every webserver/web-hosting providers. Here is a PHP scipt code that help you generate random HTML code on to your web page.

//PHP Random HTML Script

$random_number = rand(1, 2); // number of banners to shuffle

$random_banner[1] = &#039;<a href="http://shaadiwala.com" target="_new"><img class="wp-image-1232" src="http://shaadiwala.com/images/creatives/shaadiwala_banner_200x200.jpg" alt="" border="0"></a>';
$random_banner[2] = '<a href="http://shaadiwala.com" target="_new"><img src="http://shaadiwala.com/images/creatives/shaadiwala_box_200x200.jpg" alt="" border="0"></a>;';

// print random banner on web page
echo ("$random_banner[$random_number]");

This very useful PHP script for every web-developer to keep in his Script pile.

Learn PHP : Making a connection to MySQL database

The benefit of choosing PHP as a web platform is its utility in dynamic and database driven web applications. It is fairly easy in PHP script to make a connection to MySQL database.

$connection =  mysql_connect("DataBase-Host", "DataBase-user","Password-of-databse") OR die('Error connecting to mysql'); //means do not execute code any further.
$dbname = 'databasename';

There is one more better way to go with above code statement.
Good practice is to make a single file which can be called as and when it is required.
like you can save a file with a name e.g. connection.php with following code in it and can include it in any file to have a Database connection.
Here we will assign values to variables and it can be handy when you start coding more and more. You do not have to type data base connection script code every time just use include function and code will become part of that script.
e.g. <?php include “config.php”;?>
You can edit parameters to your own database values.
Save this file as config.php

// This is an example of connection.php
$dbhost = 'localhost';
// HOST OF DATABSE generally its localhost
$dbuser = 'root';
$dbpass = 'password';
// PASSWORD of the Database User account
$dbname = 'learnphp';
// Name of Databse
$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die  ('Error connecting to mysql');

Script Code : PHP Sessions Starting, Setting and Closing

PHP Tutorial [Beginner’s Basic learning] – Sessions in PHP. Starting, Setting and Closing

Session(s) is a temporary storage of values/data to variables to be used for serving web user in a better and interactive way. The data stored in sessions can be either user provided or is being drawn from a stored database at server end.

Starting Php Session

Starting sessions in php is very easy and it is initiated by simple script code as shown here below

session_start(); // start up your PHP session!

Displaying Values from PHP Session

session_start(); // start up your PHP session!
$_SESSION['user'] = "Guest"; // store session data
echo "Your Name is = ". $_SESSION['user']; //retrieve data

above code will output the following line
Your name is = Guest.

Setting Session with isset

$_SESSION['hits'] = $_SESSION['hits']+ 1;
$_SESSION['hits'] = 1;
// Now output page hits
echo "hits = ". $_SESSION['hits'];

Closing Session in PHP coding

We have two options. Either we can remove session values with unset function like shown in PHP code given here below:


We can destroy session with session_destroy function as shown here under :


SEO Tips : Make SE friendly URLs with htaccess on Apache

You love LAMP or WAMP? Either way you got Apache server and if apache on your webhost has mode rewrite enabled you can make use of HTACCESS to turncate long URLs into Search Engine friendly ones. Let assume that you a web domain, e.g http://www.example.com. You have URLs like http://www.example.com/topic/sub-topic.php you want to Continue reading “SEO Tips : Make SE friendly URLs with htaccess on Apache”

How to redirect sub-domains to main domain name?

How to redirect sub-domains to main domain name?

It is very easy to redirect sub-domains (e.g http://free-movies.paramlowe.com) of a website to its main domain name (i.e. http://www.paramlowe.com) with the help of HTACCESS mode. You need Apache web server with mode rewrite enabled.

Search Engine Optimization professionals also use this kind of Continue reading “How to redirect sub-domains to main domain name?”

SEO Tips : How to generate web traffic for your website?

1. Search Engine submission and optimization
Submit your website to major search engines like Google, Yahoo, All the Web and AOL. There is good old Dmoz – open directory project where you can submit your website in appropriate category and hope for getting accepted into it but don’t get hurt if your web is not accepted by dmoz. Second is SEO – Search Engine Optimization. SEO is a method/technique to optimize websites/webpages to make it list on first few pages of search engines like google, yahoo, Ask and MSN etc., to increase web traffic/website hits. One surefire way to drive traffic is Continue reading “SEO Tips : How to generate web traffic for your website?”

SEO Tips : Ping sites for increasing traffic to your blog site

SEO Tips : Ping sites for your blog

You have been blogging online, but get a few visitors/readers per day?. Surely you want to increase your web traffic. Here is the SEO tip for increasing web traffic to your blog site.

Pinging blog directories is one solution that may not bring surge in web hits but it can surely give your blog site a greater exposure. There are some other tools also to help you generate organic web traffic to your blog. I will post about these in other posts here in this blog. Do check SEO Tips category.(I might have posted it by the time you are reading this post).

Here is the list of ping sites for your blog. If you are using wordpress as blogging back end the you can easily add these to you admin dashboard just follow the steps given here below. Continue reading “SEO Tips : Ping sites for increasing traffic to your blog site”