I have been working on this for a day and a half. I think something is messed up with the headers but i can't figure out what.
The way the script works is the user inputs a username and password. i take that and compare to the database. if they appear on the same row i get that row. if the row is greater than 0 they should be logged in and transfer to another page.
if they fail the log in they are forwarded to the same page. on that page there is a script that should reject anyone who hasn't logged in but it's not working correctly. basically i can't log in at all.
im going to paste the login script then the page that is being linked to and the script that should limit who gets in.
Code:<?php error_reporting(E_ALL); //function pre($array) { echo sprintf("<pre>%s</pre>", print_r($array, true)); } pre($_POST); //declaration of variables //creating connection to serve $con = mysql_connect("localhost","db","pass") or die('Could not connect to server' . mysql_error()); $table = "user_pass"; $db = "whackand_wikieng"; //making user input safe mysql_select_db($db, $con); $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); //$username = $_POST["username"]; //$password = $_POST["password"]; $result = mysql_query("SELECT Number FROM $table WHERE Username = '$username' AND Password = '$password'"); $row = mysql_num_rows($result); //echo $row; //echo $id; if($row > 0) { session_start(); $_SESSION['authenticate'] = 1; header("Location: upload_form-1.php"); } /*else { session_start(); $_SESSION['authenticate'] = ''; header("Location: upload_form-1.php"); }*/ //closing server connection mysql_close($con); ?>


Reply With Quote
Bookmarks