Jump to content

fat_bob

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fat_bob's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok I have now found the "problem" but havent solved it. The thing is that the variables value isnt stored once you press the link and gets to the new page. It seams as it doesnt store the value on the computers memory. (and its not wrong on my computer, its still the script btw^^)
  2. But in my other page the <?php session_start(); $_SESSION['test'] = "I'm a SESSION"; part. and the echo $_SESSION['test']; ?> aint in the same page.
  3. PHP Version 4.3.10 sounds very old... :-\
  4. haha no idea king....as I said im noob^^ but if you mean what sort of "server" im runing the script on, then its the latest verion of easyPHP
  5. Nope....didnt solve the case.... :(
  6. Very strange.....since it says that it cant find the variable and the index or something.hmm :-[ ??? Notice: Undefined index: loger in ...\test.php on line 3 Notice: Undefined variable: loger in ...\test.php on line 4 bajs
  7. Well the thing is that if the user enters the right name and pass they will get a link that they press on. and when they press on that link they get linked to a blank new page with this code atm[code]<?php session_start(); $loger = $_SESSION['loger']; if ($loger == 1) {    //logged in } else {    //ask them to login } ?>[/code] that you posted to me. But it doesnt seams as the variable $loger exist anyway. Does this comand store the variable on the computer memory until I want it to get deleted or is it just there as long as the page with the variable fuction is loaded?. Once again here you have the full code. but the "from" thing is still the same. The page that creates the variables and checks if the user name and pass is right and the prints a link depending on the users name and pass is right or wrong. [code]<?php session_start(); $con = mysql_connect("localhost","root",""); if (!$con)   {   die('Could not connect: ' . mysql_error());   }mysql_select_db("untitled", $con);$result = mysql_query("SELECT * FROM userlogin");while($row = mysql_fetch_array($result))   { $userdb = $row['user']; $passdb = $row['password']; }mysql_close($con); $userfo = $_POST["user1"]; $passfo = $_POST["password1"]; if($userdb == $userfo and $passdb == $passfo){ $_SESSION['loger'] = 1; echo "<a href='test.php'>test</a>"; echo $_SESSION['loger']; }else{ $_SESSION['loger'] = 0; } ?>[/code] The page that the link "links" the user to once its pressed. [code] <?php session_start(); $loger = $_SESSION['loger']; if ($loger == 1) {    echo "Succes!"; } else {    echo "Error!"; } ?>[/code] Thanks for trying to help me btw...even thoe im noob^^... The best thing whould be if there was some way to create a variable that stores on the compluter memory, and that you can call anytime during the session thats the computer is turned on and once its shutdown the variable delets it self, and there also is some sort of "delete" function so you can for example press on a button on the web site (example "log out") and then the stored variable get erased from the computers memory.
  8. Do you mean that I should do like this on the new page if I want it to print the value of the variable? [code]<?php session_start(); echo $_SESSION['loger']; ?>[/code] cause it doesnt seams to find the variable.
  9. Close but not exactly what I wanted..I think. I will let you have my litle code aswell, so I can explain my request abit better. This is a form that where the user puts in there username and password which is "linked" to another php page(see belowe) [code]<html> <head> <title>Personal INFO</title> </head> <body> <form method="post" action="dbsearch.php"> user:<input type="text" size="12" maxlength="12" name="user1"><br /> password:<input type="text" size="12" maxlength="12" name="password1"><br /> <input type="submit" value="submit" name="logg in"> </form> </body> </html>[/code] This is the php that the form is linked to. [code]<?php $con = mysql_connect("localhost","root",""); if (!$con)   {   die('Could not connect: ' . mysql_error());   }mysql_select_db("untitled", $con);$result = mysql_query("SELECT * FROM userlogin");while($row = mysql_fetch_array($result))   { $userdb = $row['user']; $passdb = $row['password']; }mysql_close($con); $userfo = $_POST["user1"]; $passfo = $_POST["password1"]; if($userdb == $userfo and $passdb == $passfo){ $loger = 1; }else{ $loger = 0; } ?>[/code] Now I want to make a completly new php page but I want to get the value of the "loger" variable(s) in the new page from the old page above. so if the user on the last page did enter $userdb == $userfo and $passdb == $passfo right then the new page that I want to create should call the variable $loger with a value of "1", and if $userdb == $userfo and $passdb == $passfo was flase then the variable should have a value of "0". The problem is that I dont want to use and database or call any other inc files or so. Is this possible or will I have to make it another way? and please now you have the code. so if you have any ideas give me the full code,since im quite new to php so that whould make it much easier for me to understand and etc. Thanks!
  10. Hi! I have a question, you see I want to take an already existing variable on a diffrent page and then call that variable in another page aswell, but I only want the variable and not the whole code, so the include() doesnt work as far as I can notice. And I also want to avoid to use a database for this since I want the value of the variable to be added to the local user machine and not in a server. Is this possible?please help me! If you need the code to understand what I mean then just ask. ;)
×
×
  • 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.