Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    login .php needed

    I am making a site, and I want to add a "members area" to it. Now, how would i do the following:

    1- Have a .php file to determine if the password and user name are valid and confirmed by me
    and
    2- have various sub sites that can only be accessed through the page where you enter your password.

    thanks a lot to anyone who can help me

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you, that helps me a lot.

  • #4
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, im having a problem with the one for the first link you gave me. for some reason, someoen trys to register, but it just says "database unavailable". i double checked and changed the right info, but it still wont work. any suggestions?

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    One suggestion: Post the non-working part of your code so we can have a look at it. Improves efficiency of helping you, in your interest.

  • #6
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats another problem, its not my script, i downloaded it, and for some reason it wont connect to the database when you try to register.

    EDIT:

    can it be somewhere in this?

    <?php // db.php

    $dbhost = "localhost";
    $dbuser = "username";
    $dbpass = "password";

    function dbConnect($db="") {
    global $dbhost, $dbuser, $dbpass;

    $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
    or die("The site database appears to be down.");

    if ($db!="" and !@mysql_select_db($db))
    die("The site database is unavailable.");

    return $dbcnx;
    }
    ?>

    i am not that good with php, so thats the best i can do(i changed it so it doesnt show my database info.)
    Last edited by relyt; 01-23-2003 at 01:12 AM.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Remove the '@' before the function calls. They are used to suppress error messages, but in your case, you rather want to see a message what's wrong with that code. It looks ok to me - is your database down? The error messages might give you a hint.

  • #8
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no, the database is not down.

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And the error message?

  • #10
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what about it? i dont know why it keeps saying it. that is why i am asking for help.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My bad, removing the error suppressing operator seems not to be sufficient. Try this modified function instead

    PHP Code:
    function dbConnect($db="") { 
        global 
    $dbhost$dbuser$dbpass

        
    $dbcnx = @mysql_connect($dbhost$dbuser$dbpass) or die("The site database appears to be down."); 
        
        if (!
    mysql_select_db($db)) {
            echo 
    mysql_error();
        }
        
        return 
    $dbcnx;

    ...and that should print a more descriptive reason why the selection of the database failed, like 'Unknown database (value of $db)'.

  • #12
    Registered User
    Join Date
    Jan 2003
    Location
    CT
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the help. i actually found a better connection script, ill give ya a link when im finished editing it.

    thanks


  •  

    Posting Permissions

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