Jump to content

n3xtgensystem

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

n3xtgensystem's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks. I have read the sticky and manual and tried to use: And it will redirect to the correct page the URL does not change. It still says its on the login.php page even though it showing the menu.html page. I have tried other browsers to see if it works but still the same thing.
  2. I have an html login page. Once a user is verified through the PHP page they get redirected to another page. For some reason once I have validated that the user exists I get the message that is was successful but the page will not redirect. This is my script I use on my HTML page to pass the parameters: $(document).ready(function() { $('#submit').click(function() { var username = $('input[name=username]'); var password = $('input[name=password]'); var data = 'username=' + username.val() + '&password=' + password.val(); .ajax({ url: "login.php", type: "GET", data: data, cache: false, success: function() { alert("SUCCESS"); } }); return false; }); }); And this is my PHP page: <?php $username = ($_GET['username']) ? $_GET['username'] : $_POST['username']; $password = ($_GET['password']) ? $_GET['password'] : $_POST['password']; if ($_POST) $post=1; $userFound = false; $memberId = ""; // Create connection string, Note, params are as follow // mysql_connect(databaseLocation, username, password) $con = mysql_connect("localhost","root",""); if (!$con) { die("Could not connect: " . mysql_error()); } mysql_select_db("memberdb", $con); // SQL Query $result = mysql_query("SELECT memberId, firstName, lastName, username, password FROM member"); while($row = mysql_fetch_array($result)) { if ($username == $row["username"] && $password == $row["password"]) { echo "<h1>Welcome " . $row["firstName"] ." ". $row["lastName"] . "! </h1></br>"; $userFound = true; $memberId = $row["memberId"]; } } // If User is found, continue on to next page, if not redirect to index.html if ($userFound) { echo "<h2>Login Successful</h2>"; echo "<h3>Page will redirect</h3>"; header( "url=menu.html?memberId=" . $memberId); } else { echo "<h2>LOGIN FAILED</h2>"; echo "<h3>Page will redirect</h3>"; header( "refresh: 1; url=index.html#loginPage"); } ?> It does the echo successfully but hangs on the part where is says : How can I get it to redirect? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.