You are invited to Log in or Register a free Frihost Account!

Developing a Login Script for Website

Hey , i want to know how to add membership or login system for my WebSite ? Any suggestions
A simple Mysql and PHP soltuions would do the job grand. Its easy if you know PHP and abit of Mysql. Basicly what you do is when a user signs up hes/her details get place in the Mysql database, eg password and username. Then when they go to log in its just an easy Mysql query of the database amd an php if() statment. If the infromation ths user has put in matchs one of the rows of infromation the the mysql database redriect them here or for more secuity, start session. I have a few of these type of scripts on some of my websites, I will see what I can do about postting them.
Try using PHP::Auth library: It is free, effective and easy to use.
A typical example of using is:

require_once "Auth.php";

// Takes three arguments: last attempted username, the authorization
// status, and the Auth object.
// We won't use them in this simple demonstration -- but you can use them
// to do neat things.
function loginFunction($username = null, $status = null, &$auth = null)
     * Change the HTML output so that it fits to your
     * application.
    echo "<form method=\"post\" action=\"test.php\">";
    echo "<input type=\"text\" name=\"username\">";
    echo "<input type=\"password\" name=\"password\">";
    echo "<input type=\"submit\">";
    echo "</form>";

$options = array(
  'dsn' => "mysql://user:password@localhost/database",
$a = new Auth("DB", $options, "loginFunction");


if ($a->checkAuth()) {
     * The output of your site goes here.

<h3>PHP User Registration Form</h3>

// only validate form when form is submitted
if(trim($_POST["username_input"])=='' || strlen(trim($_POST["username_input"])) < 6 || strlen(trim($_POST["username_input"])) > 15) {
$error_msg.="Please enter a username between 6 to 15 characters long<br>";
if(trim($_POST["password_input"])=='' || strlen(trim($_POST["password_input"])) < 4) {
$error_msg.="Please enter a password at least 4 characters long<br>";
if(trim($_POST["email_input"])=='') {
$error_msg.="Please enter an email<br>";
} else {
// check if email is a valid address in this format
if(!ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]", $_POST["email_input"])) $error_msg.="Please enter a valid email address<br>";

// display error message if any, if not, proceed to other processing
// other process here
} else {
echo "<font color=red>$error_msg</font>";

<form method="POST" action="registration.php">
<table border="1" cellpadding="7" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<td width="16%" align="right">First Name</td>
<td width="84%">
<input type="text" name="first_name_input" size="20" value="<? echo $first_name_input; ?>"></td>
<td width="16%" align="right">Last Name</td>
<td width="84%">
<input type="text" name="last_name_input" size="20" value="<? echo $last_name_input; ?>"></td>
<td width="16%" align="right">Username</td>
<td width="84%">
<input type="text" name="username_input" size="20" value="<? echo $username_input; ?>"> (between
6 to 15 characters)</td>
<td width="16%" align="right">Password</td>
<td width="84%">
<input type="password" name="password_input" size="20" value="<? echo $password_input; ?>">
(must be at least 4 characters)</td>
<td width="16%" align="right">Email</td>
<td width="84%">
<input type="text" name="email_input" size="20" value="<? echo $email_input; ?>"></td>
<td width="16%" align="right"> </td>
<td width="84%">
<input type="submit" value=" Register " name="submit_button"></td>

the above script will validate the submitted info....

u cn then add the info into the db....

i think some one before me has already told u tht.... Very Happy Very Happy Very Happy Very Happy

And theres a load of addons for it.
Related topics
simple login script
Login Script
Login Script - PHP
150 frih$ if you make me a login script with....
Fix up a login script
Login System Tutorial Part 1 Creating Registration
Free PHP/MySQL login script
problem with login script
PHP login script problem
Free php script login / register , GREAT!
Servlet Basic login script?
Protect Your Page With Simple Login But Yet Powerful Script
Simple PHP Login Script
PHP Login-Script (With Sessions)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.