Monday, December 13, 2010

CJ Ad Banner Rotator Using Simple PHP Script

The contents of "CJ Ad Rotator" ........

1. adrotate.php

2. displayad.inc

3. linkcode.inc

4. Example Include.php

5. Readme.txt

6. Copying.txt (GPL)

7. and just incase you forgot where it came from.... an Internet Shortcut :D

Files Required

~~~~~~~~

1. adrotate.php

2. displayad.inc

3. linkcode.inc

4. A php page to display the adrotate.php



» note: the page must be renamed to something.php for this counter to work, to do this open the file in » notepad and save it as "whatever.php" (some servers require .php3 or .php4 extensions)

Installation Help

~~~~~~~~~~

please note » additional help is included in the editable files.

1. Open up linkcode.inc and replace what is in there with as many links as you like, remember to save them in the format:

<a href="http://www.advertising.com/link0001"><img src="http://www.advertising.com/image00001.jpg"></a>

<a href="http://www.advertising.com/link0002"><img src="http://www.advertising.com/image00002.jpg"></a>

etc...

2. Open up adrotate.php an edit the variables if you want to:

$directory = "/enter/your/website/root/"; // Webserver path to your adrotator files

$linkfile = "linkcode.inc"; // The Link Code file

$adcountfile = "displayad.inc"; // The Ad Display file

$pos = "left"; // Postion of banner tag (left, center or right)

$help_msg = "no"; // Display a "Help Message" - "Yes" to enable!

$help_message = "Please support this site by clicking on the banner below"; // Enter "Help Message" here

3. Add the following code to within your webpage where you want the banner adverts to appear (see Example Include)

<? include("adrotate.php"); ?>

Note: if you have put the files in a seperate folder you will need to link to them eg. <? include("ads/adrotate.php"); ?>

4. Upload the files: adrotate.php, linkcode.inc, displayad.inc (to a suitable directory) and your webpage.php

5. CHMOD the file displayad.inc to 777

6. Surf to your webpage and a banner should be displayed that changes when you click refresh (if you have more than one banner in linkcode.inc!)

7. Note: Because you declared the server path to your files, you can insert the banner ads on any page. Just remember to <? include ?> the correct file!

Linkcode.inc

<a href="http://www.advertising.com" target="_blank" ><img src="http://www.advertising.com/image-1240896-02020202" width="468" height="60" alt="Support Our Website!" border="0"></a>
<a href="http://www.advertising.com" target="_blank" ><img src="http://www.advertising.com/image-1240896-02020202" width="468" height="60" alt="Support Our Website!" border="0"></a>
<a href="http://www.advertising.com" target="_blank" ><img src="http://www.advertising.com/image-1240896-02020202" width="468" height="60" alt="Support Our Website!" border="0"></a>

adrotate.php

<?
/* Config Part --------------------------------------------------------------------------------------------------------------*/

$directory = "/enter/your/website/root/"; // Webserver path to your adrotator files
$linkfile = "linkcode.inc"; // The Link Code file
$adcountfile = "displayad.inc"; // The Ad Display file
$pos = "left"; // Postion of banner tag (left, center or right)
$help_msg = "no"; // Display a "Help Message" - "Yes" to enable!
$help_message = "Please support this site by clicking on the banner below"; // Enter "Help Message" here

/* End of Config Part -------------------------------------------------------------------------------------------------------*/

// Leave below this line alone - If you modify anything below I can assure you it will mess up!

// the file holding the advert number to view next
$num = file($directory.$adcountfile);

// the file holding the link codes
$adverts = file($directory.$linkfile);

// tells the script to look at the next item in the array
$num = $num[0]+1;

// counting the number of adverts - using function count()
$number = count($adverts);

// If ran out of adverts, start again!
if($num>$number-1){
$num=0;
}

// write the current number to the file
if (file_exists($directory.$adcountfile)) {
$nu = fopen ($directory.$adcountfile, "w");
fputs($nu,$num);
}
else {
die("<h1>Can't find file</h1><br>Check ad-count file ($adcountfile) exists<BR>Check file with links ($linkfile) exists<BR>Check directory ($directory) is correct");
}

// display the link on the page

if($help_msg == "yes"){
echo "{$pos_statag}<small>$help_message</small>{$pos_endtag}";
}
echo "<div align=\"$pos\">$adverts[$num]</div>";
?>

include.php

<html>
<head>
<title>Advert</title>
<body>
Advert:
<br><br>

<?
include('adrotate.php');
?>

 

</body>
</html>

 

By PHP with No comments

404 Trapper PHP Script download

Download 404 Trapper PHP Script

<?php
#########################################################
# 404 Trapper #
#########################################################
# This script was created by:
# PHPSelect Web Development Division. #
# You are granted full rights to use this script on any site you own. However, redistribution of this script REQUIRES that this copyright notice remain in place. #
# HOW TO USE THIS SCRIPT: Create or edit an .htaccess file in the document root on your web server. Insert the line: #
# ErrorDocument 404 /404trap.php #
# ..where /404trap.php reflects the path, relative to #
# your document root, where the script lives. Then configure and upload this script. #
#########################################################
# 404trap.php #
#########################################################

#########################################################
# Set these variables to configure the script #
#########################################################

# Set $domain to your domain name (no www)
$domain = "test.com";

# Set $docroot to the URL of the directory which contains your
# .htaccess file. Don't include trailing slash.
$docroot = "http://www.test.com";

# Set $template to the full system path to the HTML file that
# you want to use as a template. If you don't set this, the
# script will use its default built-in template. If you create
# your own template, place the token %OUTPUT% where you want
# the output to appear.
$template = "";

# This script is capable of mailing the details of each 404 error
# to the webmaster. Use the $reportlevel variable to control when
# you receive these reports.
#
# 0 = don't use the email capabilities, just display the page
# 1 = send email only if the error's referer contains your domain name
# (i.e. the 404 was generated by a broken link on your site)
# 2 = send email any time a 404 error is generated (useful for tracking
# broken links at other sites which link to you)

$reportlevel = 2;

# Set $emailaddress to the email address of whoever should be
# notified of 404 errors. Don't escape the @ symbol.
# You can leave this unassigned if you're not using email features.

$emailaddress = "you@example.com";

#########################################################
# End of configuration variables #
#########################################################

# The print_details function is what prints the 404 error to
# the visitor.

