28.01.2012, 16:21
I now got this:
I found out that the thingy $myusername doesnt get the value from the login form so it doesnt query it with the right name...
Anyone have an idea why?
PHP код:
<?
session_start();
if(!session_is_registered(Name)){
header("location:Accounts.php");
}
?>
<html>
<body>
<?php
$host="Censored"; // Host name
$username="Censored"; // Mysql username
$password="Censored"; // Mysql password
$db_name="Censored"; // Database name
$tbl_name="Censored"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql= sprintf("SELECT Name, Password FROM $tbl_name WHERE Name ='$myusername'");
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
{
echo $row['Name'];
echo $row['Password'];
}
?>
</body>
</html>
Anyone have an idea why?