>Are you sure the cookie is set on your machine? What
>is your IE setting
>about what cookie should accept? Because this is
>generaly the problem

Okay maybe it's best I post my code here and explain a
bit about it.

--my login code--


error_reporting (E_ALL ^ E_NOTICE);

//Put in your own info for username, password, DB,
[EMAIL PROTECTED], Cookiename,
//the name of this page (currently login.php) and the
name of your subscribe
//or new user page (currently new.php).  I went ahead
and included all the HTML
//so this page should work as is, with only the
changes described above needed
// - Lysander ([EMAIL PROTECTED])

$dblink = mysql_pconnect("localhost","usr","pass");

$headers=0; //Make Sure HTML Headers are in place
before the form

//after Authenticating the script automatically sends
the browser to
//the webpage of your choice (note if your page calls
//script with ?redirect="foobar.php" it will
//redirect to foobar.php after authenticating.  Set
the default
//redirect page here

if ( !isset($redirect))
     $redirect = "tip.php";

if (isset($Username) && isset($Password)) {

  $query = "select * from tipping where nickname =
\"$Username\" and password = \"$Password\"";

  if ( !($dbq = mysql_query($query, $dblink))) {
    echo "Unable to query database.  Please Contact <a
href=\"[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</a>.\n";

  $lim = mysql_num_rows( $dbq );

  if ($lim != 1) {

  $headers=1; //HTML headers in place
  echo "<HTML><HEAD><TITLE>Login
  echo "<B><center><font color=red>Invalid User ID or
Password. Please Try again</B><BR></font></center>";


  if ($lim == 1) {

//make unique session id and store it in Database
  $timer = md5(time());
  $sid = $Username . "+" . $timer;
  SetCookie("login",$sid,time()+3600); //Set Cookie
for 30 days
  $query = "update tipping set sid=\"$timer\" where

  if( !($dbq = mysql_query( $query, $dblink))) {
    echo "Unable to update database.  Please contact
href=\"[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</a>.\n";

  header("Location: $redirect");


if (isset($login)) {
  $sidarray = explode("+", "$login");
  $query = "select * from tipping where nickname =
\"$sidarray[0]\" and sid = \"$sidarray[1]\"";

  if ( !($dbq = mysql_query($query, $dblink))) {
    echo "Unable to find database.  Please Contact <a
href=\"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>.\n";

  if (mysql_num_rows( $dbq ) == 1) {
    echo "<HTML><HEAD><TITLE>Login
    echo "<center>You are already logged in as
    echo "You may logon as another user or simply
begin using our services with your current
    echo "Click <A
to return to our homepage.</center>";
if ($headers == 0) {
echo " ";

echo "<Form Action=\"tiplogin.php\" METHOD=POST>";
echo "<H2>User Name</H2>";
echo "<Input TYPE=\"text\" Name=\"Username\"
echo "<BR>";
echo "<H2>Password</H2>";
echo "<Input TYPE=\"password\" Name=\"Password\">";
echo "<BR>";
echo "<Input Type=\"submit\" Value=\"Submit\">";
echo "<Input Type=\"hidden\" Name=\"redirect\"
echo "</FORM>";



Okay as you can see in the code there are some
//comments.  Will help explain what each function
does, or what it's meant to do.

A quick overview is that you are shown a login form. 
(no cookies loaded onto the users PC as of yet)  The
user must input a username and password which must
match in the database.  If there is a match the user
is given a cookie on their PC with an expiry period
which than loads onto the next page $redirect which
the $redirect page checks to see if the user still
matches in the database and see's if the cookie (id)
or sid matches with the database.  If matches it
allows you to see the page, if not it says your
session has times out and to try again.

It works fine under my linux machine, no problems. 
But as soon as I tried under windows after I installed
all my programs I needed it failed badly.

What it does under windows is show the form and input
my username and password (does not matter if they are
correct or not because the results are the same) and I
click the submit button and all it does is reload the

What it appears to be doing is not even doing the
mysql query.  (form the looks of it)  It seems to loop
through the page again as if your loading it the first
time.  Either that or my form is not submitting the
data at all.

If I don't enter data on my linux server on the login
I get a error message (which is in the code) but if I
do it on windows it does nothing.  Just loads the form

So I am going to try something new later today and
have the form and the logn process on two different
pages and see what happens.  Not sure if this will do
anything different but I will try.  Anyone got any

My other PHP pages under windows work fine, they query
my mysql database(s) fine and output the results as
they should.  This is the only thing I am having
problems with at the pressent time.

All help/suggestions are appreicated.


http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.

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

Reply via email to