parthshukla
Programmer
hello guys,
chech this one out it will do a lot if you are making an authorized area.....
befor you write this make a table or a seprate database if you like in mysql...
call it what you like, i have called in this example the databse login and the table usercheck
make the table with two field one is user and the other pass, and when you insert data into that choose password function in the pass field, which you will find in the mysql thing....
index.php
<?php
if (isset($HTTP_POST_VARS['user']) && isset($HTTP_POST_VARS['password']))
{
//if the user just tried to log on
$user = $HTTP_POST_VARS['user'];
$pass = $HTTP_POST_VARS['password'];
$db = mysql_connect('localhost','root','yourpassowrd');
mysql_select_db('login',$db);
$query = "select * from `usercheck` where user='$user' and pass=password('$password')";
$result = mysql_query($query);
$usercheck = mysql_num_rows($result)'
if ($usercheck == 1)
{
$HTTP_SESSION_VARS['valid_user'] = $user;
}
else
{
echo "Not authorized to view this page"
}
}
else
{
if (isset($HTTP_SESSION_VARS['valid_user']))
{
echo "You are logged in as: ". $HTTP_SESSION_VARS['valid_user'];
//put your stuff here, which you want a valid user to see
}
else
{
//put you form here, i haven't got time right now so you can make that part by your self
}
}
?>
this is the one it work with mine, but i haven't copied and pasted because i am at a pubic computer, but i think it will work i am still working on the logout page for this script, i will put it up when i've finished making but, you know give me some feedback at this or question, that will do...
Parth.....
chech this one out it will do a lot if you are making an authorized area.....
befor you write this make a table or a seprate database if you like in mysql...
call it what you like, i have called in this example the databse login and the table usercheck
make the table with two field one is user and the other pass, and when you insert data into that choose password function in the pass field, which you will find in the mysql thing....
index.php
<?php
if (isset($HTTP_POST_VARS['user']) && isset($HTTP_POST_VARS['password']))
{
//if the user just tried to log on
$user = $HTTP_POST_VARS['user'];
$pass = $HTTP_POST_VARS['password'];
$db = mysql_connect('localhost','root','yourpassowrd');
mysql_select_db('login',$db);
$query = "select * from `usercheck` where user='$user' and pass=password('$password')";
$result = mysql_query($query);
$usercheck = mysql_num_rows($result)'
if ($usercheck == 1)
{
$HTTP_SESSION_VARS['valid_user'] = $user;
}
else
{
echo "Not authorized to view this page"
}
}
else
{
if (isset($HTTP_SESSION_VARS['valid_user']))
{
echo "You are logged in as: ". $HTTP_SESSION_VARS['valid_user'];
//put your stuff here, which you want a valid user to see
}
else
{
//put you form here, i haven't got time right now so you can make that part by your self
}
}
?>
this is the one it work with mine, but i haven't copied and pasted because i am at a pubic computer, but i think it will work i am still working on the logout page for this script, i will put it up when i've finished making but, you know give me some feedback at this or question, that will do...
Parth.....