Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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