Can someone advise me on what went wrong?
Many, many things. That is some hideous code.
Code:
if ($message == "invalid") {
$message is never defined.
Code:
if (!empty($HTTP_GET_VARS)) while(list($name, $value) = each($HTTP_GET_VARS))
$$name = $value;
if (!empty($HTTP_POST_VARS)) while(list($name, $value) = each($HTTP_POST_VARS))
$$name = $value;
$HTTP_GET_VARS and $HTTP_POST_VARS are deprecated in favour of $_GET and $_POST. Variable variables are almost never necessary, since arrays can be associative. This will make the program from here on much harder to debug, but I shall try anyway.
Code:
$userid=$_POST['userid'];s
What's that "s" all about?
Code:
$link = mysql_connect("localhost",$username,$password);
$username and $password are never defined.
Code:
mysql_select_db($db , $link)
$db is never defined.
Code:
if ((userid == '$userid') && (pwd == '$pwd')) {
The constants "userid" and "pwd" are never defined, and the fact that $userid and $pwd are in single quotes will cause them to not be parsed, meaning that you're checking against the literal strings '$userid' and '$pwd', dollar signs and all.
Code:
header ("Location: http://(full url )/formindex.php?userid=$userid");
There, you're allowing any user to switch to another user's profile simply by changing a number in the address bar.
Bookmarks