Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Login Adminsitration struggles

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Login Adminsitration struggles

Postby justin » Thu Dec 05, 2002 5:14 pm

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.

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";


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


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


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");
$valid = "yes";


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

} // end login() function
New php-forum User
New php-forum User
Posts: 11
Joined: Sun Oct 13, 2002 8:30 pm
Location: toronto

An Idea?

Postby meannate » Mon Jan 06, 2003 5:36 pm

Try this on for size:

Code: Select all
$connection = @mysql_connect("hostname", "admin", "pass") or die("Couldn't Connect to Database");
$db = @mysql_select_db("admin", $connection) or die("Couldn't Select Database");

if (!$username || !$password) {
   header("Location: login.php?msg=Please Enter Both Required Fields");
} else {
   $sql = "SELECT adminID, adminName, adminPass FROM admin WHERE adminName=\"$username\" AND adminPass = \"$password\"";
   $result = @mysql_query($sql, $connection) or die("Couldn't Query Database");

   if (mysql_num_rows($result)) {
      $valid = "yes";
      header("Location: login.php?msg=Successful Login");
   } else {
      header("Location: login.php?msg=Incorrect Login Password Combo");
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Nov 04, 2002 12:06 pm
Location: West Los Angeles

Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], yetticaretti and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.