User Accounts managemant

This is a discussion on User Accounts managemant within the PHP General forums, part of the PHP Programming Forums category; I am new to all this php script stuff. I was wanting to create a website that would have phpauction ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-10-2006
kingrussian1@gmail.com
 
Posts: n/a
Default User Accounts managemant

I am new to all this php script stuff. I was wanting to create a
website that would have phpauction but i was also wanting to run
several other php scripts like a calender and a directory and possibly
several other scripts. I was wondering if there is a way that a user
could set up one account and it would automatically create account in
all the scripts this would allow users to keep the same user account
for all services. Does that makes sense. I just want people to enter
their information once and then they would be would have accounts for
all the services thanks.

Reply With Quote
  #2 (permalink)  
Old 02-10-2006
X-pl0id
 
Posts: n/a
Default Re: User Accounts managemant

Try adding this line to all services:

<?
include_once('login.php');
?>


login.php:

<?
mysql_connect($db["host"], $db["user"], $db["pass"]) or die("MySQL
error");
mysql_select_db($db["admin"]) or die("MySQL error");
session_start();
if($action=="logout")
{
session_unregister('name');
session_unregister('passwd');
exit("You have been logged out.<br><a href=\"".$PHP_SELF."\">Log in as
another user.</a>");
}
if (!isset($name) && !isset($pass))
{
exit("<form name=\"login\" action=\"".$PHP_SELF."\"
method=\"post\">
<input name=\"name\" type=\"text\" value=\"\"><br>
<input name=\"passwd\" type=\"password\" value=\"\"><br>
<input type=\"submit\" value=\"Log in\">
</form>");
}
else
{
session_register('name');
$_SESSION['name'] = $name;
session_register('passwd');
$_SESSION['passwd'] = $passwd;
$query="SELECT pass FROM `users` WHERE
`username`='".$_SESSION['name']."' LIMIT 0, 30";
$row=mysql_fetch_array(mysql_query($query));
$pass=$row["pass"];
if($_SESSION['name']==$name and
md5($_SESSION['passwd'])==$pass)
{
echo "<p align=\"right\">User:
[".$name."]<br><a href=\"".$PHP_SELF."?action=logout\">Log
Out</a></p>";
}
else
{
session_unregister('name');
session_unregister('passwd');
exit("
<form name=\"login\" action=\"".$PHP_SELF."\"
method=\"post\">
<input name=\"name\" type=\"text\" value=\"\"><br>
<input name=\"passwd\" type=\"password\"
value=\"\"><br>
<input type=\"submit\" value=\"Log in\">
</form>");
}
}

?>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:15 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0