chris_rulez001 Posted July 25, 2007 Share Posted July 25, 2007 hi im making a forum hosting service and i am having trouble with logging in. its not actually logging me in, its just showing a blank screen. what i would like to have the code do is to select the current forum name and then select the users and then login. but its not doing it and i would like to know how i would be able to do this? heres my code: <?php session_start(); $username = $_POST['username']; $password = $_POST['password']; $host="fdb1.awardspace.com"; // Host name $username="*"; // Mysql username $password="****************"; // Mysql password $db_name="********"; // Database name $tbl_name1="*****"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql_user_check = "SELECT * FROM **users WHERE username='$username'"; $result_name_check = mysql_query($sql_user_check) OR DIE(mysql_error()); $usersfound = mysql_num_rows($result_name_check); if ($usersfound < 1) { $error = "Username $username not found."; } else { $sql_pass_get = "SELECT * FROM ***users WHERE username='$username'"; $user_info = mysql_fetch_array(mysql_query($sql_pass_get)); $pass = $user_info['password']; if ($pass != $password) { $error = "Invalid password. Try again."; } else { $_SESSION['userid'] = $user_info['id']; $_SESSION['forumname'] = $user_info['forumname']; $_SESSION['username'] = $user_info['username']; $_SESSION['password'] = $user_info['password']; $_SESSION['email'] = $user_info['email']; $_SESSION['question'] = $user_info['question']; $_SESSION['answer'] = $user_info['answer']; $_SESSION['age'] = $user_info['age']; $_SESSION['gender'] = $user_info['gender']; $_SESSION['ip'] = $user_info['ip']; } if (!isset($_SESSION['username'])) { if ($error) { echo $error; include("login.php"); } else { include("index.php"); } } else { echo "<html> <head> <title>Logged In Successfully</title> <SCRIPT LANGUAGE='JavaScript'> <!-- Begin redirTime = '5000'; redirURL = 'http://*********.awardspace.co.uk/support/index.php'; function redirTimer() { self.setTimeout('self.location.href = redirURL;',redirTime); } // End --> </script> </head> <body onLoad='redirTimer()'> You are logged in successfully, please wait to be redirected to the homepage. </body> </html>"; } } ?> heres my database structure: id tinyint(255) No auto_increment forumname varchar(255) latin1_swedish_ci No display varchar(255) latin1_swedish_ci No username varchar(255) latin1_swedish_ci No password varchar(255) latin1_swedish_ci No email varchar(255) latin1_swedish_ci No age varchar(255) latin1_swedish_ci No gender varchar(255) latin1_swedish_ci No question varchar(255) latin1_swedish_ci No answer varchar(255) latin1_swedish_ci No ip varchar(255) latin1_swedish_ci No is my request misleading? if yes i can try and explain it better for you. Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 25, 2007 Author Share Posted July 25, 2007 can someone help me please? Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 25, 2007 Author Share Posted July 25, 2007 please, i need some help please, i cant continue with my forum hosting service without this, can someone help? Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 26, 2007 Author Share Posted July 26, 2007 please, i need some help please, i cant continue with my forum hosting service without this, can someone help? Quote Link to comment Share on other sites More sharing options...
chris_rulez001 Posted July 26, 2007 Author Share Posted July 26, 2007 please, i need some help please, i cant continue with my forum hosting service without this, can someone help? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.