Page 1 of 1

Basic login (if $pass == "hello") failing.

Posted: Sun Oct 01, 2006 7:09 am
by m0u53m4t
Whats wrong?

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/gelid/domains/gelidscripts.frih.net/public_html/rs/login.php on line 4

Code: Select all

<?php
$username = $_POST['usr'];
$password = $_POST['pass'];
if $username == "Taner131" && $password == "kaitneks"
{
die('Correct, you logged in.');
}
?>

Posted: Sun Oct 01, 2006 7:11 am
by volka

Code: Select all

if ($username == "Taner131" && $password == "kaitneks")

Why do you create new global variables? why not simply use $_POST['usr'] and $_POST['pass']?

Posted: Sun Oct 01, 2006 8:03 am
by timvw
http://www.php.net/if

if (expr)
statement

notice that you need to place your expression between round braces...

i use this to log into admin area for guestbook

Posted: Sun Oct 01, 2006 10:01 am
by akimm

Code: Select all

<?php
if($_POST['name'] == "###your name###" && $_POST['pass'] == "###your pass###") {
#this is a nice way to send to the end result of proper log ins
header("Refresh: 1; url=admin.php");
} else {
#if info was not correct, then go back to log in script here
	require(login.php);
}
?>