function print_details(){
# Request access to the global variables we need
global $docroot, $reportlevel;

# Print the 404 error in web format
$output .= <<<EOT
<b><h1>404 Not Found</h1></b>
<p><font face="Verdana, Arial" size="2">
We're sorry. The page you requested, $docroot$_SERVER[REQUEST_URI], doesn't exist
on this server.</font></p>
EOT;

# If an email report is being generated, let the visitor know:
if ($reportlevel != 0){
$output .= <<<EOT
<p><font face="Verdana, Arial" size="2">The details of this error have automatically
been mailed to the webmaster.
EOT;
}
if($template){
$template = implode("", file($template));
$template = str_replace("%OUTPUT%", $output, $template);
echo $template;
}
else{
echo $output;
}
return;
}

# The send_email function sends the details of the 404 error to the
# webmaster.
function send_email(){
# Request access to the global variables we need
global $emailaddress, $docroot;

# Build the $errortime variable to contain the date/time of the error.
$errortime = date("d M Y h:i:s");

# Create the body of the email message
$message .= "404 Error Report\n\nA 404 error was encountered by $_SERVER[REMOTE_ADDR]";
$message .= " on $errortime.\n\n";
$message .= "The URI which generated the error is: \n$docroot$_SERVER[REQUEST_URI]\n\n";
$message .= "The referring page was:\n$_SERVER[HTTP_REFERER]\n\n";

# Send the mail message. This assumes mail() will work on your system!
$headers = "From: $emailaddress\nDate: $errortime -0600\n";
$subject = "404 Error: $docroot$_SERVER[REQUEST_URI]";
mail($emailaddress, $subject, $message, $headers);

return;
}
header("404 Not Found");
# Send a 404 error to the user's browser
print_details();

# See whether or not we should send an email report. If so, do it.
switch($reportlevel){
case 0:
break;
case 1:
if(eregi($domain, $_SERVER[HTTP_REFERER])){
send_email();
}
break;
case 2:
send_email();
break;
}
?>

By PHP with No comments

8Ball Magic Script using PHP script

Installation instructions for 8-Ball

The file and edit template.html to suit your needs.
Where you want the form to appear in the web page, insert
the string %%FORM%% and where you want the answer to be
displayed, insert the string %%ANSWER%%.

Open 8ball.php and set the $template variable to the name
of your template HTML file, if different from the default "template.html." Edit the $answers array, if you like, to
specify your own custom responses.

Upload the script and template HTML file to your web
server in ASCII mode. Point your web browser to the
8ball.php file in order to use the 8ball.

#########################################################

[Usage]

There are several ways to use this script. You can make
the templates full standalone pages and just link to the
8ball.php from your website, or you can make the templates
as tables and use a PHP <? include() ?> statement to make
the script a integral part of an existing webpage.

Template.html

<body bgcolor="#99CCCC">
<h3 align="center"><font color="#993300">SharemyPHP<font color="#993300">
Presents<br>
Magic 8-Ball!</font></h3>
<table width="90%" border="0" align="center" bgcolor="#000000" cellpadding="0" cellspacing="1">
<tr>
<td>
<table width="100%" border="0" bgcolor="#FFFFFF">
<tr>
<td>
<p align="left"><font size="2" face="Verdana, Arial">Welcome to the
Magic 8-Ball! It can answer any question that's on your mind. Think
of a good question and type it into the form below, then submit
the form to hear the wise oracle speak!</font></p>
<p align="center"><font face="Verdana, Arial" size="2">%%FORM%%</font></p>
<p align="center"><font size="2" face="Verdana, Arial" color="#3333CC"><b>%%ANSWER%%</b></font></p>
</td>
</tr>
</table>
</td>
</tr>
</table>

8ball.php

<?php
#########################################################
# 8-Ball #
#########################################################
# #
# This script was created by: #
# #
# PHPSelect Web Development Division. #
# This script and all included modules, lists or #
# images, documentation are copyright 2002 #
# #
# Purchasers are granted rights to use this script #
# on any site they own. There is no individual site #
# license needed per site. #
# #
# Any copying, distribution, modification with #
# intent to distribute as new code will result #
# in immediate loss of your rights to use this #
# program as well as possible legal action. #
# #
# This and many other fine scripts are available at #
# the above website or by emailing the authors at #
# #
#########################################################
#8ball.php #
# #
#This script will answer user-submitted questions in #
#the style of the "Magic 8-Ball." You can set your own #
#answers, as well as the output attributes. #
#########################################################

#Set the following configuration options:

#$answers is an array containing all possible responses
#the 8-ball will give.

$answers = array("Heck no!", "Not bloody likely.", "The possibilities look good...", "How should I know?", "Maybe.", "The answer looks hazy...", "Are you crazy? OF COURSE!", "Naaah.", "Anything's possible!", "I tend to doubt it.", "For sure!!");

#$template is the template file the script will use to
#format the output. This should be an HTML file with the
#appropriate tokens placed where you'd like the
#corresponding values to appear. See the INSTALL.txt file
#for more information.

$template = "template1.html";

#########################################################
#Editing below is not required. #
#########################################################

#load the template file
if(!$output = file($template))
die("Couldn't open the template file ($template). Please check and make sure that this file is where it's supposed to be.");
$output = implode("\n", $output);

#build output for %%FORM%%
$formoutput = "<form method=\"POST\" action=\"$_SERVER[PHP_SELF]\"><input type=\"hidden\" name=\"posted\" value=1><input type=\"text\" name=\"question\"><br><input type=\"submit\" value=\"Ask\"></form>";

#Answer a question if one was posted
if($_POST[posted]){
srand((double)microtime() * 1000000);
$answeroutput = $_POST[question] ? $answers[rand(0, (sizeof($answers)-1))] : "I can only answer if you ask a question!";
}
else
$answeroutput = "";

#replace tokens

$output = str_replace("%%FORM%%", $formoutput, $output);
$output = str_replace("%%ANSWER%%", $answeroutput, $output);

echo $output;

?>

By PHP with No comments

2Checkout payment Gateway integration using PHP

Installation and Usage
========================================
In order to use the CC Processor Gateway Interface, you
must have an account with
2Checkout http://www.2checkout.com/
Open the processors.php script and set the variable as
indicated at the top of the script. Upload the script to
your server and then follow the instructions below.


