Results 1 to 4 of 4

Thread: Having log in issues.

  1. #1
    Junior Member BSkopnik's Avatar
    Join Date
    May 2009
    Posts
    2

    Default Having log in issues. 22 May 2009 @ 15.05

    Hey everyone, I hope i can get some help with this.. See i have a site going php, i wrote a log in script that almost everyone can log in with.. but there are some people who just cannot. Like it works for most and some. What i mean is regardless of proper login user/pass it will spit out my default wrong username/password error or just drop to a blank screen. I will post all relevant code aswell. I have tried debugging with viewing all the post vars, everything is correct and sending properly. Im just at a loss.

    global_data.php just contains the menu, umenu and mysql info.

    index2.php
    Code:
    <?php
    
    if ( isset($_SESSION["LoggedIn"]) ) 
    {
        session_destroy();
    }
    /**
     * @author BSkopnik
     * @copyright 2009
     */
    
    $error = $_GET['op'];
    $today = date( "D F d");
    ?>
    
    <html>
    <head>
        <title> Login (<? echo $today; ?>)</title>
        <link rel='stylesheet' type='text/css' href='css/sheet.css' title='style' />
    </head>
    <body bgcolor="White">
    <form method="post" action="login.php" name="LogIn">
    <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
    
        <?
            if ( $error == 'error')
            {
                echo "<tr><td colspan=\"2\" align=\"center\" valign=\"bottom\"><div class=\"postby\">ERROR: INCORRECT PASSWORD OR USERNAME</div></td></tr>\n";
            }
        ?>
    
        <tr>
            <td align="center" valign="middle">
                <table border="1" width="150" height="10%" cellpadding="0" cellspacing="2">
                    <tr>
                        <td align="right"><div class="field">USERNAME:</div></td>
                        <td>
                            <input type="text" name="U_NAME" maxlength="15" size="7" style="background-color: #666666; color: #FFFFFF; border: none;" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right"><div class="field">PASSWORD:</div></td>
                        <td>
                            <input type="password" name="U_PASS" maxlength="20" size="7" style="background-color: #666666; color: #FFFFFF; border: none;" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <input type="submit" name="DoLogIn" value="Log In" style="background-color: #999999; color: #FFFFFF; border: 1px solid #FFFFFF; align=center" />
                        </td>
                    </tr>
                </table>
            </td>
    </table>
    </form>
    </body>
    </html>
    login.php
    Code:
    <?php
    session_start();
    /**
     * @author BSkopnik
     * @copyright 2009
     */
    
    require "global_data.php";
    
    if ( isset($_POST["DoLogIn"]) )
    {
        $up_link = mysql_connect( $DB_HOST, $DB_UNAME, $DB_UPASS ) or die( mysql_error() );
        mysql_selectdb( $DB_NAME ) or die( mysql_error() );
        
        $name = stripslashes($_POST["U_NAME"]);
        $pass = stripslashes($_POST["U_PASS"]);
        
        $name = strtolower( $name );
        $pass = strtolower( $pass );
        
        $query = "SELECT * FROM users WHERE username='$name' and password='$pass'";
        $result = mysql_query( $query );
        
        $count = mysql_num_rows( $result ) or die( mysql_error() );
        
        if ( $count == 1 )
        {
            $logged = TRUE;
            $_SESSION["LoggedIn"] = $logged;
            $_SESSION["Name"] = $name;
            header("location:cp.php");
            exit;
        }else
        {
            header("location:index2.php?op=error");
            exit;
        }
        
    }else
    {
        echo "ERROR: Cannot access page. Please check your link and try again.";
    }
    ?>
    cp.php
    Code:
    <?php
    session_start();
    /**
     * @author BSkopnik
     * @copyright 2009
     */
    include ("global_data.php");
    
    if ( !isset($_SESSION["LoggedIn"]) )
    {
        header("location:index2.php?op=error");
        exit;
    }
    
    $today = date( "D F d");
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Home (<? echo $today; ?>)</title>
        <link rel="stylesheet" type="text/css" href="css/sheet.css" title="style">    
    </head>
    <body bgcolor="White">
        <center>
        <table border="0" width="640">
            <!-- Build table, 2 columns -->
            <tr>
                <td align="center">
                    <!-- Menu -->
                    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                    <table border="0" cellpadding="0" cellspacing="0">
                        <?
                            if ( (isset($_SESSION["LoggedIn"])) && ($_SESSION["Name"] == "admin") )
                            {
                                echo $umenu;
                            }else
                            {
                                echo $menu;
                            }
                        ?>
                    </table>
                </td>
                <td align="center" valign="middle">
                    <!-- Page Content -->
                    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                    <table border="1" bordercolor="#000000" cellpadding="0" cellspacing="0" width="200">
                        <tr>
                            <td>
                                <div class="pagetitle">HOME</div>
                                <div class="content">
                                    ... Took out page content for posting space ...
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        </center>
    </body>
    </html>
    Like i was saying, it works fine for pretty much everyone. Some people with IE have issues, and it just spits back a blank page if they use wrong user/pass. If they use right user/pass it spits back the error for wrong user/pass. I cannot replicate the issue. Works fine in Firefox, IE, and chrome for me. Any help would be appreciated!
      Reply With Quote

  2. #2
    Senior Member CloudedVision's Avatar
    Join Date
    Jan 2009
    Posts
    824
    Blog Entries
    4

    Default 22 May 2009 @ 22.08

    This is an interesting problem, usually PHP works the same regardless of OS and browser.

    Could you give some more details on the errors it returns?

    Also, if you feel comfortable, could you give us a temporary username and password so we can troubleshoot it directly?
      Reply With Quote

  3. #3
    Junior Member BSkopnik's Avatar
    Join Date
    May 2009
    Posts
    2

    Default 24 May 2009 @ 04.32

    to be honest, I can't replicate the issue at all anymore wasn't getting any errors either. I was able to at first, but when i changed the code in login.php to isset($_POST["DoLogIn"]) it worked cleared up what I could recreate on my pc.

    As per the pass/user

    webpro/123abc

    http://www.twcwow.co.nr
      Reply With Quote

  4. #4
    php coder davidj's Avatar
    Join Date
    May 2009
    Posts
    153

    Default 24 May 2009 @ 12.20

    probably old version may have server cached

    after uploading any changes try a Ctrl+F5 which will force a server refresh
    [SIZE=2][FONT=Arial]Do you want me to teach you PHP?[/FONT][/SIZE]
      Reply With Quote

Similar Threads

  1. div float issues
    By bonnit in forum Computer Hardware & Software
    Replies: 2
    Last Post: 21 Feb 2011, @ 16.50
  2. IE Issues
    By fbmagik in forum HTML & CSS
    Replies: 5
    Last Post: 18 Feb 2011, @ 00.39
  3. More CSS Footer Issues
    By fbmagik in forum HTML & CSS
    Replies: 10
    Last Post: 10 Jan 2011, @ 09.50
  4. Fixing issues with IE 6, 7 and 8
    By trixiemay in forum HTML & CSS
    Replies: 1
    Last Post: 1 Jun 2010, @ 09.05

Tags for this Thread

Posting Permissions

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