SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: Login Boxes

  1. #1
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Login Boxes

    Hello,


    I was wondering how I could make login boxes for a restricted part of a site.
    Now I have a popup that automatically pops up and checks the .passwords file.

    I would like to have User and Pass boxes in my html.
    Could someone please explain how I could achieve that? And how I could let it check if the entered user & pass are correct?


    Thank you!
    That's all folks...

  2. #2
    SitePoint Wizard maartenvr's Avatar
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    1,679
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can just find a script at like www.hotscripts.com that can do this for you. It just entirely depends on what you want to do. Maybe you need something custom made... Either way, if you want it the way you explained, some programming in involved.
    Maarten

  3. #3
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've searched hotscripts and other resources on the web, including google, but what I failed to find was a clear explanation of what i should do and how i should do it.
    That's why I turned to sitepoint.

    I would like someone explain to me how it works, so I understand, rather than copy and paste some stuff I really have no clue of what it means or does.

    Thx for helping, though.
    That's all folks...

  4. #4
    SitePoint Wizard realestate's Avatar
    Join Date
    May 2004
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably bravenet has tools to do such things.

  5. #5
    SitePoint Wizard maartenvr's Avatar
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    1,679
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could PM me with exactly what you want and I can take a look at what can be done...
    Maarten

  6. #6
    SitePoint Wizard
    Join Date
    Dec 2002
    Location
    New Zealand
    Posts
    1,021
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a page with the following HTML:

    HTML Code:
    <form id="FormName" action="private.php" method="post" name="FormName">
    			<div align="center">
    				<input type="text" name="username" size="24"><br>
    				<input type="password" name="password" size="24"><br>
    				<input type="submit" name="submit" value="Login"></div>
    </form>
    Then create a file called private.php and put it in the same directory. private.php should include the following PHP at the top:
    PHP Code:
        
    session_start
    ();

    $ruser whateverusername;
    $rpass whateverpassword;
    if(
    $username == $ruser && $password == $rpass)
        {
        
    session_register("username");
        
    session_register("password");
        
    ?> 
    Put your HTML under that.

  7. #7
    SitePoint Member TyeJae's Avatar
    Join Date
    Aug 2004
    Location
    Wyoming, Michigan
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have been trying to do this as well, I will try these suggestions...
    TyeJae
    = $244

  8. #8
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by maccrazy
    Create a page with the following HTML:

    HTML Code:
    <form id="FormName" action="private.php" method="post" name="FormName">
    			<div align="center">
    				<input type="text" name="username" size="24"><br>
    				<input type="password" name="password" size="24"><br>
    				<input type="submit" name="submit" value="Login"></div>
    </form>
    Then create a file called private.php and put it in the same directory. private.php should include the following PHP at the top:
    PHP Code:
     
    session_start
    ();
     
    $ruser whateverusername;
    $rpass whateverpassword;
    if(
    $username == $ruser && $password == $rpass)
        {
        
    session_register("username");
        
    session_register("password");
        
    ?> 
    Put your HTML under that.

    So you have to put the acceptable pass and username in private.php?
    And there is no .htaccess document? Or is there?


    Thx for the help so far, maccrazy.
    That's all folks...

  9. #9
    SitePoint Wizard
    Join Date
    Dec 2002
    Location
    New Zealand
    Posts
    1,021
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is correct. There is no .htaccess document. Just change 'whateverusername' and 'whateverpassword' to whatever you want your username and password to be and it should work fine. I just looked over the code I wrote. There should also be an else{} statement below which says something along the lines of 'Wrong username or password' or contains the HTML for the login box.

  10. #10
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by maccrazy
    That is correct. There is no .htaccess document. Just change 'whateverusername' and 'whateverpassword' to whatever you want your username and password to be and it should work fine. I just looked over the code I wrote. There should also be an else{} statement below which says something along the lines of 'Wrong username or password' or contains the HTML for the login box.
    Ok Thx. But how would it work if you wanted to have more and more users? Would that be possible?
    That's all folks...


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
  •