It looks like everything is OK, except where you check $userid and $password. 
You are not using _SESSION for those variables so it appears they will never be set.
-- 
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/


Quoting Kit Kerbel <[EMAIL PROTECTED]>:

> I've looked through the other posts just to let you know. Here's the code I
> 
> have, not sure why it's not working:
> 
> page1.php:
> <?
> session_start();
> 
> 
> if (($mode=="logoff"))
> {
>   $_SESSION['userid'] = "";
> }
> 
> 
> if (($error=="badusername"))
> {
>   $_SESSION['errorstring'] = "You have entered an incorrect UserId";
> }
>   else
> if (($error=="badpassword"))
> {
>   $_SESSION['errorstring'] = "You have entered an incorrect password";
> }
> 
> 
> if (($userid!="") && ($password!=""))
> {
> 
> 
>   $query="SELECT * FROM tblUser WHERE dUserID='".$userid."'";
>   $rs = odbc_do($connection, $query);
>   $numrows = odbc_num_rows($rs);
> 
>   while(odbc_fetch_row($rs))
>   {
>   $_SESSION['dUserID'] = odbc_result($rs, "dUserID");
>   $_SESSION['dPassword'] = odbc_result($rs, "dPassword");
>   }
> 
>   if ($numrows == 0)
>   {
>     $_SESSION['error'] = "badusername";
>   }
>   else
>   if ($dPassword!=$Password)
>   {
>     $_SESSION['error'] = "badpassword";
>     $_SESSION['acct'] = $_SESSION['wUserID'];
>     header("Location: login.php");
>   }
>     else
>   {
> 
>     $_SESSION['userid'] = strtoupper($_SESSION['userid']);
>   }
> 
>   header("Location: my_account.php");
> }
>   else
> {
> 
> 
> ?>
> 
> 
> <html>
> <head>
> </head>
> 
> 
> <body>
> <? include("includes/header.php"); ?>
> 
> 
> ***This is the form that sends wUserID and wPassword to login.php
> 
> 
> <form name="form1" method="post" action="login.php">
>                                 <table width="77%" border="0" 
> cellspacing="0" cellpadding="0" align="center">
>                                   <tr>
>                                     <td colspan="2"><img 
> src="images/username.gif" width="71" height="11"><br>
>                                       <input type="text" name="wUserID" 
> size="11">
>                                     </td>
>                                   </tr>
>                                   <tr>
>                                     <td colspan="2" height="3"><img 
> src="images/spacer.gif" width="12" height="5"></td>
>                                   </tr>
>                                   <tr>
>                                     <td colspan="2"><img 
> src="images/password.gif" width="71" height="11"><br>
>                                       <input type="password" 
> name="wPassword" size="11">
>                                     </td>
>                                   </tr>
>                                   <tr>
>                                     <td colspan="2"><img 
> src="images/spacer.gif" width="12" height="5"></td>
>                                   </tr>
>                                   <tr>
>                                     <td colspan="2">
>                                       <input type="image" img 
> src="images/button_signin.gif" width="66" height="12" border="0">
>                                     </td>
>                                   </tr>
>                                   <tr>
>                                     <td colspan="2">&nbsp;</td>
>                                   </tr>
>                                   <tr>
>                                     <td colspan="2">
>                                       <input type="checkbox" name="checkbox"
> 
> value="checkbox">
>                                       Save for next visit</td>
>                                   </tr>
>                                 </table>
>                               </form>
> 
> </body>
> </html>
> <?
> }
> ?>
> 
> page2.php:
> <?
> session_start();
> 
> 
> $_SESSION['wUserID'] = $_REQUEST["wUserID"];
> $_SESSION['wPassword'] = $_REQUEST["wPassword"];
> 
> 
> //echo "User ID is ".$_SESSION["wUserID"];
> //echo "<br>";
> //echo "Password is ".$_SESSION["wPassword"];
> 
> 
> if (($_SESSION['wUserID']!="") && ($_SESSION['wPassword']!=""))
> {
> 
> $query = "SELECT * FROM tblUser WHERE dUserID='".$_SESSION['wUserID']."'";
> $rs = odbc_exec($connection, $query);
> $numrows = odbc_num_rows($rs);
> 
> while(odbc_fetch_row($rs))
>   {
>   $_SESSION['USERID'] = odbc_result($rs, "dUserID");
>   $_SESSION['PASSWORD'] = odbc_result($rs, "dPassword");
>   }
> 
>   if ($numrows==0)
>   {
>     $_SESSION['error'] = "badusername";
>     header("Location: login.php");
>   }
>   else
>   if ($_SESSION['PASSWORD']!=$_SESSION['wPassword'])
>   {
>     $_SESSION['error'] = "badpassword";
>     $_SESSION['acct'] = $_SESSION['wUserID'];
>     header("Location: login.php");
>   }
>     else
>   {
> 
>     $_SESSION['displayid'] = strtoupper($_SESSION['wUserID']);
>   }
> 
> 
>   header("Location: my_account.php");
> 
> }
>   else
> {
>       echo "DIDN'T WORK";
> }
> ?>
> 
> 
> page3.php:(this is the page that can't get values on)
> 
> <?
> session_start();
> 
> echo "value is ".$_SESSION['USERID'];
> 
> 
> ?>
> 
> 
> 
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

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

Reply via email to