php - trouble with code
Posted: Mon Mar 15, 2004 2:59 pm
I know it's bad to post code but i've really tried to figure out what's wrong with it..... i'll leave it to the experts...
ok this piece of code is the validation procedure which checks the login information, and i can't get it to work. I have created the database and table specified in the code and my server is working good. im using apache 2 with some php version dunno, the latest i think. When i enter my login information on my other login php file(which is working) and gets transferred to this validation page the browser is blanc and does not show any life signs at all. wots wrong?
so here's the code:
<?php require('\www\webroot\yuppolotion\_inc\top.inc'); ?>
<?php //skapar användarsession för inloggad användare.....
session_start();
session_register("ppuser");
session_register("pppass");
@$ppuser = $_POST["username"];
@$pppass = $_POST["password"];
?>
<?php
if ($_POST["nummer"] = 1)
{
$username = $_POST["username"];
$d = mysql_connect("localhost", "root", "ussr");
$sql = mysql_db_query("ppusers","SELECT * FROM users WHERE username = '$username'", $d);
$rad = mysql_fetch_array($sql);
}
else
{
$haha = "tyvärr";
echo ("$haha");
}
if($_POST["username"] == $rad["username"] & $_POST["password"] == $rad["password"])
{
$username = $_POST["username"];
$antalbesok = $rad["antalbesok"] + 1;
$senast = date("y-m-d");
$oppna = mysql_connect("localhost", "root", "ussr");
$sqlq = mysql_db_query("ppusers", "UPDATE users SET senast = '$senast', antalbesok = '$antalbesok' WHERE username = '$username'", $open);
mysql_close($oppna);
echo("<p>du är inloggad. Du förflyttas till startsidan.</p>");
echo("<script language=javascript>");
echo("self.location.replace('http://localhost/inloggad.php')");
echo("</script>");
}
else
{ ?>
<?php
echo("<p>Inloggningsförsöket misslyckades. Kontrolera användarnamn och lösenord och försök på nytt. </p><a href='http://localhost/start sida.php'>återgå</a>");
}
mysql_close($d);
}
?>
<?php require('\www\webroot\yuppolotion\_inc\bottom.inc'); ?>
ok this piece of code is the validation procedure which checks the login information, and i can't get it to work. I have created the database and table specified in the code and my server is working good. im using apache 2 with some php version dunno, the latest i think. When i enter my login information on my other login php file(which is working) and gets transferred to this validation page the browser is blanc and does not show any life signs at all. wots wrong?
so here's the code:
<?php require('\www\webroot\yuppolotion\_inc\top.inc'); ?>
<?php //skapar användarsession för inloggad användare.....
session_start();
session_register("ppuser");
session_register("pppass");
@$ppuser = $_POST["username"];
@$pppass = $_POST["password"];
?>
<?php
if ($_POST["nummer"] = 1)
{
$username = $_POST["username"];
$d = mysql_connect("localhost", "root", "ussr");
$sql = mysql_db_query("ppusers","SELECT * FROM users WHERE username = '$username'", $d);
$rad = mysql_fetch_array($sql);
}
else
{
$haha = "tyvärr";
echo ("$haha");
}
if($_POST["username"] == $rad["username"] & $_POST["password"] == $rad["password"])
{
$username = $_POST["username"];
$antalbesok = $rad["antalbesok"] + 1;
$senast = date("y-m-d");
$oppna = mysql_connect("localhost", "root", "ussr");
$sqlq = mysql_db_query("ppusers", "UPDATE users SET senast = '$senast', antalbesok = '$antalbesok' WHERE username = '$username'", $open);
mysql_close($oppna);
echo("<p>du är inloggad. Du förflyttas till startsidan.</p>");
echo("<script language=javascript>");
echo("self.location.replace('http://localhost/inloggad.php')");
echo("</script>");
}
else
{ ?>
<?php
echo("<p>Inloggningsförsöket misslyckades. Kontrolera användarnamn och lösenord och försök på nytt. </p><a href='http://localhost/start sida.php'>återgå</a>");
}
mysql_close($d);
}
?>
<?php require('\www\webroot\yuppolotion\_inc\bottom.inc'); ?>