jeffshead Posted November 5, 2014 Share Posted November 5, 2014 (edited) The code snippet below works fine with PHP 5.3 (register_globals = Off) but does NOT give the same results with PHP 5.5: $verhash = md5($tstamp."salt"); if ($hash != $verhash) { $_SESSION['direct'] = 1; if(isset($_SESSION['ntrd'])) { unset($_SESSION['ntrd']); } if(isset($_SESSION['rntr'])) { unset($_SESSION['rntr']); } header('refresh: 0; url=/accessDenied.php'); exit; } I'm not sure if there is a problem with the above snippet or with some other part of the code but I always get redirected to the 'accessDenied.php' page with PHP 5.5. Can someone tell me if the snippet above would output differently on PHP 5.5? Thanks, Jeff Edited November 5, 2014 by jeffshead Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/ Share on other sites More sharing options...
requinix Posted November 5, 2014 Share Posted November 5, 2014 Where are $hash and $tstamp coming from? Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495736 Share on other sites More sharing options...
jeffshead Posted November 5, 2014 Author Share Posted November 5, 2014 Where are $hash and $tstamp coming from? From previous code: tstamp = $_SESSION['tstamp']; $hash = $_SESSION['thash']; Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495737 Share on other sites More sharing options...
requinix Posted November 5, 2014 Share Posted November 5, 2014 Looks like the hashes don't match. Are you sure the data is in the session in the first place? Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495740 Share on other sites More sharing options...
jeffshead Posted November 5, 2014 Author Share Posted November 5, 2014 After more testing, I don't think the problem is related to the PHP version. I created a new test environment with both versions of PHP and I cannot re-create the issue on my server. The issue must be related to the host provider's server and/or settings. I think it must have something to do with sessions. Any ideas on what settings to look for? Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495741 Share on other sites More sharing options...
requinix Posted November 5, 2014 Share Posted November 5, 2014 The session ones. While you're at it, why not check all settings? phpinfo can help. Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495743 Share on other sites More sharing options...
mac_gyver Posted November 5, 2014 Share Posted November 5, 2014 php's error_reporting would probably help track down the problem. Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495744 Share on other sites More sharing options...
Jacques1 Posted November 5, 2014 Share Posted November 5, 2014 What are you even trying to do? You hash a session value and compare the result with a hash stored in the same session. What does that tell you? And what's this strange "salt" string? Quote Link to comment https://forums.phpfreaks.com/topic/292274-php-53-to-php-55-code-issue/#findComment-1495804 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.