[PHP] Log In

Newbie Spellweaver
Joined
Sep 14, 2007
Messages
88
Reaction score
0
ok so register there then log in youll get error
PHP:
Parse error:  parse error, unexpected T_STRING in /home/www/indy.hotelzero.net/login.php on line 22
and the source of the code is
PHP:
//Connect to database

<?php
session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);

$query = “select * from users where username=’$username’ and password=’$password’”;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = “Bad Login”;
    include “login.html”;

} else {
    $_SESSION[‘username’] = “$username”;
    include “memberspage.php”;
}

?>
 
---
Loyal Member
Joined
Aug 18, 2004
Messages
641
Reaction score
3
Re: [Help] Php Log In

I'm getting error at account registration page.
 
Experienced Elementalist
Joined
Apr 15, 2008
Messages
256
Reaction score
0
PHP:
#
is a note charactor and so is:
//
/*
#
so basically your query's are all notes
 
Joined
Jun 8, 2007
Messages
1,962
Reaction score
475
Something is weird with either your keyboard settings, your text editor, or something. Your outputted quotes and apostrophes are not the standards for PHP.. In other words.. use this code instead:
PHP:
//Connect to database

<?php
session_start();
$username = $_POST['username'];
$password = md5($_POST['password']);

$query = "select * from users where username='$username' and password='$password'";

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = "Bad Login";
    include "login.html";

} else {
    $_SESSION['username'] = "$username";
    include "memberspage.php";
}

?>
You'll notice I turned all of the peculiar quotes and apostrophes to match the standards. Try to use this practice or count your programming life short.
 
Newbie Spellweaver
Joined
Sep 14, 2007
Messages
88
Reaction score
0
Something is weird with either your keyboard settings, your text editor, or something. Your outputted quotes and apostrophes are not the standards for PHP.. In other words.. use this code instead:
PHP:
//Connect to database
 
<?php
session_start();
$username = $_POST['username'];
$password = md5($_POST['password']);
 
$query = "select * from users where username='$username' and password='$password'";
 
$result = mysql_query($query);
 
if (mysql_num_rows($result) != 1) {
$error = "Bad Login";
    include "login.html";
 
} else {
    $_SESSION['username'] = "$username";
    include "memberspage.php";
}
 
?>
You'll notice I turned all of the peculiar quotes and apostrophes to match the standards. Try to use this practice or count your programming life short.
that that helped.
 
Back
Top