anujphp Posted May 22, 2009 Share Posted May 22, 2009 hello everyone Please help me solving this issue my website is working fine when i run the website in vertrigo environment but when i have uploaded it in a webser www.ueuo.com then the session is not working and i am not been able to log in,the session is not working at all. here is the code of my logincheck.php file <?session_start(); if(!session_is_registered('loginid')) { $loginmsg="Please Login to view Members Area"; session_register("loginmsg"); header("Location: login.php "); exit; } ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/ Share on other sites More sharing options...
MadTechie Posted May 22, 2009 Share Posted May 22, 2009 Kinda need some more info, Try a simple script like this and see if it works <?php session_start(); if(!empty($_SESSION['counter'])) { $_SESSION['counter']++; }else{ $_SESSION['counter']=1; } echo $_SESSION['counter']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839822 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 Thank you MadTechie The simple code is working fine i took few more test and found that this function is not working session_register("msg"); Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839834 Share on other sites More sharing options...
MadTechie Posted May 22, 2009 Share Posted May 22, 2009 Okay so sessions work fine, but not in your script (which i have just noted you have posted some code), your sessions are using an old DEPRECATED style Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. try this <?php session_start(); if(!isset($_SESSION['loginid']) { $_SESSION['loginmsg'] ="Please Login to view Members Area"; header("Location: login.php "); exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839837 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 i have replaced my code with yours and now nothing is showing up after i enter username and password. you can have a look to the website yourself the address is http://jaika.co.nr thanks Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839845 Share on other sites More sharing options...
MadTechie Posted May 22, 2009 Share Posted May 22, 2009 your probably need to update that code.. that one section of code, once the code below "logincheck.php" i can't find on the site and it redirects you to login.php (that i can't find).. I'm starting to wonder if its a session problem at all, yes your using deprecated code and you say thats the problem but i'm not so sure! Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839851 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 This is the code where i am checking the user and registering the variable in session <?php session_start(); require "config.php"; $login_id = $HTTP_POST_VARS['loginid']; $password = $HTTP_POST_VARS['password']; $sql= "select * query"; $result=executeQuery($sql); if($line=mysql_fetch_array($result)) { //$msg= "Login Successful"; session_register("login_id"); //session_register('msg'); header("Location: postrecipe.php "); exit; } else { $msg= "Login Failed : Check Login and Password"; session_register('msg'); header("Location: login.php "); exit; } ?> Thank you for your time and effort Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839856 Share on other sites More sharing options...
MadTechie Posted May 22, 2009 Share Posted May 22, 2009 http://jaika.co.nr/postrecipe.php doesn't exist http://jaika.co.nr/login.php doesn't exist $HTTP_POST_VARS [deprecated] use $_POST $sql= "select * query"; Huh! $result=executeQuery($sql); is this part or a prepared statment ? or a function! session_register [deprecated] use $_SESSION Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839867 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 i am sorry for creating confusion.. $result=executeQuery($sql); its my created function which simple execute a query the code is function executeQuery($sql) { $result = mysql_query($sql) or die("query failed: $sql"); return $result; } I have changed the name of the file.. postrecipe.php is not the original name.its post.php same way its userlogin.php and checkuserlogin.php $sql= "select * query"; this means the query which i execute.as the website is running fine in my system so i thought it wont be necessary to give the code. in my system i am having php 5.2 and in the webserver they are also using php 5.2 still as you have suggested i have changed the code in my system and its not working but my old code is working Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839877 Share on other sites More sharing options...
MadTechie Posted May 22, 2009 Share Posted May 22, 2009 just tried to login with test account The requested URL /post.php was not found on this server. <?php session_start(); require "config.php"; $login_id = $HTTP_POST_VARS['loginid']; $password = $HTTP_POST_VARS['password']; $sql= "select * query"; $result=executeQuery($sql); if($line=mysql_fetch_array($result)) { //$msg= "Login Successful"; $_SESSION['login_id'] = $line['id']; //this update could be wrong as i have no idea about your table setup! //session_register('msg'); header("Location: postrecipe.php "); exit; } else { $_SESSION['msg']= "Login Failed : Check Login and Password"; header("Location: login.php "); exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839885 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 http://jaika.co.nr/post.php is there is the server it will show you the website page with a request to log in.as one cannot view the page without log in. i have made the changes but the issue is still there.. when i use Internet explorer i am nto been able to log in but when I use mozilla i am able to log in but the session variable is not showing i,e login_in which i register while someone log in Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839891 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 hello MadTechie I am sorry i dont no your name so calling you by your username. The issue is resolved,it was a problem with a php settion,i have changed the php settion in the server and the website is working fine. I would like to thank you for your time and effort,Thanks a lot.and yes I have learnt few thing from your about session .From next time i will not use the old way of registering session infact i will change the code in my present site also.Thank a lot once again Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839896 Share on other sites More sharing options...
anujphp Posted May 22, 2009 Author Share Posted May 22, 2009 Sorry again... the website is working fine when i am visiting it using Mozilla but it is not working when i uses Internet explorer Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839911 Share on other sites More sharing options...
Dathremar Posted May 22, 2009 Share Posted May 22, 2009 Thats should be Javascript problem not php. I know IE errors are not really useful but try to google them, there You can get the general idea about the error or if You can narrow it down post some code regards Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839917 Share on other sites More sharing options...
MadTechie Posted May 22, 2009 Share Posted May 22, 2009 Seams fine in IE 7 and FF3 Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-839922 Share on other sites More sharing options...
anujphp Posted May 24, 2009 Author Share Posted May 24, 2009 hello in displaying the pages it is not showing any error.it works fine but when I try to log in it is not working but when I use mozilla it works fine the log in system is working fine,I dont get any error message neither in php nor in javascrpt,Everything is working fine except the log in system But the same code is working fine in my system when I am running from my localhost even in IE,i am using IE 7 Quote Link to comment https://forums.phpfreaks.com/topic/159236-session-is-not-working/#findComment-841112 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.