HOW TO USE - 2CHECKOUT
========================================
Using the 2Checkout functionality takes a bit of work, at
least if you want to be truly automated. For a basic 2Checkout
transaction, place the commandrequire_once("processors.php");
at the top of your existing script (for example, the script
that your order form posts to). Call the twocheckout() function
from your script like so:
twocheckout($amount [,$invoice]);
The only parameter you must pass to the twocheckout function is
the dollar amount of the transaction. The customer will
be redirected to a payment form at 2Checkout's site which
lets them make their payment. If you do not supply an invoice
number, one will be randomly generated for you.Using the twocheckout() function in this basic manner, you will
receive the standard email notification from 2Checkout when
a customer makes a payment, and then you'll have to proceed
manually to provide the customer with his service or product.
This is recommended for non-advanced users.
Now comes the tricky part. If you want to _automate_ the
process of validating 2Checkout transactions and performing
actions based upon the transaction status, you will need
to do two things:
1. Login to 2Checkout and edit your preferences so that 2Checkout's postback URL is set to your installed copy
of 2checkout_ipn.php.
2. Edit 2checkout_ipn.php. You will need to insert your own
PHP code for each of the possible outcomes of a 2Checkout
transaction. 2checkout_ipn.php contains more detailed

instructions.
Note that step 2 requires writing your own PHP code. (If
you don't know PHP, contact PHPSelect.com for a quote on
custom coding.)


2checkout_ipn.php


<?php

  # FILE: 2checkout_ipn.php

  # ----

  # Description: This script handles postback notifications from

# 2Checkout's gateway.
################################################################

  # After someone makes a 2Checkout payment through your site,   #

  # 2Checkout will access this script to instantly notify you    #

  # about the status of the transaction.                         #

  #                                                              #

  # By default, this script will send a "thank you" email to the #

  # payer when a 2Checkout transaction is successfully completed.#

  # Assuming you want to perform some automatic functions when a #

  # payment is completed (like creating a new user's account),   #

  # you MUST insert your own code into the areas marked below in #

  # the body of this script. Each block corresponds to one of the#

  # potential outcomes of a new payment: transaction approved    #

  # or transaction declined.                                     #

  #                                                              #

  # For example, if you're selling a software package on your    #

  # site, you would want to put code in the "success" block that #

  # emails the payer a copy of the software. 2Checkout will post #

  # a number of variables to this script, which you may find     #

  # useful. Some of these variables are:                         #

  #                                                              #

  #   $_POST[order_number]                                       #

  #   $_POST[card_holder_name]                                   #

  #   $_POST[street_address]                                     #

  #   $_POST[city]                                               #

  #   $_POST[state]                                              # 

  #   $_POST[zip]                                                #

  #   $_POST[country]                                            #

  #   $_POST[email]                                              #

  #   $_POST[phone]                                              #

  #   $_POST[cart_order_id]                                      #

  #   $_POST[cart_id]                                            #

  #   $_POST[credit_card_processed]                              #

  #   $_POST[total]                                              #

  #   $_POST[ship_name]                                          #

  #   $_POST[ship_street_address]                                #

  #   $_POST[ship_city]                                          #

  #   $_POST[ship_state]                                         #

  #   $_POST[ship_zip]                                           #

  #   $_POST[ship_country]                                       #

  #                                                              #

  # See the 2Checkout admin area for more information.           #

  ################################################################
# Get the posted data

  $params = "cmd=_notify-validate";
while(list($key, $val) = each($_POST)){

  $val = urlencode(stripslashes($val));

  $params .= "&$key=$val";

  }
if($_POST[credit_card_processed] == "Y"){

  #payment was successful
############################################################

  # INSERT YOUR OWN CODE HERE TO BE PERFORMED WHEN A PAYMENT #

  # WAS SUCCESSFULLY RECEIVED                                #

  ############################################################
#### Placeholder code to send "thank you" email

  $to = $_POST[email];

  $from = "test@example.com";

  $message = "Thanks for your 2Checkout payment of $$_POST[total]!";

  mail($to, "Thank you!", $message, "From: $from");

  #### End placeholder code
}
else{

  #transaction was declined or did not go through
############################################################

  # INSERT YOUR OWN CODE HERE TO BE PERFORMED WHEN A PAYMENT #

  # WAS DECLINED OR DID NOT GO THROUGH                       #

  ############################################################

  }


?>

Processors.php
<?php

  # FILE: processors.php

  # ----

  # Description: This file contains the function used to post

# transactions 2Checkout.
################################################################

  # You MUST set the following variable before using the script  #

  ################################################################
# $merchant2cuser is your merchant ID for 2Checkout. 
$merchant2cuser = "test";
################################################################

  # End of configuration - No need to edit below this line       #

  ################################################################
#Process a transaction via 2Checkout

  #Returns: None. Transaction status will be posted to 

  #2checkout_ipn.php by 2Checkout.
function twocheckout($amount, $invoice=0){
global $_SERVER, $merchant2cuser;
$target = "https://www.2checkout.com/cgi-bin/sbuyers/cartpurchase.2c?";

  $amount = sprintf("%.02f", $amount);
if(!$invoice)

  $invoice = sprintf("%06d", rand(111111, 999999));
$params = "sid=$merchant2cuser&total=$amount&cart_order_id=$invoice";
$params = str_replace(" ", "%20", $params);
header("Location: $target$params");
}
?>

By PHP with 14 comments

Password Protect PHP Script

Set usernames / passwords below between SETTINGS START and SETTINGS END.

Open it in browser with "help" parameter to get the code

to add to all files being protected.

Example: password_protect.php?help

Include protection string which it gave you into every file that needs to be protected



Add following HTML code to your page where you want to have logout link <a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a> -------------------------------------------------------------------

SAMPLE if you only want to request login and password on login form.

Each row represents different user.



$LOGIN_INFORMATION = array(

'sharemyphp' => 'root',

'test' => 'testpass',

'admin' => 'passwd'

);



--------------------------------------------------------------------

SAMPLE if you only want to request only password on login form.

Note: only passwords are listed



$LOGIN_INFORMATION = array(

'root',

'testpass',

'passwd'

);



--------------------------------------------------------------------

<?php

   ##################################################################

   #  SETTINGS START

 ##################################################################
// Add login/password pairs below, like described above

   // NOTE: all rows except last must have comma "," at the end of line

   $LOGIN_INFORMATION = array(

   'sharemyphp' => 'root',

   'admin' => 'adminpass'

   );
