Closed Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: help plz

  1. #1
    laser212's Avatar
    laser212 is offline Newbie
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Exclamation help plz

    i am using this script for register login on my website but its not working properly its not posting any of the echo's after the script is run
    can anione help me plz

    Code:
    <?php
    session_start
    ();
    // Check if he wants to login:
    if (!empty($_POST[username]))
    {
        require_once(
    "connect.php");

        
    // Check if he has the right info.
        
    $query mysql_query("SELECT * FROM members
                                WHERE username = '$_POST[username]'
                                AND password = '$_POST[password]'"
    )
        or die (
    "Error - Couldn't login user.");
        
        
    $row mysql_fetch_array($query)
        or die (
    "Error - Couldn't login user.");
        
        if (!empty(
    $row[username])) // he got it.
        
    {
            
    $_SESSION[username] = $row[username];
            echo 
    "Welcome $_POST[username]! You've been successfully logged in.";
            exit();
        }
        else 
    // bad info.
        
    {
            echo 
    "Error - Couldn't login user.<br /><br />
                Please try again."
    ;
            exit();
        }
    }

    ?>
    Last edited by Orjan; 02-13-2010 at 05:28 AM. Reason: Please use code tags when posting code

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Furry Pancake's Avatar
    Furry Pancake is offline Learning Programmer
    Join Date
    Feb 2010
    Location
    Utah
    Posts
    54
    Rep Power
    0

    Re: help plz

    Quote Originally Posted by laser212 View Post
    i am using this script for register login on my website but its not working properly its not posting any of the echo's after the script is run
    can anione help me plz
    Code:
    <?php
    session_start
    ();
    // Check if he wants to login:
    if (!empty($_POST[username]))
    {
        require_once(
    "connect.php");

        
    // Check if he has the right info.
        
    $query mysql_query("SELECT * FROM members
                                WHERE username = '$_POST[username]'
                                AND password = '$_POST[password]'"
    )
        or die (
    "Error - Couldn't login user.");
        
        
    $row mysql_fetch_array($query)
        or die (
    "Error - Couldn't login user.");
        
        if (!empty(
    $row[username])) // he got it.
        
    {
            
    $_SESSION[username] = $row[username];
            echo 
    "Welcome $_POST[username]! You've been successfully logged in.";
            exit();
        }
        else 
    // bad info.
        
    {
            echo 
    "Error - Couldn't login user.<br /><br />
                Please try again."
    ;
            exit();
        }
    }

    ?>
    Are you talking about the actual "Welcome $_POST[username]" echo? or anything after that?

  4. #3
    laser212's Avatar
    laser212 is offline Newbie
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Re: help plz

    hi yeah the welcome or the bad login

    and if you can show me how to do the 5 sec redirect id realy apreciate it

  5. #4
    Furry Pancake's Avatar
    Furry Pancake is offline Learning Programmer
    Join Date
    Feb 2010
    Location
    Utah
    Posts
    54
    Rep Power
    0

    Re: help plz

    Gotcha, for the refresh, try
    Code:
    <meta http-equiv=refresh content=5URL=YOURURLHERE
    And that should be your 5 second refresh..

    and for the issue..

    Code:
    <?php
    session_start
    ();
    // Check if he wants to login:
    if (!empty($_POST[username]))
    {
    require_once(
    "connect.php");

    // Check if he has the right info.
    $query mysql_query("SELECT * FROM members
    WHERE username = '$_POST[username]'
    AND password = '$_POST[password]'"
    )
    or die (
    "Error - Couldn't login user.");

    $row mysql_fetch_array($query)
    or die (
    "Error - Couldn't login user.");

    if (!empty(
    $row[username])) // he got it.
    {
    $_SESSION[username] = $row[username];
    echo 
    "Welcome $_POST[username]! You've been successfully logged in.";
    exit();
    }
    else 
    // bad info.
    {
    echo 
    "Error - Couldn't login user.<br /><br />
    Please try again."
    ;
    exit();
    }
    }

    ?>
    take out the exit(); and then anything after those should work.. so if you are posting any extra text after that, it will actually load. The "exit();" completely drops the page, so unless you do an include you aren't going to have anything after it.. Make it look like:

    Code:
    <?php
    session_start
    ();
    // Check if he wants to login:
    if (!empty($_POST[username]))
    {
    require_once(
    "connect.php");

    // Check if he has the right info.
    $query mysql_query("SELECT * FROM members
    WHERE username = '$_POST[username]'
    AND password = '$_POST[password]'"
    )
    or die (
    "Error - Couldn't login user.");

    $row mysql_fetch_array($query)
    or die (
    "Error - Couldn't login user.");

    if (!empty(
    $row[username])) // he got it.
    {
    $_SESSION[username] = $row[username];
    echo 
    "Welcome $_POST[username]! You've been successfully logged in.";
    }
    else 
    // bad info.
    {
    echo 
    "Error - Couldn't login user.<br /><br />
    Please try again."
    ;
    }
    }

    ?>
    Hopefully that resolves the issue, and if not, try explaining it to me a little differently

    Oh.. and do you have this posted on the internet?

  6. #5
    laser212's Avatar
    laser212 is offline Newbie
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Re: help plz

    thanx it still not working

    and no it isnt posted yet im building a cheat website il post the address when i open it

    yur welcome to help with some scripts if you want

  7. #6
    Furry Pancake's Avatar
    Furry Pancake is offline Learning Programmer
    Join Date
    Feb 2010
    Location
    Utah
    Posts
    54
    Rep Power
    0

    Re: help plz

    Dammit,
    I will research this when I get on my laptop. It is impossible to work through unless I have access to a server. Haha

  8. #7
    laser212's Avatar
    laser212 is offline Newbie
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Re: help plz

    000webhost.com
    ha ha ha free hosting try it

  9. #8
    Furry Pancake's Avatar
    Furry Pancake is offline Learning Programmer
    Join Date
    Feb 2010
    Location
    Utah
    Posts
    54
    Rep Power
    0

    Re: help plz

    Quote Originally Posted by laser212 View Post
    000webhost.com
    ha ha ha free hosting try it
    Quote for evidince


    is that your website or are you spamming? I think I will report you

  10. #9
    laser212's Avatar
    laser212 is offline Newbie
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Re: help plz

    that just the hosting im using
    my website is cheatsrus.info

  11. #10
    laser212's Avatar
    laser212 is offline Newbie
    Join Date
    Feb 2010
    Posts
    25
    Rep Power
    0

    Re: help plz

    hey all i changed that script with a more complicated and secure script but now im getting a bunch of warnings when the registration is complete

    can someone help ??
    im new to php

    Warning: Missing argument 3 for checkUnique(), called in /home/a3445793/public_html/registration.php on line 16 and defined in /home/a3445793/public_html/functions.php on line 17

    this is my script on line 16 :

    if($_POST['username']!='' && $_POST['password']!='' && $_POST['password']==$_POST['password_confirmed'] && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && checkUnique('Username', $_POST['username'])==TRUE && checkUnique('Email', $_POST['email'])==TRUE)

    and on line 17 :

    function checkUnique($table, $field, $compared)

    next warning :
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a3445793/public_html/functions.php on line 20

    and the script :
    if(mysql_num_rows($query)==0)

    plz help

Closed Thread
Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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