Showing posts with label Logout. Show all posts
Showing posts with label Logout. Show all posts

Monday, December 13, 2010

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

    • Popular
    • Categories
    • Archives