Re: [PHP-DB] Re: cookie trouble

2002-11-01 Thread Seabird
Now, I have set the cookie,

but when I run this code I always get the bye output.

Why??

 ?php
 if (isset($user))
 print 'hello';
 else
 print 'bye';
 ?


--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Aaron Wolski [EMAIL PROTECTED] wrote in message
news:000201c2811e$a787ebe0$0701a8c0;aaron...
 You cannot reverse the encryption of an md5 hash. Nor should you want
 to.

 You don't want to know their password which is why you encrypt it.

 When you seyup an account you convert the password to an md5 has(I
 assume you have done so). When they log back in.. You convert the
 password to an md5 hash and compare that value against the stored md5
 password. If a match - log the user in. If not - kick an error page.

 Aaron

  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: Thursday, October 31, 2002 9:49 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Re: cookie trouble
 
 
  I got this fixed,
 
  but how do I reverse a md5 encryption? this way I can log
  people in again.
 
  Jacco
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
  Seabird [EMAIL PROTECTED] wrote in message
  news:20021031165410.94762.qmail;pb1.pair.com...
   Hi everyone,
  
   I'm having some trouble configuring a cookie (first time
  doing this):
   I have a login-script and this sets a session cookie. What I really
   want
  is
   to pass a cookie so that returning-people don't have to log
  in every
   time, but I'm not sure how to do what part is passing on
  the cookie (I
   think $_HTTP_SESSION_VARS=['PHP_SELF'] )
  
   How can I change this to a cookie that stores username and password
   for a time set by me (infinite).
  
   Here is my loginscript:
  
   ?php
   if(isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they were supposed to and
  authenticate
   */  if(!$_POST['uname'] | !$_POST['passwd']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeplease fill in the required
   fields./span/div
 /form
   ';
}
// authenticate.
if(!get_magic_quotes_gpc()) {
 $_POST['uname'] = addslashes($_POST['uname']);
}
$check = $db_object-query(SELECT username, password FROM users
   WHERE username = '.$_POST['uname'].');
if(DB::isError($check)) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeusername doesn\'t exist./span a
   class=header
  
  href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
   gn
  up
   here/a/div
 /form
   ';
}
$info = $check-fetchRow();
// check passwords match
$_POST['passwd'] = stripslashes($_POST['passwd']);
  $info['password']
   = stripslashes($info['password']);  $_POST['passwd'] =
   md5($_POST['passwd']);  if($_POST['passwd'] != $info['password']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8 maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomewrong password, try
  again/span/div
 /form
   ';
}
  
// if we get here username and password are correct,
  register session
   variables and set  // last login time.
$date = date('m d, Y');
$update_login = $db_object-query(UPDATE users SET
  last_login = '$date'
   WHERE username = '.$_POST['uname'].');
$_POST['uname'] = stripslashes($_POST['uname']);
$_SESSION['username'] = $_POST['uname'];
$_SESSION['password'] = $_POST['passwd'];
$db_object-disconnect();
   ?
   span class=welcomeWelcome a class=header
  
  href=javascript:loadPage('mainlayer',null,'users/edit.php?use
  r=?=$_SESSION
   ['username']??PHP print PHPSESSID=.session_id(); ?')font
   color=white?=$_SESSION['username']?/font/abra
   class=header href=login/logout.phpLogout/a
   /span
   ?php
   }
   else { // if form hasn't been submitted
   ?
   form action=?=$HTTP_SESSION_VARS['PHP_SELF']? method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login br
 a class=header
  
  href=javascript:loadPage

RE: [PHP-DB] Re: cookie trouble

2002-11-01 Thread Walter, Marcel
Try something like 
$_COOKIE_VARS[user] ... or $COOKIE_VARS[user] ... dunno exactly ... 

-Original Message-
From: Seabird [mailto:jacco;vliegt.nl]
Sent: 01 November 2002 10:04
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: cookie trouble


Now, I have set the cookie,

but when I run this code I always get the bye output.

Why??

 ?php
 if (isset($user))
 print 'hello';
 else
 print 'bye';
 ?


--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Aaron Wolski [EMAIL PROTECTED] wrote in message
news:000201c2811e$a787ebe0$0701a8c0;aaron...
 You cannot reverse the encryption of an md5 hash. Nor should you want
 to.

 You don't want to know their password which is why you encrypt it.

 When you seyup an account you convert the password to an md5 has(I
 assume you have done so). When they log back in.. You convert the
 password to an md5 hash and compare that value against the stored md5
 password. If a match - log the user in. If not - kick an error page.

 Aaron

  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: Thursday, October 31, 2002 9:49 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Re: cookie trouble
 
 
  I got this fixed,
 
  but how do I reverse a md5 encryption? this way I can log
  people in again.
 
  Jacco
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
  Seabird [EMAIL PROTECTED] wrote in message
  news:20021031165410.94762.qmail;pb1.pair.com...
   Hi everyone,
  
   I'm having some trouble configuring a cookie (first time
  doing this):
   I have a login-script and this sets a session cookie. What I really
   want
  is
   to pass a cookie so that returning-people don't have to log
  in every
   time, but I'm not sure how to do what part is passing on
  the cookie (I
   think $_HTTP_SESSION_VARS=['PHP_SELF'] )
  
   How can I change this to a cookie that stores username and password
   for a time set by me (infinite).
  
   Here is my loginscript:
  
   ?php
   if(isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they were supposed to and
  authenticate
   */  if(!$_POST['uname'] | !$_POST['passwd']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeplease fill in the required
   fields./span/div
 /form
   ';
}
// authenticate.
if(!get_magic_quotes_gpc()) {
 $_POST['uname'] = addslashes($_POST['uname']);
}
$check = $db_object-query(SELECT username, password FROM users
   WHERE username = '.$_POST['uname'].');
if(DB::isError($check)) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeusername doesn\'t exist./span a
   class=header
  
  href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
   gn
  up
   here/a/div
 /form
   ';
}
$info = $check-fetchRow();
// check passwords match
$_POST['passwd'] = stripslashes($_POST['passwd']);
  $info['password']
   = stripslashes($info['password']);  $_POST['passwd'] =
   md5($_POST['passwd']);  if($_POST['passwd'] != $info['password']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8 maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomewrong password, try
  again/span/div
 /form
   ';
}
  
