Jump to content

session is not working


anujphp

Recommended Posts

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

Link to comment
Share on other sites

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;
   }
?>

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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;
   }
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.