+ Reply to Thread
Results 1 to 8 of 8

Thread: How do I keep...

  1. #1
    salukigirl is offline x10Hosting Member salukigirl is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    78

    Question How do I keep...

    How do I keep my verify script from letting users get to the registration page? It won't let them to it because they are not logged in. But they can't log in if they cannot create an account...
    PHP Code:
    <?php

    session_start
    ();

    include(
    "sql_connect.php");

    $username $_POST['username'];
    $password $_POST['password'];

    if ( ! isset( 
    $username ) )
    {
    die(
    'You must enter in a username.');
    }

    if ( ! isset( 
    $password ) )
    {
    die(
    'You must enter in a password.');
    }

    $user_query mysql_query("SELECT * FROM user WHERE username='".$username."'");
    $num_users mysql_num_rows$user_query );

    if ( 
    $num_users == )
    {
    die(
    'User does not exist.');
    }
    else
    {
    while ( 
    $user mysql_fetch_array$user_query ) )
    {
    if ( 
    $password == $user["password"] )
    {
    session_register("loggedIn");
    session_register("username");

    $_SESSION['loggedIn'] = true;
    $_SESSION['username'] = $username;

    echo 
    '<meta http-equiv="refresh" content="3; URL=user.php" />';
    echo 
    'You have successfully logged in as '.$username.'<br />';
    echo 
    'Redirecting to the user page';
    }
    else
    {
    echo 
    'Password does not match.';
    }
    }
    }

    ?>

  2. #2
    The_Magistrate's Avatar
    The_Magistrate is offline x10 Elder The_Magistrate is an unknown quantity at this point
    Join Date
    May 2005
    Location
    PA
    Posts
    559

    Re: How do I keep...

    I'm not sure what you're asking. Do you want people to not be able to access the registration page or not? Putting the registration page behind an authentication page is pointless as you already pointed out.

    If you're talking about not letting users register at all, simply modify the registration page to not allow users to enter and submit information.

    The code snippet you submitted is part of the authentication system, and not the registration system. The code you have above has some security issues in it, but that's another problem.
    Getting Started | Terms of Service | Paid Hosting | Forum Rules | Free Server Status | Banned Countries

    If I have helped you through one of my posts, please click the
    blue checkbox on the right below my avatar to add to my reputation.

  3. #3
    jayant is offline x10Hosting Member jayant is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    6

    Re: How do I keep...

    Your question is not clear. please explain it technically.
    May i can help you
    :happysad:

  4. #4
    salukigirl is offline x10Hosting Member salukigirl is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    78

    Re: How do I keep...

    Sorry. On my front page there is a place where players can register. But when they click the are stopped by the verify script. I don't know why. I didn't put it in my front page or registration page. It only happens when they click the button, if you put/register.php at the end of my url the verify thing like isn't there or something...

  5. #5
    The_Magistrate's Avatar
    The_Magistrate is offline x10 Elder The_Magistrate is an unknown quantity at this point
    Join Date
    May 2005
    Location
    PA
    Posts
    559

    Re: How do I keep...

    What is the URL to your site? Are you using a Content Management System? If so, do you accidentally have it set to not allow public registration?
    Getting Started | Terms of Service | Paid Hosting | Forum Rules | Free Server Status | Banned Countries

    If I have helped you through one of my posts, please click the
    blue checkbox on the right below my avatar to add to my reputation.

  6. #6
    salukigirl is offline x10Hosting Member salukigirl is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    78

    Re: How do I keep...

    It is www.furryfriends.elementfx.com/index.php

    I don't know how that could have happened if that is the case...

  7. #7
    The_Magistrate's Avatar
    The_Magistrate is offline x10 Elder The_Magistrate is an unknown quantity at this point
    Join Date
    May 2005
    Location
    PA
    Posts
    559

    Re: How do I keep...

    You are using a form button to forward users to the registration page. This button is part of the login page. The problem that you're seeing is correct for the way you have the site setup.

    You may want to remove the 'Register' button and make it a link instead. Use this:

    <a href="http://furryfriends.elementfx.com/register.php" title="Click here to Register">Register!</a>

    Detailed explanation: The register button you have on the site now will perform the action on the form before the action on the button. That is why the authentication script is being run and not the register script.
    Getting Started | Terms of Service | Paid Hosting | Forum Rules | Free Server Status | Banned Countries

    If I have helped you through one of my posts, please click the
    blue checkbox on the right below my avatar to add to my reputation.

  8. #8
    salukigirl is offline x10Hosting Member salukigirl is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    78

    Re: How do I keep...

    Oh thanks so much!

+ Reply to 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
x10hosting free hosting for the masses
dedicated servers