Jump to content

session woes


Zeradin

Recommended Posts

I have this code:

if ($password == $login_info['password'])
{
	echo "<strong>Login succeeded!</strong>";
	$_SESSION['username'] = $_POST['username'];
	$_SESSION['password'] = $_POST['password'];
	?><script type="text/javascript">
			setTimeout('window.location="index.php?p=update"', 1500)
		</script><?php
		echo '<br />
		<a href="update.php">click here to continue if you are not redirected</a><br />
		<br /><img src="images/loading.gif" alt="loading..." />';
		echo $_SESSION['username'];
}

that verifies login information and then sends it to the update page. the session is still started on the update page and the username session variable works on this page, but is lost on the update page.

 

I don't know why I'm having so much trouble today. Probably something obvious. Please advise.

Link to comment
https://forums.phpfreaks.com/topic/185626-session-woes/
Share on other sites

details:

 

i have a login page that is just a form and a javascript

$(document).ready(function() {
			$("#login_form").submit(function() {
				var unameval = $("#username").val();
				var pwordval = $("#password").val();
				$.post("check_login.php", { username: unameval, password: pwordval }, 
				function(data) {
					$("#status p").html(data);
				});
				return false;
			});
		});

which loads login_check.js that makes the variables. maybe there's someway they aren't actually being read to the session because the javascript is adding it to another page? and also the post variable is in the login_check, not the login?

Link to comment
https://forums.phpfreaks.com/topic/185626-session-woes/#findComment-980233
Share on other sites

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.