hi
To Start with I didnot Intend to hurt / damage anyones professional feelings..
To me a forum is a place where you do get help as someone suggested earlier . But when you say help it doesnot imply that you get the complete source code by just asking for the same..
If the user who requested the code in the first place felt that he asked a "Simple question" and felt offended by the remark past by other fellow users he is being unjust.
There have been several instance where developers with no knowledge whatsoever have
approached web - site s such as this with queries similar to the one pushed earlier and made profits out of the information garnered from some poor guy..
The forum is to help genuine users with genuine problems I AM NO WAY IMPLYING THAT THE USER IN THE FIRST INSTANCE IS NOT A GENUINE USER.
To start with the development of a simple login system using PHP and Mysql u need the following :
1. A table (Lets assume users)
2. A login page and a registration form which registers a new user to the web - site
3. A Validation process that validates whether the user is genuine.
Lets go with Step 1 :
Create the table users
(You can visit sourceforge.net and get the latest version of phpmyadmin from this web - site in case you dont already have it. It will make the task of creating the table easier)
Fields required :
u_id = > User Id (Primary Key )
u_name => User Name
u_pass = > User PAss
(You can also include other info like real name etc on the table)
Once the table is ready create the form that allows the user to be registered
Assume this page is register.php
and The submit page is registerdb.php
in the action page registerdb.php
-=-------------------
$sql = "insert into users('','$u_id','$u_name','u_pass')";
$res = mysql_query($sql,$connection);
// $connection is the connection stirng use use as in $connection = mysql_connect(host,Dbuname,dbpass);
if ($res)
{
header("location:login.php");
}
// redirect to the login page
Login .php
Create the login page
then in the action page lets say :vallogin.php
// Check for the validity of the user
$sql = "select u_id from users where u_login = '$login' && u_pass = '$password'";
$res = mysql_query($sql,$connection);
$num = mysql_numrows($res);
if($num)
{
// Valid user
// Create a cookie if you need
setcookie("cookiename",$login,time()+14400);
header("location:myaccount.php");
}
else
{
header("location:login.php");
}
=========================================
Hope this helps
Pradeep
Aspbyte Creations.com