// if we get here username and password are correct,
  register session
   variables and set  // last login time.
$date = date('m d, Y');
$update_login = $db_object-query(UPDATE users SET
  last_login = '$date'
   WHERE username = '.$_POST['uname'].');
$_POST['uname'] = stripslashes($_POST['uname']);
$_SESSION['username'] = $_POST['uname'];
$_SESSION['password'] = $_POST['passwd'];
$db_object-disconnect();
   ?
   span class=welcomeWelcome a class=header
  
  href=javascript:loadPage('mainlayer',null,'users/edit.php?use
  r=?=$_SESSION
   ['username']??PHP print PHPSESSID=.session_id(); ?')font
   color=white?=$_SESSION['username']?/font/abra
   class=header href=login/logout.phpLogout/a
   /span
   ?php
   }
   else { // if form hasn't been submitted
   ?
   form action=?=$HTTP_SESSION_VARS['PHP_SELF']? method=post
   div align=left
 input

Re: [PHP-DB] Re: cookie trouble

2002-11-01 Thread Seabird
Oops,

lights were on, but nobody home sorry, register_globals was set to off.
Works again.

Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Seabird [EMAIL PROTECTED] wrote in message
news:20021101151508.26292.qmail;pb1.pair.com...
 still a bye output.
 Jacco
 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching
 Marcel Walter [EMAIL PROTECTED] wrote in message

news:5A1D56DECE4EF242B1CE7A18FB1F87F50111A93F;ibfftce105.is.de.dresdnerkb.co
 m...
  Try something like
  $_COOKIE_VARS[user] ... or $COOKIE_VARS[user] ... dunno exactly ...
 
  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: 01 November 2002 10:04
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Re: cookie trouble
 
 
  Now, I have set the cookie,
 
  but when I run this code I always get the bye output.
 
  Why??
 
   ?php
   if (isset($user))
   print 'hello';
   else
   print 'bye';
   ?
 
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
  Aaron Wolski [EMAIL PROTECTED] wrote in message
  news:000201c2811e$a787ebe0$0701a8c0;aaron...
   You cannot reverse the encryption of an md5 hash. Nor should you want
   to.
  
   You don't want to know their password which is why you encrypt it.
  
   When you seyup an account you convert the password to an md5 has(I
   assume you have done so). When they log back in.. You convert the
   password to an md5 hash and compare that value against the stored md5
   password. If a match - log the user in. If not - kick an error page.
  
   Aaron
  
-Original Message-
From: Seabird [mailto:jacco;vliegt.nl]
Sent: Thursday, October 31, 2002 9:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: cookie trouble
   
   
I got this fixed,
   
but how do I reverse a md5 encryption? this way I can log
people in again.
   
Jacco
   
--
http://seabird.jmtech.ca
   
Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Seabird [EMAIL PROTECTED] wrote in message
news:20021031165410.94762.qmail;pb1.pair.com...
 Hi everyone,

 I'm having some trouble configuring a cookie (first time
doing this):
 I have a login-script and this sets a session cookie. What I
really
 want
