PHP page Jump local Windows environment Normal, upload Linux server can not jump

Source: Internet
Author: User
PHP to do a next project, login after the page to jump to the homepage, the local Windows environment is normal, uploaded to the Linux server will not jump. Solution.
Code, the project structure is as follows:

action/loginin.php
User loginif (Isset ($_post[' username ") && isset ($_post[' password ']) &&!empty ($_post[' username ']) &&!empty ($_post[' password ')) {try{$username = $_post[' username '); $password = $_post[' password ']; $rs = $ Config[daoimpl]->getloginbyname ($username); $arr = Mysql_fetch_array ($rs);//echo $arr [' sys_user_passwd '];if ($ Arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {$_session[sessionuser] = $username; echo " ,//Jump to Index.php}else {echo "" in root directory; exit (0);}} catch (Exception $e) {echo ""; exit (0);}}





In addition the server is operating system: Ubuntu 12.04 64 bit


Reply to discussion (solution)

What is the performance that can't jump? Page does not exist? Or is the script not responding?

1, your traditional code will not throw an exception, so your exception handling is invalid, can be deleted. Maybe that's why he's here.
2. Use absolute path for URL jump
location= "/index.php"

What is the performance that can't jump? Page does not exist? Or is the script not responding?



Js script does not respond.

Add an alert to the login success code
if ($arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {
$_session[sessionuser] = $username;
Echo ';
Echo ';
}else {
echo "";
Exit (0);
}

The effect is:


After clicking Confirm, go back to the login screen again

is the file name in the same case? Windows defaults to case-insensitive, and Linux is case-sensitive. Also, do you have direct access to the PHP to see if you can access it?
Or, you have a static HTML file, put to loginin.php the same location, the loginin.php inside the JS copy into the test, to see if normal jump?

Back to the login screen is not necessarily you did not jump to index.php, it is possible that your session did not register successfully, to index.php and go to login.php.

You put some output information in front of the index.php to see if you have visited index.php

Log to see where the program goes???。

User loginif (Isset ($_post[' username ") && isset ($_post[' password '])        &&!empty ($_post[') Username ']) &&!empty ($_post[' password ')) {    echo ' 1 ';    try{    $username = $_post[' username ');    $password = $_post[' password ');    $rs = $config [Daoimpl]->getloginbyname ($username);    $arr = Mysql_fetch_array ($rs);    echo $arr [' sys_user_passwd '];    echo ' 2 ';    if ($arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {        $_session[sessionuser] = $ Username;        echo ' 3 ';        echo ';//jump to the root directory under index.php    }else {        echo ' 4 ';        echo "";        Exit (0);    }    }    catch (Exception $e) {        echo ' 5 ';        echo "";        Exit (0);}    }

1, your traditional code will not throw an exception, so your exception handling is invalid, can be deleted. Maybe that's why he's here.
2. Use absolute path for URL jump
location= "/index.php"



According to your opinion, I have changed the code, but still can not jump, login successfully returned to the login screen

if (isset ($_post[' username ')) && isset ($_post[' password '])
&&!empty ($_post[' username ') &&!empty ($_post[' password '])
) {
try{
$username = $_post[' username ');
$password = $_post[' password ');
$rs = $config [Daoimpl]->getloginbyname ($username);
$arr = Mysql_fetch_array ($RS);
echo $arr [' sys_user_passwd '];
if ($arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {
$_session[sessionuser] = $username;
Echo ';
Echo ';
}else {
echo "";
Exit (0);
}
//}
catch (Exception $e) {
echo "";
Exit (0);
//}
}

It is possible that your session did not register successfully, to the index.php page after the judgment is not logged in, but also to the login interface to jump. You first try to block index.php's jump function.

Log to see where the program goes???。

User loginif (Isset ($_post[' username ") && isset ($_post[' password '])        &&!empty ($_post[') Username ']) &&!empty ($_post[' password ')) {    echo ' 1 ';    try{    $username = $_post[' username ');    $password = $_post[' password ');    $rs = $config [Daoimpl]->getloginbyname ($username);    $arr = Mysql_fetch_array ($rs);    echo $arr [' sys_user_passwd '];    echo ' 2 ';    if ($arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {        $_session[sessionuser] = $ Username;        echo ' 3 ';        echo ';//jump to the root directory under index.php    }else {        echo ' 4 ';        echo "";        Exit (0);    }    }    catch (Exception $e) {        echo ' 5 ';        echo "";        Exit (0);}    }



has been run to the login success code, 3 floor has a paste operation phenomenon

if (isset ($_post[' username ')) && isset ($_post[' password ']) &&!empty ($_post[' username ']) &&! Empty ($_post[' password ')) {  $username = $_post[' username '];  $password = $_post[' password ');  $rs = $config [Daoimpl]->getloginbyname ($username);  $arr = Mysql_fetch_array ($rs);  if ($arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {    $_session[sessionuser] = $ Username;    Echo ';    echo ';  } else {    echo "";  }}
If the login succeeds, it will pop up the "Verify Success" dialog box, do you have it?

It is possible that your session did not register successfully, to the index.php page after the judgment is not logged in, but also to the login interface to jump. You first try to block index.php's jump function.



The session has been set successfully, blocked off index.php jump, the program stopped in the logininphp

if (isset ($_post[' username ')) && isset ($_post[' password ']) &&!empty ($_post[' username ']) &&! Empty ($_post[' password ')) {  $username = $_post[' username '];  $password = $_post[' password ');  $rs = $config [Daoimpl]->getloginbyname ($username);  $arr = Mysql_fetch_array ($rs);  if ($arr && $arr [' sys_user_passwd '] = = Generateuserpassword ($password)) {    $_session[sessionuser] = $ Username;    Echo ';    echo ';  } else {    echo "";  }}
If the login succeeds, it will pop up the "Verify Success" dialog box, do you have it?

Yes, the 3 floor of the picture is logged in, Pop-up dialog box


It is possible that your session did not register successfully, to the index.php page after the judgment is not logged in, but also to the login interface to jump. You first try to block index.php's jump function.



The session has been set successfully, blocked off index.php jump, the program stopped in the logininphp



From the loginin.php code and running situation you posted, it is impossible to go to the record interface jump, right? After blocking off the index.php jump, the program will no longer go to the login interface, which also explains some of the problems.

You can output some information in front of the index.php, and see what happens?

Is that you don't have a session_start ()

What's the session? Xi?

The initial judgment of the problem is really in the code of my session check, thank you for your help analysis!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.