can't get admin login to work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
justinb
Forum Newbie
Posts: 11
Joined: Fri Dec 06, 2002 12:11 am

can't get admin login to work

Post by justinb »

Hello,
I am trying to create a login page for my admin site, which starts a session, If the admin name and pass are in db (logged in), they get a main menu buttun and a session is started. If not in db they get a try again link. Whats happeneing is that the page is coming up blank, no errors, just blank.

The do_html_url() function is a function in outputFns.php which diplays the links. This is my code , can someone help please.

<html><head></head><body>
<?
include_once("outputFns.php");
?>
<?
function login($username, $password)

{ // begin login function
// this function checks the username and password with the db table for admin users
// connect to db
// check if username is unique
$db_name = "xxxxxxxxxxx";

$table = "admin";

//1

$connection = @mysql_connect("xxxxxxx", "xxxxxxx", "xxxxx") or die("Problems connecting - Try again");

//2

$result = mysql_query("SELECT adminID, adminName, adminPass FROM '$table' WHERE adminName='$username' AND adminPass ='$password'");

if(!$result)

do_html_url("login.php", " Wrong Login Infromation try agin");


if(mysql_num_rows($result) > 0)

do_html_url("MenuView.php", " Welcome to the Adminsitration Site");
session_register('valid');
$valid = "yes";

else

do_html_url("login.php", " Wrong Login Infromation try aagin");


} // end login() function
?>
</body></html>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

but there are errors (at least one ;) )
PHP Parse error: parse error, unexpected T_ELSE in test.php on line 35
justinb
Forum Newbie
Posts: 11
Joined: Fri Dec 06, 2002 12:11 am

Post by justinb »

hello,
I tried removing that else statement, but it made no difference, this is really wierd, how do I make it so I can see my errors ?, its enabled in IE, I'm getting java errors all over the place.
Post Reply