is
 to pass a cookie so that returning-people don't have to log
in every
 time, but I'm not sure how to do what part is passing on
the cookie (I
 think $_HTTP_SESSION_VARS=['PHP_SELF'] )

 How can I change this to a cookie that stores username and
password
 for a time set by me (infinite).

 Here is my loginscript:

 ?php
 if(isset($_POST['submit'])) { // if form has been submitted
  /* check they filled in what they were supposed to and
authenticate
 */  if(!$_POST['uname'] | !$_POST['passwd']) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8
maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeplease fill in the required
 fields./span/div
   /form
 ';
  }
  // authenticate.
  if(!get_magic_quotes_gpc()) {
   $_POST['uname'] = addslashes($_POST['uname']);
  }
  $check = $db_object-query(SELECT username, password FROM users
 WHERE username = '.$_POST['uname'].');
  if(DB::isError($check)) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8
maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeusername doesn\'t exist./span a
 class=header

   
href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
 gn
up
 here/a/div
   /form
 ';
  }
  $info = $check-fetchRow();
  // check passwords match
  $_POST['passwd'] = stripslashes($_POST['passwd']);
$info['password']
 = stripslashes($info['password']);  $_POST['passwd'] =
 md5($_POST['passwd']);  if($_POST['passwd'] != $info['password'])
{
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8
maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomewrong password, try
again/span/div
   /form

[PHP-DB] Re: cookie trouble

2002-10-31 Thread Seabird
I got this fixed,

but how do I reverse a md5 encryption? this way I can log people in
again.

Jacco

--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Seabird [EMAIL PROTECTED] wrote in message
news:20021031165410.94762.qmail;pb1.pair.com...
 Hi everyone,

 I'm having some trouble configuring a cookie (first time doing this):
 I have a login-script and this sets a session cookie. What I really want
is
 to pass a cookie so that returning-people don't have to log in every time,
 but I'm not sure how to do what part is passing on the cookie (I think
 $_HTTP_SESSION_VARS=['PHP_SELF'] )

 How can I change this to a cookie that stores username and password for a
 time set by me (infinite).

 Here is my loginscript:

 ?php
 if(isset($_POST['submit'])) { // if form has been submitted
  /* check they filled in what they were supposed to and authenticate */
  if(!$_POST['uname'] | !$_POST['passwd']) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeplease fill in the required
 fields./span/div
   /form
 ';
  }
  // authenticate.
  if(!get_magic_quotes_gpc()) {
   $_POST['uname'] = addslashes($_POST['uname']);
  }
  $check = $db_object-query(SELECT username, password FROM users WHERE
 username = '.$_POST['uname'].');
  if(DB::isError($check)) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeusername doesn\'t exist./span a
 class=header
 href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')sign
up
 here/a/div
   /form
 ';
  }
  $info = $check-fetchRow();
  // check passwords match
  $_POST['passwd'] = stripslashes($_POST['passwd']);
  $info['password'] = stripslashes($info['password']);
  $_POST['passwd'] = md5($_POST['passwd']);
  if($_POST['passwd'] != $info['password']) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomewrong password, try again/span/div
   /form
 ';
  }

  // if we get here username and password are correct, register session
 variables and set
  // last login time.
  $date = date('m d, Y');
  $update_login = $db_object-query(UPDATE users SET last_login = '$date'
 WHERE username = '.$_POST['uname'].');
  $_POST['uname'] = stripslashes($_POST['uname']);
  $_SESSION['username'] = $_POST['uname'];
  $_SESSION['password'] = $_POST['passwd'];
  $db_object-disconnect();
 ?
 span class=welcomeWelcome a class=header

href=javascript:loadPage('mainlayer',null,'users/edit.php?user=?=$_SESSION
 ['username']??PHP print PHPSESSID=.session_id(); ?')font
 color=white?=$_SESSION['username']?/font/abra class=header
 href=login/logout.phpLogout/a
 /span
 ?php
 }
 else { // if form hasn't been submitted
 ?
 form action=?=$HTTP_SESSION_VARS['PHP_SELF']? method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
 br
   a class=header
 href=javascript:loadPage('mainlayer',null,'login/signup.php')sign up
 here/a /div
   /form
 ?php
 }
 ?

 Thanx,
 Jacco

 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching





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




RE: [PHP-DB] Re: cookie trouble

2002-10-31 Thread Aaron Wolski
You cannot reverse the encryption of an md5 hash. Nor should you want
to.

You don't want to know their password which is why you encrypt it.

When you seyup an account you convert the password to an md5 has(I
assume you have done so). When they log back in.. You convert the
password to an md5 hash and compare that value against the stored md5
password. If a match - log the user in. If not - kick an error page.