// request login? true - show login and password boxes, false - password box only

   define('USE_USERNAME', true);
// User will be redirected to this page after logout

   define('LOGOUT_URL', 'http://www.example.com/');
// time out after NN minutes of inactivity. Set to 0 to not timeout

   define('TIMEOUT_MINUTES', 0);
// This parameter is only useful when TIMEOUT_MINUTES is not zero

   // true - timeout time from last activity, false - timeout time from login

   define('TIMEOUT_CHECK_ACTIVITY', true);
##################################################################

   #  SETTINGS END

   ##################################################################

 
///////////////////////////////////////////////////////

   // do not change code below

   ///////////////////////////////////////////////////////
// show usage example

   if(isset($_GET['help'])) {

   die('Include following code into every page you would like to protect, at the very beginning (first line):<br>&lt;?php include("' . str_replace('\\','\\\\',__FILE__) . '"); ?&gt;');

   }
// timeout in seconds

   $timeout = (TIMEOUT_MINUTES == 0 ? 0 : time() + TIMEOUT_MINUTES * 60);
// logout?

   if(isset($_GET['logout'])) {

   setcookie("verify", '', $timeout, '/'); // clear password;

   header('Location: ' . LOGOUT_URL);

   exit();

   }
if(!function_exists('showLoginPasswordProtect')) {
// show login form

   function showLoginPasswordProtect($error_msg) {

   ?>

   <html>

   <head>

  <title>Please enter password to access this page</title>

  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

  </head>

  <body>

  <style>

   input { border: 1px solid black; }

  </style>

  <div style="width:500px; margin-left:auto; margin-right:auto; text-align:center">

  <form method="post">

  <h3>Please enter password to access this page</h3>

  <font color="red"><?php echo $error_msg; ?></font><br />

  <?php if (USE_USERNAME) echo 'Login:<br /><input type="input" name="access_login" /><br />Password:<br />'; ?>

  <input type="password" name="access_password" /><p></p><input type="submit" name="Submit" value="Submit" />

  </form>

  <br />

  <a style="font-size:9px; color: #B0B0B0; font-family: Verdana, Arial;" href="http://www.sharemyphp.com/"  >Powered by Sharemyphp</a>

  </div>

  </body>

  </html>
<?php

   // stop at this point

   die();

   }

   }
// user provided password

   if (isset($_POST['access_password'])) {
$login = isset($_POST['access_login']) ? $_POST['access_login'] : '';

   $pass = $_POST['access_password'];

   if (!USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION)

   || (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) ) 

   ) {

   showLoginPasswordProtect("Incorrect password.");

   }

   else {

   // set cookie if password was validated

   setcookie("verify", md5($login.'%'.$pass), $timeout, '/');

  

   // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed

   // So need to clear password protector variables

   unset($_POST['access_login']);

   unset($_POST['access_password']);

   unset($_POST['Submit']);

   }
}
else {
// check if password cookie is set

   if (!isset($_COOKIE['verify'])) {

   showLoginPasswordProtect("");

   }
// check if cookie is good

   $found = false;

   foreach($LOGIN_INFORMATION as $key=>$val) {

   $lp = (USE_USERNAME ? $key : '') .'%'.$val;

   if ($_COOKIE['verify'] == md5($lp)) {

   $found = true;

   // prolong timeout

   if (TIMEOUT_CHECK_ACTIVITY) {

   setcookie("verify", md5($lp), $timeout, '/');

   }

   break;

   }

   }

   if (!$found) {

   showLoginPasswordProtect("");

   }
}
?>

 

By PHP with No comments

PHP Find my IP address Script

This is the simple script for findiong my IP Address by using PHP

By using this script you agree that we will not be held responsible for any damages to you or your business or website

For more scripts, tutorials, free Cpanel hosting and all round webmaster resources


<? 

  $host = $_SERVER["HTTP_HOST"];

  $userip = $_SERVER['REMOTE_ADDR']; 

  $vis_ip = $_SERVER["REMOTE_ADDR"]; 

  $user_agent = $_SERVER["HTTP_USER_AGENT"]; 

  ?>

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <html xmlns="http://www.w3.org/1999/xhtml">

  <head>

  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

  <title>Free Check My IP Script - Sharemyphp</title>

  <style type="text/css">

  <!--

  body {

background-color: #0086DF;

}body,td,th {

  font-family: Geneva, Arial, Helvetica, sans-serif;

  font-size: 12px;

  color: #666666;

  }

  .title {

  font-size: 36px;

  font-weight: bold;

  }

  .show {

  font-size: 14px;

  }

  -->

  </style>

  </head>

  <body>

  <table width="487" height="238" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

  <td width="488" height="238" align="center" valign="middle" background="images/bg.png"><table width="100%" border="0" cellspacing="2" cellpadding="5">

  <tr>

  <td align="center" class="title">Check My IP</td>

  </tr>

  <tr>

  <td>Below is the IP address that is connecting you to the internet, every computer or server must have a IP address to contect to the would wide web.</td>

  </tr>

  <tr>

  <td height="37" class="show"><strong>Your IP address is:</strong> <? echo "".$userip.""; ?> </td>

  </tr>

  <tr>

  <td class="show">Place your ads here </td>

  </tr>

  <tr>

  <td><span class="show"><strong>Your browser is:</strong> <? echo "".$user_agent."";?></span></td>

  </tr>

  </table></td>

  </tr>

  </table>

  <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

  <td align="center">Copyright &copy; <? echo date("Y");?>

  <? echo "".ucfirst($host)."";?> </td>

  </tr>

  </table>

  </body>

  </html>

By PHP with No comments

Simple PHP Free membership script

In order to get this membership script working you need a PHP Web Hosting account with one Mysql database.

Step 1: Login to your web hosting account and create a database and inport the database.sql file.

Step 2: Open config.php with notepad and change the settings to your database details.

Step 3: Upload all the files to your web server.

If you have completed the following steps above your free membership system should be working.

Please note: we do not provide any support for this free script, login to our members area for free updates of this script.


Database.sql


CREATE TABLE IF NOT EXISTS `members` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `ip` varchar(255) NOT NULL,
  `date` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ; 


