Welcome to WebmasterWorld Guest from 54.224.203.224

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Remote server and local server behave differently

     
2:41 am on May 15, 2008 (gmt 0)

New User

5+ Year Member

joined:Apr 26, 2008
posts: 14
votes: 0


Hi friends

I am having the problem with some PHP script which wont run properly when uploaded in remote web server though they work nicely in local web server...for example

In my php login script remote server gives an error like cannot modify header information

thanks

3:53 am on May 15, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Apr 13, 2008
posts:142
votes: 0


Do both servers have the same PHP version? You may be using some methods not supported by older versions. Also double check your php.ini files to make sure they are similar where needed
3:59 pm on May 15, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 4, 2005
posts:621
votes: 0


you might be sending a header location redirect, move it a couple lines or re-order the logic and see if that works.

also do a phpinfo() on both servers and compare...

and posting your script might help too!

1:22 am on May 16, 2008 (gmt 0)

New User

5+ Year Member

joined:Apr 26, 2008
posts: 14
votes: 0


ag_47....

my local server has php 5.0.4 and remote has got 5.2.6....will that affect?

my script is very basic...
FILE: logincheck.php
<?php
session_start();

if(isset($_POST['username']) && isset($_POST['password']))
{
$username=$_POST['username'];
$password=$_POST['password'];
if ($username=="xyz" && $password=="xyz")
{
session_register('login');
$_SESSION['login']=true;
}
else
echo "incorrect username or password";
}
?>
/////
Some HTML Code
/////
<?PHP
if(isset($_SESSION['login']) && $_SESSION['login']==true)
{

echo "<a href='../admin/logout.php'>Logout</a>";
}
else
echo "<a href='../admin/index.php'>Login</a>";
?>

1:40 am on May 16, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Apr 13, 2008
posts:142
votes: 0


Don't use session_register();
$_SESSION['login']=true; is enough. Use of session_register() is deprecated.
[ca.php.net...]

Other than that it looks fine. GL

3:29 am on May 16, 2008 (gmt 0)

New User

5+ Year Member

joined:Apr 26, 2008
posts: 14
votes: 0


many thanks ag_47...

My this problem is now solved...

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members