Aaron

 -Original Message-
 From: Seabird [mailto:jacco;vliegt.nl] 
 Sent: Thursday, October 31, 2002 9:49 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: cookie trouble
 
 
 I got this fixed,
 
 but how do I reverse a md5 encryption? this way I can log 
 people in again.
 
 Jacco
 
 --
 http://seabird.jmtech.ca
 
 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching
 Seabird [EMAIL PROTECTED] wrote in message 
 news:20021031165410.94762.qmail;pb1.pair.com...
  Hi everyone,
 
  I'm having some trouble configuring a cookie (first time 
 doing this): 
  I have a login-script and this sets a session cookie. What I really 
  want
 is
  to pass a cookie so that returning-people don't have to log 
 in every 
  time, but I'm not sure how to do what part is passing on 
 the cookie (I 
  think $_HTTP_SESSION_VARS=['PHP_SELF'] )
 
  How can I change this to a cookie that stores username and password 
  for a time set by me (infinite).
 
  Here is my loginscript:
 
  ?php
  if(isset($_POST['submit'])) { // if form has been submitted
   /* check they filled in what they were supposed to and 
 authenticate 
  */  if(!$_POST['uname'] | !$_POST['passwd']) {
print 'form action=index.php method=post
  div align=left
input class=test name=uname type=text size=8 
  maxlength=8
input class=test type=password size=8 
 maxlength=8 
  name=passwd
input name=submit type=submit value=Login
br
span class=welcomeplease fill in the required 
  fields./span/div
/form
  ';
   }
   // authenticate.
   if(!get_magic_quotes_gpc()) {
$_POST['uname'] = addslashes($_POST['uname']);
   }
   $check = $db_object-query(SELECT username, password FROM users 
  WHERE username = '.$_POST['uname'].');
   if(DB::isError($check)) {
print 'form action=index.php method=post
  div align=left
input class=test name=uname type=text size=8 
  maxlength=8
input class=test type=password size=8 
 maxlength=8 
  name=passwd
input name=submit type=submit value=Login
br
span class=welcomeusername doesn\'t exist./span a 
  class=header 
  
 href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
  gn
 up
  here/a/div
/form
  ';
   }
   $info = $check-fetchRow();
   // check passwords match
   $_POST['passwd'] = stripslashes($_POST['passwd']);  
 $info['password'] 
  = stripslashes($info['password']);  $_POST['passwd'] = 
  md5($_POST['passwd']);  if($_POST['passwd'] != $info['password']) {
print 'form action=index.php method=post
  div align=left
input class=test name=uname type=text size=8
  maxlength=8
input class=test type=password size=8 maxlength=8
  name=passwd
input name=submit type=submit value=Login
br
span class=welcomewrong password, try 
 again/span/div
/form
  ';
   }
 
   // if we get here username and password are correct, 
 register session 
  variables and set  // last login time.
   $date = date('m d, Y');
   $update_login = $db_object-query(UPDATE users SET 
 last_login = '$date'
  WHERE username = '.$_POST['uname'].');
   $_POST['uname'] = stripslashes($_POST['uname']);
   $_SESSION['username'] = $_POST['uname'];
   $_SESSION['password'] = $_POST['passwd'];
   $db_object-disconnect();
  ?
  span class=welcomeWelcome a class=header
 
 href=javascript:loadPage('mainlayer',null,'users/edit.php?use
 r=?=$_SESSION
  ['username']??PHP print PHPSESSID=.session_id(); ?')font 
  color=white?=$_SESSION['username']?/font/abra 
  class=header href=login/logout.phpLogout/a
  /span
  ?php
  }
  else { // if form hasn't been submitted
  ?
  form action=?=$HTTP_SESSION_VARS['PHP_SELF']? method=post
  div align=left
input class=test name=uname type=text size=8 
  maxlength=8
input class=test type=password size=8 
 maxlength=8 
  name=passwd
input name=submit type=submit value=Login br
a class=header
  
 href=javascript:loadPage('mainlayer',null,'login/signup.php')
 sign up
  here/a /div
/form
  ?php
  }
  ?
 
  Thanx,
  Jacco
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
 
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP-DB] Re: cookie trouble

2002-10-31 Thread Mark Nenadov
On October 31, 2002 02:48 pm, Seabird wrote:
 I got this fixed,

 but how do I reverse a md5 encryption? this way I can log people in
 again.

 Jacco

You can't reverse md5. All you need to do is compare an md5'ed copy of what 
the user entered to what you have in your database (or wherever you store the 
encrypted copy). If they are the same, then they have entered the right 
password.
-- 
Mark Nenadov,
Freelance Software Developer
web: http://www.freelance-developer.com
e-mail: [EMAIL PROTECTED]

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