Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About steveo314

  • Rank

Profile Information

  • Gender
  • Location
  • Interests
    Perl, PHP, Linux, Bicycles
  • Age
  1. I didn't think thats what it was but.... There is a php.ini on a root dir that I cannot get to on my server. My hosting company has access to it. Something was changed on it. session dir was commented out on my php.ini, which overrides theirs. A month and a half of thinking I had a bad piece of code and it was because something was commented out in my php.ini.
  2. Please delete my reply since I am a dumb twat.
  3. When I do this on script2.php $_SESSION isn't empty <?php //error_reporting(E_ALL); //ini_set('display_errors', 1); session_start(); echo session_id(); echo '<pre>'.print_r($_SESSION,true).'</pre>'; But when I change it to this it is empty <?php //error_reporting(E_ALL); //ini_set('display_errors', 1); session_start(); echo '<pre>'.print_r($_SESSION,true).'</pre>'; The session ids match between script1.php and script2.php no matter what also.
  4. change your last line to exit; 'die();' is when you have to force the script/program crash due to an error. Also use an 'echo();' before the 'exit();' if you want to print the array to the page.
  5. I moved those two lines up on each script. No additional errors besides whats in reply #34. I don't know how Westhost fares...
  6. script1.php is the action of the html form which is in reply #19. Do I need to have more in the lines I shared of script1.php in reply #36?
  7. function checkinput($username,$password) { if($username == "" or $password == "") { return false; } else { return true; } } function checkuser($username,$password,$iconnect) { $checkquery = "SELECT username, password FROM users WHERE username='$username' AND password='$password'"; if($result = mysqli_query($iconnect,$checkquery)) { return true; } else { return false; } } function failed($reasons) { echo "<p>There are some problems with your login credentials:</p><p><b>$reasons</b></p>"; }
  8. <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); if(session_status() != PHP_SESSION_ACTIVE) { echo "Session not active, script1.php"; sleep(1); } $iconnect = mysqli_connect("localhost","user","pass","db"); if(isset($_POST['submit'])) { //$username = htmlentities($_REQUEST['username']); //$password = htmlentities($_REQUEST['password']); $username = $_POST['username']; $password = $_POST['password']; $_SESSION['test'] = 'hello'; $_SESSION['username'] = $username; $_SESSION['password'] = $password; $password = md5($password); $valid = checkinput($username,$password); if($valid == true) { $valid = checkuser($username,$password,$iconnect); if($valid == true) { if($username != "") { header( 'refresh: 0; url=https://website/script2.php' ); exit;
  9. script1.php gives: Go to next script script2.php gives: Array ( ) Notice: Undefined index: username in /home/website/script1.php on line 14 Notice: Undefined index: test in /home/website/script2.php on line 15 line 14 is: $username = $_SESSION['username']; line 15 is: $test = $_SESSION['test']; cyberRobot, this is lines 1-13 of script2.php when I ran it with your debug lines: <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); if(session_status() != PHP_SESSION_ACTIVE) { echo "Session not active, script2.php"; sleep(1); } echo '<pre>' . print_r($_SESSION, true) . '</pre>'; //if($_SESSION['username'] == "") { //echo "Username is blank"; //sleep(1); //}
  10. I am trying to work on simplifying the whole thing. The process is spread out over too many scripts. We use a host. They handle the os admin. Whatever files and scripts are on it other than that I manage. They don't do earth shaking updates without notification. This came up when I was still on PHP5.6 and they put me at PHP7 yesterday. I have checked with them several times on what they have changed since this came up. Nothing until yesterday.
  11. I don't get anything when i comment the 'header();' just a white screen
  12. <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); first thing on both scripts
  13. Array ( ) Notice: Undefined index: username in /home/site/script2.php on line 14 $username = $_SESSION['username']; Notice: Undefined variable: html_inc in /home/site/script2.php on line 22 $html_inc = '' . $html_inc . '<meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />' . "\n"; changed to $html_inc = '' . '<meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />' . "\n";
  14. echo "Username is ".$_SESSION['username']; header('refresh: 0; url=https://website/script2.php'); Gives the correct username. I didn't copy your code. So when I went to my code and typed a concat not thinking.
  15. I did. If I do this in script1.php: $username = $_POST['username']; $_SESSION['username'] = $_POST['username']; echo "Username is $username"; header('refresh: 0; url=http://website/script2.php'); I'll get the right username but that element is empty in $_SESSION when I get to script2.php
  • 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.