14.06.2015, 19:37
I'm building an UCP, using some old tutorials of the forum, but the PHP show a problem, always show the message: There was no values for username or password posted!, even typing values in both fields, code below:
Код HTML:
<form name="input" action="login.php" method="post"> Username: <input type="text" name="user" /> <br /> Password: <input type="password" name="password" /> <br /> <input type="submit" value="Submit" />
PHP код:
<?php
session_start();
if ((!isset($_POST["user"]) || !isset($_POST["password"])) && !isset($_SESSION["username"]))
{
echo "There was no values for username or password posted!!";
}
else
{
include ("variables.php");
$connection = mysql_connect ($dbservername, $dbusername, $dbpassword);
mysql_select_db($dbname, $connection);
if (!isset($_SESSION["username"]))
{
$username = mysql_escape_string($_POST["user"]);
$password = mysql_escape_string($_POST["password"]);
}
else $username = mysql_escape_string($_SESSION["username"]);
....