Hello,
 I have a login page .. the user types in user and pass ....
then the form gets posted to tiny_edit.php 

tiny_edit.php checks user and pass then sets a cookie if auth is
successful. Then the original login page is included. The login page has
logic at the top to check for the auth cookie ... if there, it sends
user to home page ... if not it displays the login screen. This works
mostly except ... when the user auths ... the cookie gets set ... then
the login page is included ... the login page does not see the auth
cookie until the user refreshes their browser ... why is this happening?

thanks,
jd


login page ....

<?php
$bt = new AuthTool();
if($username = $bt->checkAuth()){
        //send to homepage
        print "you are already logged on $username";
}
?>

<html>
<head>
<title>
Tiny Edit Login
</title>
<link rel="stylesheet" type="text/css" href="inc/tiny_edit.css" />
</head>
<body>
<form action="<?php  echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="240" cellspacing="0" border="0">
        <tr>
                <td width="100%" class="white" align="center">
                        <b>Tiny Edit Login</b>
                </td>
        </tr>
</table>
<table width="240" cellspacing="0" border="0">
        <tr>
                <td class="grey" width="120" align="center">User:</td><td class="grey"
width="100"><input type="text" name="user"></td>
        </tr>
        <tr>
                <td class="grey" width="120" align="center">Pass:</td><td class="grey"
width="100"><input type="password" name="pass"></td>
        </tr>
</table>
<table width="240" cellspacing="0" border="0">
        <tr>
                <td width="100%" class="white" align="right">
                        <input type="submit" value="Login" class="submitstyle">
                </td>
        </tr>
</table>
<form>
</body>
</html>



tiny_edit.php
if(!$_GET['instance'] && !$_POST['instance']){
        $at = new AuthTool();
        if($_POST['user'] && $_POST['pass']){
                $at->auth($_POST['user'],$_POST['pass']); //this sets cookie if user
and pass are correct
        }
        include "inc/tiny_edit_login.inc.php"; 
}



thanks,
jd

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

Reply via email to