Results 1 to 4 of 4

Thread: PHP request not responding

  1. #1
    Join Date
    Sep 2006
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default PHP request not responding

    We moved our web server to a new machine with the following config.

    Apache 2
    MySQL 5
    PHP 5
    SUSE Linux


    Everything works fine. The php pages show up fine. The record sets all show up. But when I go to login in an admin page. I put in the username and password and click login. Nothing happens when I click the login button except the fields clear. Also the same thing happens when I try to input something in the search field. Nothing happens. I read somewhere that it has something to do with the session module? My session module is turned on. I tried using error reporting

    PHP Code:
    Turn on error reporting:
    PHP Code:
    ini_set('display_errors'1);
    error_reporting(E_ALL); 
    But when I run the page the entire page is a blank.


    Any thoughts?

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Even if this page originally used to work, it may still be an issue in the code itself. Paste the page's code and/or login script.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  3. #3
    Join Date
    Sep 2006
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Here is the code. Thanx for the help in advanced.

    PHP Code:

    <?php session_start(); ?>
    <?php ob_start
    (); ?>
    <?php
    header
    ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // date in the past
    header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT"); // always modified
    header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 
    header("Cache-Control: post-check=0, pre-check=0"false); 
    header("Cache-Control: private");
    header("Pragma: no-cache"); // HTTP/1.0 
    ?>
    <?php 
    include ("db.php"?>
    <?php 
    include ("phpmkrfn.php"?>
    <?php

    // User levels
    define("ewAllowAdd"1true);
    define("ewAllowDelete"2true);
    define("ewAllowEdit"4true);
    define("ewAllowView"8true);
    define("ewAllowList"8true);
    define("ewAllowReport"8true);
    define("ewAllowSearch"8true);                                                                                                                        
    define("ewAllowAdmin"16true);    
    if (@
    $HTTP_POST_VARS["submit"] <> "") {
        
    $bValidPwd false;

        
    // Setup variables
        
    $sUserId = @$HTTP_POST_VARS["userid"];
        
    $sPassWd = @$HTTP_POST_VARS["passwd"];
        if (!(
    $bValidPwd)) {
                
    $conn phpmkr_db_connect(HOSTUSERPASSDBPORT);
                
    $sUserId = (!get_magic_quotes_gpc()) ? addslashes($sUserId) : $sUserId;
                
    $sSql "SELECT * FROM `admin_users`";
                
    $sSql .= " WHERE `username` = '" $sUserId "'";
                
    $rs phpmkr_query($sSql,$conn) or die("Failed to execute query: " phpmkr_error() . '<br>SQL: ' $sSql);
                if (
    phpmkr_num_rows($rs) > 0) {
                
    $row phpmkr_fetch_array($rs);
                    if (
    strtoupper($row["password"]) == strtoupper($sPassWd)) {
                        
    $HTTP_SESSION_VARS["warren_status_User"] = $row["username"];
                        
    $HTTP_SESSION_VARS["warren_SysAdmin"] = 0// non System Administrator
                        
    $bValidPwd true;
                    }
                }
        
    phpmkr_free_result($rs);
        
    phpmkr_db_close($conn);
        }
        if (
    $bValidPwd) {

            
    // Write cookies
            
    if (@$HTTP_POST_VARS["rememberme"] <> "") {
                
    setCookie("warren_userid"$sUserIdtime()+365*24*60*60); // change cookie expiry time here
            
    }
            
    $HTTP_SESSION_VARS["warren_status"] = "login";
            
    ob_end_clean();
            
    header("Location: index.php");
            exit();
        } else {
            
    $HTTP_SESSION_VARS["ewmsg"] = "Incorrect user ID or password";
        }
    }
    ?>
    <?php 
    include ("header.php"?>
    <script type="text/javascript" src="ew.js"></script>
    <script type="text/javascript">
    <!--
    function EW_checkMyForm(EW_this) {
        if (!EW_hasValue(EW_this.userid, "TEXT" )) {
            if  (!EW_onError(EW_this, EW_this.userid, "TEXT", "Please enter user ID"))
                return false;
        }
        if (!EW_hasValue(EW_this.passwd, "PASSWORD" )) {
            if (!EW_onError(EW_this, EW_this.passwd, "PASSWORD", "Please enter password"))
                return false;
        }
        return true;
    }

    //-->
    </script>
    <p><span class="phpmaker">Login Page</span></p>
    <?php
    if (@$HTTP_SESSION_VARS["ewmsg"] <> "") {
    ?>
    <p><span class="phpmaker" style="color: Red;"><?php echo $HTTP_SESSION_VARS["ewmsg"]; ?></span></p>
    <?php
        $HTTP_SESSION_VARS
    ["ewmsg"] = ""// Clear message
    }
    ?>
    <form action="login.php" method="post" onSubmit="return EW_checkMyForm(this);">
    <table border="0" cellspacing="0" cellpadding="4">
        <tr>
            <td><span class="phpmaker">User Name</span></td>
            <td><span class="phpmaker"><input type="text" name="userid" size="20" value="<?php echo @$HTTP_COOKIE_VARS["warren_userid"]; ?>"></span></td>
        </tr>
        <tr>
            <td><span class="phpmaker">Password</span></td>
            <td><span class="phpmaker"><input type="password" name="passwd" size="20"></span></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td><span class="phpmaker"><input type="checkbox" name="rememberme" value="true">Remember me</span></td>
        </tr>
        <tr>
            <td colspan="2" align="center"><span class="phpmaker"><input type="submit" name="submit" value="Login"></span></td>
        </tr>
    </table>
    </form>
    <br>
    <p><span class="phpmaker">
    </span></p>
    <?php include ("footer.php"?>

  4. #4
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Well, you may want to use the newer $_POST variable instead of $HTTP_POST_VARS.
    I'd also add some echo statements in there to see where the problem is. Maybe add some else statements and what not. Basically, echo with every if/else if/else statement saying "this is happening" or "this is true" or "this is not true", but be specific so you can find out exactly what is not working. This will allow you to narrow in on the problem to a specific area of the code.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •