Jump to content

Recommended Posts

Hi there. I'm transferring my work from my uni hosting page to my home webpage. Ive recreated the databases exactly so they are identicle (and double checked this) i've changed the connection information at the beginning of each of my php pages. my problem lies with sessions! For some reason the code which works on my uni website and holds the following sessions throughout my site works, but not at home!

 

// take the user id into the session id called user_session_id

$_SESSION['user_session_id'] = $user_id;

 

// take the login password into the session id called user_session_password

$_SESSION[user_session_password'] = $user_password;

 

// go to page

header ("location: useraccount.php");

exit;

 

now when i authenticate this user on the useraccount.php page theres no user found and ive narrowed it down to the sessions. my authentication is...

 

// Run user query (checks if the login credentials are correct)

$user_result = mysql_query("SELECT * FROM user WHERE user_id='$user_session_id' and user_password='$user_session_password'",$db);

 

 

Any idea why this might be??

Link to comment
https://forums.phpfreaks.com/topic/98784-sessions/
Share on other sites

ive got...

<?php

session_start();

 

at the beginning of every page.

 

i set the session on the login code before automatically sending the logged in user to the useraccount.php page so it shud be carried over in the session shudnt it? this is the way i have done it when i originally created the site and it worked fine

 

Link to comment
https://forums.phpfreaks.com/topic/98784-sessions/#findComment-505478
Share on other sites

Ok, new problem, im guessing its caused by the same issue though!!

 

If i was allow the user to select a link and send an id accross it by doing the following...

 

printf("<tr><td><a href=\"postselection.php?id=%s\">%s</a></td>", $post_row["post_id"], $post_row["post_id"]);

 

...it would work on my previous webpage but not on my new hosting.

 

to test to see if the variable is being passed accross i used...

 

echo "$id";

 

.... and nothing was output so im guessing its not holding the variable when moving to the next page. any idea's??

Link to comment
https://forums.phpfreaks.com/topic/98784-sessions/#findComment-507270
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.