Jump to content


Photo

Post And Session Varaibles


  • Please log in to reply
7 replies to this topic

#1 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 27 June 2006 - 05:31 PM

[img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] I am unable to get values from two login fields into session variables. The following code is not putting the values from my text fields into my session variables:

<?
if(isset($_POST['SID']) && isset($_POST['EID']))
{
$_SESSION['SID']=$_POST['SID'];
$_SESSION['EID']=$_POST['EID'];
header("Location: owner/main.php");
}
?>
.
.
.
.
.
<form name="login" method="post" action="login.php">
<input name="SID" type="text" class="inputbox" size="50" maxlength="50">
<input name="EID" type="text" class="inputbox" id="EID" size="50" maxlength="60">
<input name="Submit" type="submit" class="btn" value="Login">
</form>

Any ideas? Please help!!!

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 27 June 2006 - 05:35 PM

Add session_start() at the top [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 27 June 2006 - 05:44 PM

Do I need anything at the beginning of the next page to reference these variables?

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 27 June 2006 - 05:49 PM

When ever you use sessions you will need to have session_start as the first line for each page that uses sessions.

#5 a1ias

a1ias
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 27 June 2006 - 05:52 PM

[!--quoteo(post=388578:date=Jun 27 2006, 06:44 PM:name=justinphp)--][div class=\'quotetop\']QUOTE(justinphp @ Jun 27 2006, 06:44 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Do I need anything at the beginning of the next page to reference these variables?
[/quote]

just session_start();

personally I would create friendly variables on the new page like:

$eid = $_SESSION['EID'];
$sid = $_SESSION['SID'];

(usually at the beginning)

#6 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 27 June 2006 - 05:56 PM

Thanks, works great. I inherited this site and have been trying to get it going with a new hosting company, I have no idea on how they got it going with their old hosting. Again, thanks a bunch!!

#7 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 27 June 2006 - 06:22 PM

You saying that this is a previous script from someone and that they didn't have session_start at the top of their pages? If thats the case then they most probably had setting called [b]session.auto_start[/i] enabled.

This setting starts the session on every page request without having to use session_start().

#8 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 27 June 2006 - 06:27 PM

using the auto start would be a bad idea if part of your is not part of a session, right? Part of the site takes cc#'s and phyical address and email addresses and the part of the site that is not part of the session is not secure. What is your opinion?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users