<? ob_start(); session_start();
// This simple PHP / Mysql membership script was created by www.funkyvision.co.uk
// You are free to use this script at your own risk
// Please visit our website for more updates..
$db_host = "localhost"; // most are localhost
$db_username = " "; // Database user name goes here
$db_password = " "; // Database user password goes here
$db_name = " "; // place your database name here
mysql_connect ("".$db_host."", "".$db_username."","".$db_password."") or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ("".$db_name."");
// Your sitename
$site_name = "Sharemyphp Script";
// Your emaim address
$site_email = " your email here";

?> 
Login.php
<? ob_start();session_start();include_once"config.php";
// This FV Membership Script V2 was created by www.funkyvision.co.uk
// You are free to use this script at your own risk
// Please visit our website for more updates..
if(isset($_SESSION['username']) || isset($_SESSION['password'])){
 header("Location: membersarea.php");
}else{
if(isset($_POST['login'])){
$username= trim($_POST['username']);
$password = trim($_POST['password']);
if($username == NULL OR $password == NULL){
$final_report.="Please complete all the fields below..";
}else{
$check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
if(mysql_num_rows($check_user_data) == 0){
$final_report.="This username does not exist..";
}else{
$get_user_data = mysql_fetch_array($check_user_data);
if($get_user_data['password'] != $password){
$final_report.="Your password is incorrect!";
}else{
$start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
$start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
$final_report.="You are about to be logged in, please wait a few moments.. <meta http-equiv='Refresh' content='2; URL=membersarea.php'/>";
}}}}}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FV Membership Script V2</title>
<style type="text/css">
<!--
body,td,th {font-family: Arial, Helvetica, sans-serif;font-size: 13px;
}
.bglink {color: #FFFFFF}
.bglink a{color: #FFFFFF;
}
.bglink a:visited {color: #FFFFFF;
}
.title {color: #0066CC;font-weight: bold;font-size: 18px;
}
-->
</style>
</head>
<body>
<form action="" method="post">
  <table width="400" align="center" cellpadding="2" cellspacing="2">
    <tr>
      <td colspan="2" align="center" bgcolor="#0066CC" class="bglink">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center" class="title">FV Membership Script V2</td>
    </tr>
    <tr>
      <td colspan="2"><? if(!isset($_POST['login'])){?>
        Please use your username and password to login.
        <? }else{ echo "".$final_report."";}?></td>
    </tr>
    <tr>
      <td width="120">Username:</td>
      <td width="180"><input type="text" name="username" size="30" maxlength="25"></td>
    </tr>
    <tr>
      <td>Password:</td>
      <td><input type="password" name="password" size="30" maxlength="25"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="login" value="Login" /></td>
    </tr>
    <tr>
      <td colspan="2" align="center">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center" bgcolor="#0066CC" class="bglink"><a href="register.php">Register</a> - <a href="lostpassword.php">Lost Password</a></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><a href="#" target="_blank">Powered By Sharemyphp</a></td>
    </tr>
  </table>
</form>
</body>
</html>
 
 Logout.php
 
<? ob_start(); session_start();include_once"config.php";
// This FV Membership Script V2 was created by www.funkyvision.co.uk
// You are free to use this script at your own risk
// Please visit our website for more updates..
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
 header("Location: login.php");
}else{
session_unset('username');
session_unset('password');
echo "<meta http-equiv='Refresh' content='2; URL=login.php'/>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FV Membership Script V2</title>
<style type="text/css">
<!--
body,td,th {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 13px;
}
a:link {
 color: #0066FF;
}
a:visited {
 color: #0066FF;
}
a:hover {
 color: #0066FF;
}
a:active {
 color: #0066FF;
}
.title {
 color: #0066CC;
 font-weight: bold;
 font-size: 18px;
}
.header { color:#FFFFFF;}
-->
</style>
</head>
<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="2">
  <tr>
    <td height="30" colspan="2" class="title">&nbsp;FV Membership Script V2</td>
  </tr>
  <tr>
    <td width="170" bgcolor="#0066CC" class="header">&nbsp;Members Menu</td>
    <td width="524" bgcolor="#0066CC" class="header">&nbsp;Logout</td>
  </tr>
  <tr>
    <td height="20" valign="top"><a href="membersarea.php">Members Area</a></td>
    <td rowspan="4" valign="top">You are now logging out..<a href="#" target="_blank"></a></td>
  </tr>
  <tr>
    <td height="20" valign="top"><a href="settings.php">Settings</a><a href="members.php"></a></td>
  </tr>
  <tr>
    <td height="20" valign="top"><a href="logout.php">Logout</a></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#0066CC">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="center"><a href="#" target="_blank">Powered By Sharemyphp</a></td>
  </tr>
</table>
</body>
</html>
 


Logout.php



<? ob_start();include_once"config.php";
// This FV Membership Script V2 was created by www.funkyvision.co.uk
// You are free to use this script at your own risk
// Please visit our website for more updates..
if(isset($_SESSION['username']) || isset($_SESSION['password'])){
    header("Location: membersarea.php");
}else{
 if(isset($_POST['lostpassword'])) {
 $email = $_POST['email'];
 if($email == NULL) {
 $final_report.="Please make sure you have completed the form!";
 }else{
 $query_data = mysql_query("SELECT * FROM `members` WHERE `email`='".$email."'");
 if(mysql_num_rows($query_data) == 0){
 $final_report.="This email addresss is not in our database.";
 }else{
 $query_data = mysql_query("SELECT * FROM `members` WHERE `email`='".$email."'");
 $final_report.="Your details have been sent to your account email!";
 $get_data = mysql_fetch_array($query_data);
 $subject = "Membership Details"; 
 $message = "Hello ".$get_data['username'].", 

Your password is: ".$get_data['password']."

Thank you,
Sharemyphp Script

This is a automated password response, please do not reply to this email!
Script Powered by Funky Vision";  
mail($get_data['email'], $subject, $message,"From: ".$site_name." <".$site_email.">\n"); 
header( 'refresh: 3; url=login.php');
}}}}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FV Membership Script V2</title>
<style type="text/css">
<!--
body,td,th {font-family: Arial, Helvetica, sans-serif;font-size: 13px;
}
.bglink {color: #FFFFFF}
.bglink a{color: #FFFFFF;
}
.bglink a:visited {color: #FFFFFF;
}
.title {color: #0066CC;font-weight: bold;font-size: 18px;
}
-->
</style>
</head>
<body>
<form method="post">
  <table width="400" border="0" align="center" cellpadding="2" cellspacing="2">
    <tr>
      <td colspan="2" bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center" class="title">FV Membership Script V2</td>
    </tr>
    <tr>
      <td colspan="2"><? if(!isset($_POST['lostpassword'])){?>
        Please enter your email address if you have lost your password.
        <? }else{ echo "".$final_report."";}?></td>
    </tr>
    <tr>
      <td width="37%">Email:</td>
      <td width="63%"><input name="email" type="text" id="email" size="30" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="lostpassword" type="submit" value="Lost Password" /></td>
    </tr>
    <tr>
      <td colspan="2" align="center" bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><a href="#" target="_blank">Powered By Sharemyphp</a></td>
    </tr>
  </table>
</form>
</body>
</html>


Membership.php

<? include_once"config.php";
// This FV Membership Script V2 was created by www.funkyvision.co.uk
// You are free to use this script at your own risk
// Please visit our website for more updates..
if(isset($_SESSION['username']) || isset($_SESSION['password'])){
    header("Location: membersarea.php");
}else{
if(isset($_POST['register'])){
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$memip = $_SERVER['REMOTE_ADDR'];
$date = date("d-m-Y");
if($username == NULL OR $password == NULL OR $email == NULL){
$final_report.= "Please complete the form below! Try again.";
}else{
if(strlen($username) <= 2 || strlen($username) >= 31){
$final_report.="Your username must be between 3 and 30 characters! Try again.";
}else{
$check_members = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");  
if(mysql_num_rows($check_members) != 0){
$final_report.="The username is already in use! Try again.";
}else{
if(strlen($password) <= 5 || strlen($password) >= 12){
$final_report.="Your password must be between 6 and 12 digits and characters! Try again.";
}else{
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
$final_report.="Your email address was not valid! Try again.";
}else{
$create_member = mysql_query("INSERT INTO `members` (`id`,`username`, `password`, `email`, `ip`, `date`)
VALUES('','$username','$password','$email','$memip','$date')");
$final_report.='Thank you for registering, you may <a href="login.php">login here</a>.';
}}}}}}}
?>

Register.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FV Membership Script V2</title>
<style type="text/css">
<!--
body,td,th {font-family: Arial, Helvetica, sans-serif;font-size: 13px;
}
.bglink {color: #FFFFFF}
.bglink a{color: #FFFFFF;
}
.bglink a:visited {color: #FFFFFF;
}
.title {color: #0066CC;font-weight: bold;font-size: 18px;
}
-->
</style>
</head>
<body>
<form method="post">
  <table width="400" border="0" align="center" cellpadding="2" cellspacing="2">
    <tr>
      <td colspan="2" bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center" class="title">FV Membership Script V2</td>
    </tr>
    <tr>
      <td colspan="2"><? if(!isset($_POST['register'])){?>
        Complete the form below to create your account.
        <? }else{ echo "".$final_report."";}?></td>
    </tr>
    <tr>
      <td width="37%">Username:</td>
      <td width="63%"><input name="username" type="text" id="username" size="30" /></td>
    </tr>
    <tr>
      <td>Password:</td>
      <td><input name="password" type="password" id="password" value="" size="30" /></td>
    </tr>
    <tr>
      <td>Email:</td>
      <td><input name="email" type="text" id="email" size="30" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="register" type="submit" id="register" value="Register" /></td>
    </tr>
    <tr>
      <td colspan="2" align="center" bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><a href="#" target="_blank">Powered By Sharemyphp</a></td>
    </tr>
  </table>
</form>
</body>
</html> 

Settings.php

<? ob_start(); session_start();include_once"config.php";
// This FV Membership Script V2 was created by www.funkyvision.co.uk
// You are free to use this script at your own risk
// Please visit our website for more updates..
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
 header("Location: login.php");
}else{
$user_data = "".$_SESSION['username']."";
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE `username`='".$user_data."'"));
}
if(isset($_POST['update'])){
$oldp = $_POST['oldpass'];
$newp = $_POST['newpass'];
$conp = $_POST['conpass'];
if($oldp == NULL OR $newp == NULL OR $conp == NULL){
$final_report.="Please complete all the form fields!";
}else{
$check_pass = mysql_query("SELECT * FROM `members` WHERE `username`='".$user_data."'");
$check_data = mysql_fetch_array($check_pass);
if($check_data['password'] != $oldp){
$final_report.="Your old password does not match the database!";
}else{
if(strlen($newp) <= 5 || strlen($newp) >= 12){
$final_report.="Your password must be between 6 and 12 digits and characters!";
}else{
if($newp != $conp){
$final_report.="The confirmed password does not match your new password!";
}else{
$update_pass = mysql_query("UPDATE `members` SET `password` = '$newp' WHERE `username` = '".$user_data."' LIMIT 1");
$final_report.="Your password has been changed, you will need to login again.";
@session_destroy(); 
header( 'refresh: 3; url=login.php');
}}}}}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FV Membership Script V2</title>
<style type="text/css">
<!--
body,td,th {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 13px;
}
a:link {
 color: #0066FF;
}
a:visited {
 color: #0066FF;
}
a:hover {
 color: #0066FF;
}
a:active {
 color: #0066FF;
}
.title {
 color: #0066CC;
 font-weight: bold;
 font-size: 18px;
}
.header { color:#FFFFFF;}
-->
</style>
</head>
<body>
<form method="post">
  <table width="700" border="0" align="center" cellpadding="0" cellspacing="2">
    <tr>
      <td height="30" colspan="2" class="title">&nbsp;FV Membership Script V2</td>
    </tr>
    <tr>
      <td width="170" bgcolor="#0066CC" class="header">&nbsp;Members Menu</td>
      <td width="524" bgcolor="#0066CC" class="header">&nbsp;Settings</td>
    </tr>
    <tr>
      <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="2">
          <tr>
            <td><a href="membersarea.php">Members Area</a> </td>
          </tr>
          <tr>
            <td><a href="settings.php">Settings</a></td>
          </tr>
          <tr>
            <td><a href="logout.php">Logout</a></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="2">
          <tr>
            <td colspan="2"><? if(!isset($_POST['update'])){ echo "".$user_data."";?>, this is where you can update your password, just enter your old and new password below and then click on the  apply changes button.
              <? }else{
  echo"".$final_report."";
  
  }?></td>
          </tr>
          <tr>
            <td width="42%">Old Password: </td>
            <td width="58%"><input name="oldpass" type="password" id="oldpass"></td>
          </tr>
          <tr>
            <td>New Password: </td>
            <td><input name="newpass" type="password" id="newpass"></td>
          </tr>
          <tr>
            <td>Confirm Password: </td>
            <td><input name="conpass" type="password" id="conpass"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input name="update" type="submit" id="update" value="Apply Changes"></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="16" colspan="2" align="center" valign="top" bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td height="16" colspan="2" align="center" valign="top"><a href="#" target="_blank">Powered By Sharemyphp</a></td>
    </tr>
  </table>
</form>
</body>
</html>

By PHP with No comments

Free PHP Random quote script

This is a random quote script
By using this script you agree that we will not be held responsible for any damages to you or your business or website
For more scripts, tutorials, free Cpanel hosting and all round webmaster resources
<?


$random_text = rand(1,5);

if($random_text == "1") {
// change the text below for quote one
echo "This is random quote One!";
}elseif($random_text == "2") {
// change the text below for quote two
echo "This is random quote Two!";
}elseif($random_text == "3") {
// change the text below for quote three
echo "This is random quote Three!";
}elseif($random_text == "4") {
// change the text below for quote four
echo "This is random quote Four!";
}elseif($random_text == "5") {
// change the text below for quote five
echo "This is random quote Five!";
}
?>

By PHP with No comments

Php Script for File Downloder

This is a simple script to enable your visitors download your files. The script can
be used for protection from direct download, check user's authentication, write logs,
and such.

Features
--------
* Can download any files: zip, images, pdf, php, etc.
* Displays a 'You are downloading...' page before sending the file.
* Simple and easy to develop.


INSTALLATION
------------
1. Move the script to your site, eg. http://yourdomain.com/download.php
2. If your download files reside in another directory, change the line:

    $fileserver_path = dirname(__FILE__);

   to the directory where your files reside. maybe something like this:
  
    $fileserver_path = '/var/www/pub/downloads';

3. Refer your downloads to this script. eg:
   
    http://yourdomain.com/download.php?file=how_to_make_money_online.pdf

   
<?php
/*
 * use this script to enable your visitors to download
 * your files. 
 */

$fileserver_path = dirname(__FILE__);    // change this to the directory your files reside
$req_file          = basename($_GET['file']);
$whoami             = basename(__FILE__);    // you are free to rename this file 

if (empty($req_file)) {
    print "Usage: $whoami?file=&lt;file_to_download&gt;";
    exit;
}

/* no web spamming */
if (!preg_match("/^[a-zA-Z0-9._-]+$/", $req_file, $matches)) {
    print "I can't do that. sorry.";
    exit;
}

/* download any file, but not this one */
if ($req_file == $whoami) {
    print "I can't do that. sorry.";
    exit;
}

/* check if file exists */
if (!file_exists("$fileserver_path/$req_file")) {
    print "File <strong>$req_file</strong> doesn't exist.";
    exit;
}

if (empty($_GET['send_file'])) {
    header("Refresh: 5; url=$whoami?file=$req_file&send_file=yes");
}
else {
    header('Content-Description: File Transfer');
    header('Content-Type: application/force-download');
    header('Content-Length: ' . filesize("$fileserver_path/$req_file"));
    header('Content-Disposition: attachment; filename=' . $req_file);
    readfile("$fileserver_path/$req_file");
    exit;
}
?>

<!-- Change the HTML page below for your convenient -->
<html>
<head>
<title>Simple File Server and Downloader Demo Page</title>
<!-- Maybe Google Analytics here? -->
</head>
<body>
<h2>Downloading <?=$req_file?>...</h2>
<p>Your download should begin shortly. If it doesn't start, 
   follow this <a href="<?=$req_file?>">link</a>.</p>
</body>
</html>

By PHP with No comments

Sunday, December 12, 2010

Feedback form Using PHP Script Form

Install Instructions:

1.Open eeezy_mail.php and edit the first $msg variable, $to (your email address), $subject (subject of the email you will get upon submission, the first $mailheaders (your email again). That is it. If you use this script, please keep the link to my site intact.
<html>
<head>
<title>EEEzy Feedback Form V 1.2</title>
</head>
<body>
<?
$form_block = "
<form method=\"post\" action=\"$PHP_SELF\">
<p><strong>Your name:</strong><br>
<input type=\"text\" name=\"name\" size=30 value=\"$_POST[name]\"</p>
<p><strong>Your email:</strong><br>
<input type=\"text\" name=\"email\" value=\"$_POST[email]\"size=30</p>
<p><strong>Comments:</strong><br>
<textarea name=\"comments\" cols=30 rows=5 wrap=virtual>$_POST[comments]</textarea></p>
<input type=\"hidden\" name=\"op\" value=\"ds\">
<p><input type=\"submit\" name=\"submit\" value=\"Send Form\"></p><br>
<a href=\"http://www.nafwa.org/\"><font size=\"1\"><b>Powered By The Nutrition and Food Web Archive
</b></font>
</form>";

if ($_POST[op] != "ds") {
echo "$form_block";

} else if ($_POST[op] =="ds") {

if ($_POST[name] == "") {
    $name_err = "<font color=blue>Please enter your name!</font><br>";
    $send="no";
}
if ($_POST[email] == "") {
    $email_err = "<font color=blue>Please enter your email!</font><br>";
    $send="no";
}
if ($_POST[comments] == "") {
    $message_err = "<font color=blue>Please enter a comment!</font><br>";
    $send="no";
}
if ($send !="no") {
$msg = "email sent from mywebsite.com\n";
$msg .="Name: $_POST[name]\n";
$msg .="Email: $_POST[email]\n";
$msg .="Comments: $_POST[comments]\n";
$to = "admin@mydomain.com";
$subject = "Feedback Form";
$mailheaders = "From: My Website <admin@mydomain.com>\n";
$mailheaders .= "Reply-To: $_POST[email]\n";
mail ($to, $subject, $msg, $mailheaders);
    echo "<p>Mail has been sent!</p>";

} else if ($send == "no") {
    echo "$name_err";
    echo "$email_err";
    echo "$message_err";
    echo "$form_block";
     }

}
?>

</body>
</html> 

By PHP with No comments

Friday, November 19, 2010

How to use the JavaScript in our Webpage HTML

JavaScript Starting and Ending with Script Tags <Script>

Tags Starting with <script type = text/javascript> and ending with </script>.

Syntax of JavaScript:
<html> 
   <body> 
     <script type="text/javascript"> 
        ... //Place the JavaScript code 
     </script> 
   </body> 
</html>

JavaScript can be placed in various locations in HTML such as Place between the Head Part and body

Example for Placing JavaScript- Head part in the HTML
<html> 
   <head> 
     <script type="text/javascript"> 
        .....
        ..... // HEAD Section JavaScript
     </script> 
   </head>


   <body>
   </body>
</html>
Example for Placing JavaScript- Body  part in the HTML
<html> 
   <head> 
   </head>


   <body>
     <script type="text/javascript"> 
        .....
        ..... //BODY Section JavaScript
     </script> 
   </body>
</html>
Example for Placing JavaScript on Both Places Head, Body  part in the HTML
<html> 
   <head> 
     <script type="text/javascript"> 
        // HEAD Section JavaScript
        document.write("JavaScript placed in HEAD Section")
     </script> 


   </head>


   <body>
     <script type="text/javascript"> 
        // BODY Section JavaScript
        document.write("JavaScript placed in BODY Section")
     </script> 
   </body>
</html>

Example for Print values using Write In JavaScript in the HTML

JavaScript output to a page is document.write.  The document.write command takes the argument as the text required for producing output.
<html> 
   <head> 
     <script type="text/javascript"> 
        // HEAD Section JavaScript
        document.write("JavaScript placed in HEAD Section")
     </script> 


   </head>


   <body>
     <script type="text/javascript"> 
        // BODY Section JavaScript
        document.write("JavaScript placed in BODY Section")
     </script> 
   </body>
</html>

By PHP with No comments

JavaScript Table of Contents


  1.  JavaScript Introduction
  2. JavaScript How to Work
  3. JavaScript Write
  4. JavaScript Html Tags
  5. JavaScript Alert Msg
  6. JavaScript Variables
  7. JavaScript Loops
  8. JavaScript Date
  9. JavaScript Array
  10. JavaScript Functions

By PHP with No comments

Introduction About JavaScript

Netscape developed the client side scripting language called JavaScript. JavaScript used along with HTML to build an efficient web site / webpage.


In Starting stage, all the websites developed only in the static pages using HTML. On that time, not able to develop the dynamic action pages in the web based information’s.


JavaScript’s used as following way,

create dynamic changes, validate forms, detect visitor details, create/use cookies



JavaScript is never confused with Java. Sun Microsystems developed Java and it’s not liked with JavaScript


There are two types of script languages server side and client side.

All the major browsers are supports the javascript such as Internet Explorer, Mozilla, Firefox, Netscape, Opera, Safari and more.

By PHP with No comments

Thursday, November 18, 2010

PHP File Extensions

PHP files are following file extensions only

  1. .php
  2. .php3
  3. .phtml

This files content text, HTML, Javascript, styles

By PHP with No comments

What is PHP?

PHP is the powerful open source server side scripting language.PHP means Hypertext Preprocessor. In this PHP script runs only on server side not client side.

Mostly all the databases are suitable for using PHP (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc. )

Its a free to download and easy to use.

Before going to use PHP, You should know about following,

  • HTML
  • JAVASCRIPT

By PHP with No comments

Wednesday, November 17, 2010

Login Page creation using PHP/MYSQL

When you are going to create login, you should follow the following steps

Technology : PHP
Database MYSQL
Server : WAMP

1. Create the user table
CREATE TABLE `Users` ( `user_id` int(4) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `userpassword` varchar(65) NOT NULL default '', PRIMARY KEY (`user_id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;


   Insert user login information into table

INSERT INTO users VALUES (1, 'john', '1234');


2. Create the login page like mylogin.php
<form id="form1" name="form1" method="post" action="my_login_action.php">
  <table border="0"  width="95%" cellpadding="0" align="center" cellspacing="0" >
    <!--DWLayoutTable-->
    <tr>
      <td colspan="4" height="25" align="left">&nbsp;</td>
    </tr>
    <tr>
      <td  width="68"></td>
      <td height="35" width="173" align="right" valign="middle">My e-mail address is:</td>
      <td  width="7"></td>
      <td width="441" align="left" valign="middle"><input name="login_email" type="text" id="login_email" maxlength="50" />
      </td>
    </tr>
    <tr>
      <td  ></td>
      <td height="35"  align="right" valign="middle">My password is:</td>
      <td  ></td>
      <td align="left" ><input name="login_password" type="password" id="login_password" maxlength="50" />
        </span></span></td>
    </tr>
    <tr>
      <td height="45" colspan="4" align="right" valign="middle"><label>
        <input  name="Login" src="images/log-in-button.gif"  type="image" id="Login" value="Login" />
        </label>
      </td>
    </tr>
  </table>
</form> 

3. Create the login action file as my_login_action.php
 
if($_REQUEST['Login'])
{
    extract($_REQUEST);
    
    $_check_login = "Select * from  Users where username = '$login_email' && userpassword = '$login_password'";
    $_check_login_01 =     mysql_query($_check_login) or die(mysql_error());
    if(mysql_num_rows($_check_login_01) > 0)
    {
        
            header("Location: successlogin.php");
            exit();
        
    }
    else
    {
        header("Location: failurelogin.php");
        exit();
    }
    
} 
 
4. Create the login success page as successlogin.php
        <?php
        // Check if session is registred or not. If not redirected to main page of the php
        // paste this code on the first line in the page of php 
        
        session_start();
        if(!session_is_registered(successusername)){
        header("location:main_success_login.php");
        }
        ?>
        
        <html>
        <body>
        my php page  Successfully logged in
        </body>
        </html>
        </body>
        </html>

5. Create the login failure page page as failurelogin.php


        <?php
        // if login failed, page redirected to the main login page
        // paste this code on the first line in the login page of php 
        
        session_start();
        if(!session_is_registered(successusername)){
        header("location:main_login_page.php");
        }
        ?>
        
        <html>
        <body>
        you are mentioned user name or password is wrong
        </body>
        </html>
        </body>
        </html>

6. Create the Logout page page as logoff.php
     // Paste this code on the top off the logoff.php page.
        <?php
        session_start();
        session_destroy();  

Tags: php, Mysql, php login page, php mysql page, login page, email using php login, login using php, logout pge, logoff, create database, login success, login failure, login success php, login failure,php

By PHP with No comments

    • Popular
    • Categories
    • Archives