Jump to content

Slicker Login (JQuery + PHP)


Zeradin

Recommended Posts

Hello. I've been making login forms like posting to the same document and then checking everything if the post is submitted and then redirecting. I wanted to make it slicker. I started with this:

 

http://www.developertutorials.com/tutorials/ajax/getting-started-with-ajax-in-jquery-8-05-11/page2.html

 

Tutorial and I can't figure out how to transform this into a session. I can verify that it's correct, but then what? I feel like it's a piece of php programming that after I know how to do it a lot of things will make a lot more sense. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/185610-slicker-login-jquery-php/
Share on other sites

Buuut what I don't get is:

<?php
$username = $_POST['username'];
$password = $_POST['password'];

if ($username == "test" && $password == "password")
{
print "<strong>Login succeeded!</strong>";
HERE I can't start a session and I can't store a session variable and for some reason redirect doesn't work?
}
else
{
print "<strong>Login failed! Please try again.</strong>";
}
?>

it works. u must always start the session at the top session_start(); its fine doesnt make anyone logged in

then if its ok they logged in with correctnees $_SESSION[username] = $username;

now to check if they are logged in if($_SESSION[username] != ""){loged in

is what i do

What about the redirect. it just sits on SUCCESSFUL! forever when i insert:

<meta http-equiv="Refresh" content="2;url=index.php?p=update">

<br />

<a href="update.php">click here to continue if you are not redirected</a><br />

to the cause. I need it to go somewhere after it is successful.

Thanks for the help btw.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.