Re: [PHP] RE: A straightforward user login coding

2002-09-09 Thread Adam Williams

search google for using PHP sessions and you will print the session ID
into the URL.

Adam

On Tue, 10 Sep 2002, YC Nyon wrote:

 I been searching for a user authentication codes all night but got no where
 with the results.
 Therefore, if someone can tell me where to find
 1. a user authentication using Mysql
 2. don't use cookies.
 3. also a logout script.

 my os is windows.

 TIA
 Nyon





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: A straightforward user login coding

2002-09-09 Thread Steve Bradwell

Hey there,

This is a page I wrote that does that with sessions, sorry its a little
messy but it should help you with the general idea.

HTH,
Steve.


//Copy the below into a php file and change all the variables and sql
statement to reflect your own data.

?
session_start();
if(isset($level)) session_destroy();
if (isset($submitbutton)):
$dbname   = 'put yours here';
$hostname = 'put yours here';
$username = 'put yours here';
$password = 'put yours here';
$table = 'put yours here';

$id_link = mysql_connect($hostname, $username, $password);

if (!$id_link  || !mysql_select_db($dbname)):
echo 'htmlheadtitleError/title/headbody';
echo '1:Connection to PHP has failed.';
echo '/body/html';
exit();
endif;


$login_query = SELECT l.LEVEL, l.Name, s.PLANT, s.Super_Index, p.PLANT as
itemtable FROM Master.login l;
$login_query.=  INNER JOIN Master.supervisors s ON l.Paswd_Index =;
$login_query.=  s.Login_Index INNER JOIN Master.plant_code p ON s.PLANT =
p.PLANT_CODE;
$login_query.=  WHERE l.USER='$user' AND l.PASSWORD='$pwd';

$class_login = mysql_db_query($dbname,$login_query,$id_link) or die(Please
contact HR to be added to supervisors list.);

while ($login_arr = mysql_fetch_array($class_login)):
 $level = $login_arr['LEVEL'];
 $Name = $login_arr['Name'];
 $Location = $login_arr['PLANT'];
 $Super = $login_arr['Super_Index'];
 $Items_Table = Stores.items_.$login_arr['itemtable'];
endwhile;
if (isset($level)){
session_start();
session_register(level);
session_register(Name);
session_register(Super);
session_register(Location);
session_register(Items_Table);
$page = main.php?option=vieworders;
header(Location: $page);
}
 else
  echo div align=centerh3font color=redLogin bNOT/b Successful,
Please try again./font/h3/div;
endif;
?
link rel=stylesheet href=nice.css type=text/css
html
body bgcolor=#F5F5F5 OnLoad=document.login.user.focus();
divnbsp;/div
p
p
divnbsp;/div
p
div align=centerh3Enter user/pwd to enter Stores Administration
Panel./h3/div
FORM METHOD=post name=login ACTION=?
echoindex.php?option=vieworders?
table border=0 width=75% align=center
tr
td align=center bgcolor=#FFimg src=../../imgs/LOGO3_18.bmp
height=250 width=500/td
/tr
tr
td bgcolor=#CC align=centernbsp;nbsp;font
color=#00biUser Name: /i/b/fontinput type=text
name=user class=TextBox_b
nbsp;nbsp;font color=#00biPassword: /i/b/fontinput
type=password name=pwd class=TextBox_bnbsp;nbsp;input
type=submit name=submitbutton value=Login class=Button_F/td
/tr
/table
/body
/html

-Original Message-
From: YC Nyon [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] RE: A straightforward user login coding


I been searching for a user authentication codes all night but got no where
with the results.
Therefore, if someone can tell me where to find
1. a user authentication using Mysql
2. don't use cookies.
3. also a logout script.

my os is windows.

TIA
Nyon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php