Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP wierd, locally works but server does not
    primarykey
    data
    text
    <p>I'm working on this web page using PHP. I'm testing local using easyphp version: 5.3.9 I did a usual sign in, sign out functionality. When I test locally, works just as expected. But when I upload it to a godaddy hosting service via FTP, it starts to do wierd things. </p> <ul> <li>The session variables are not working correctly, sometimes it works, sometimes it does not work! The sign in connection and validation on db is working fine! but is when reading SESSION variables from another file that fails.</li> </ul> <p>What could it be? php version? but I'm just using simple $_SESSION['name'] variables. Bug? please help!</p> <p>This is what I have already tried: </p> <ul> <li>Using other browsers.</li> <li>Re upload the source (many times)</li> <li>Clearing cache, cookies etc..</li> <li>Testing step by step, but like i said it works fine hosting the web page locally.</li> </ul> <p>One last thing that it might be important is that the db is hosted on a server (which is not my local pc ofc) And the connection to this db is working fine on both scenarios.</p> <p>This is my code:</p> <p>landing.php (in case you want to know xD):</p> <pre><code>&lt;div class="xxx"&gt;Log in&lt;/div&gt; &lt;div class="xxx"&gt; &lt;form class="xxxx" method="post" action="Bean.php"&gt; &lt;input type="hidden" value="login" name="oper"&gt; &lt;input type="text" placeholder="E-mail" name="mail"/&gt; &lt;input type="password" placeholder="Password" name="pass"/&gt; &lt;input type="submit" value="LOG IN!" /&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>Bean.php</p> <pre><code>if (!isset ($_COOKIE[ini_get('name')])) { session_set_cookie_params(0, '/'); session_name('name'); session_start(); } if($oper=="login") { $user=$cws-&gt;VerifyUser($_POST['mail'],$_POST['pass']);//$cws is a class that connects to the server with the db via WS if(strlen($user-&gt;body-&gt;mail)&gt;5)//this is because if the user is not found it returns blank or '@.' { $_SESSION['session_mail']=$user-&gt;body-&gt;mail; $_SESSION['session_name']=$user-&gt;body-&gt;name; $_SESSION['session_miniPicture']=$user-&gt;body-&gt;miniPicture; $_SESSION['session_on']=true; //This are the variables I can't read later! echo("&lt;script type=\"text/javascript\" &gt; location.replace(\"../home.php\"); &lt;/script&gt;"); } else{ echo("&lt;script type=\"text/javascript\" &gt; alert(\"E-mail or password incorrect \"); location.replace(\"../landing.php\"); &lt;/script&gt;"); } } </code></pre> <p>home.php:</p> <pre><code>if (!isset ($_COOKIE[ini_get('name')])) { session_set_cookie_params(0, '/'); session_name('name'); session_start(); } //In this check, the variable $_SESSION['session_on'] is NOT set! WHY??? if(!isset($_SESSION['session_on']) || $_SESSION['session_on']==false) { echo("&lt;script type=\"text/javascript\" &gt; location.replace(\"landing.php\"); &lt;/script&gt;"); } echo ( "mail: ".$_SESSION['session_mail']."&lt;br/&gt;"); // for debug echo ( "name: ".$_SESSION['session_name']."&lt;br/&gt;"); // for debug echo ( "on: ".$_SESSION['session_on']."&lt;br/&gt;"); // for debug Welcome &lt;?php echo $_SESSION['session_name']; ?&gt; &amp;nbsp;- &lt;a href="signout.php"&gt;Sign out&lt;/a&gt; </code></pre> <p>signout.php:</p> <pre><code>if (!isset ($_COOKIE[ini_get('name')])) { session_set_cookie_params(0, '/'); session_name('name'); session_start(); } if(isset($_SESSION['session_on']) &amp;&amp; $_SESSION['session_on']==true) { $_SESSION['session_on']=false; echo("&lt;script type=\"text/javascript\" &gt; location.replace(\"landing.php\"); &lt;/script&gt;"); } </code></pre> <p>Please help! should I contact godaddy support? is this related to php version? what could it be? thank you</p> <p>Alejandro Casas</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload