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 13 of 13

Thread: Need Help!

  1. #1
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Help!

    I'm getting ready to make a site where people have to log in, but it's been so long that I don't remember squat about it.

    Basically, all I remember is that it stores login information in a cookie from page to page, and the cookie is set in login.php (or whatever)...but I don't remember how...if someone could help me out here...

    - Have it select the user (defined by the login page) from the db and set it to a global variable
    - Set a cookie with session information, user information, and database information

    That's about all I remember...if someone could be so kind as to help me out I'd appreciate it

    Email: phantom@ionic-rebellion.net
    MSN: phantasmagoria@l33ad.com

    Thanks

  • #2
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, you can do the user authentication in so many ways.

    http://www.zend.com/zend/tut/authentication.php

    Take a look at this tutorial, it helps you.

    cheers

  • #3
    Registered User
    Join Date
    Feb 2003
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Pat User "http://www.php-tools.de" uses sessions to log users in.

    just need MySQL

    Jesh

  • #4
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Chinni - I can do that, it's about the same as using a .htaccess file to protect directories. What I want is a PHP script that uses an HTML form so that when they type in their username and password it logs them in.

    Jesh - I'll check that out

  • #5
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, thats simple.you do have an example in that tutorial where it uses an html form to enter the user details.

    Well, you can do it in so many ways:

    1.do you want to check the user name and password using a flat file or through a table.

    2.Advanced checks using sessions or cookies.

    So, if you want me to write you the simple script, no problem i can do it for you.
    There are scripts in many of the PHP forums, if you cant find it, lemme know so that i can write it for you.

    cheers

  • #6
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you could write me one to work off of it'd be great

    If you could include everything with the cookies/sessions/all that crap, it'd be greatly appreciated

  • #7
    New Coder
    Join Date
    Sep 2002
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, phantom i made a simple script for you.I'm sorry as i could'nt have much time to write it using sessions and cookies.I hope somebody over here could help you.

    Anyways, you can try this now.

    Ps:the following code works for single user.If you need for multi-users, make a user table and check for user name and password and that would work out.It should not be a problem.

    PHP Code:

    <?php 

    $myuser 
    "admin";
    $mypass "password";

    if (
    $user == $myuser && $pass == $mypass)

    {
    //Replace the file name main.php with your file name so that it displays you the file after successfully logged in

    header ('location: main.php');

    }

    else
    {
    echo
    "<form action=\"$PHP_SELF\" method=\"POST\">\n";

    }

    ?>

    <body bgcolor="white" text="black">
    <form name="form1">
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
    </form>
    <form name="form2">
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
        <table align="center" border="1" width="324" bgcolor="#CCCCCC" bordercolordark="black" bordercolorlight="black">
            <tr>
                <td width="314" height="37">
                    <p align="center"><span style="font-size:9pt;"><font face="Verdana">Please enter the user name and the password</font></span></p>
                    <p>&nbsp;&nbsp;<span style="font-size:11pt;">&nbsp;</span><font face="Verdana"><span style="font-size:11pt;">User 
                    name </span>&nbsp;&nbsp;&nbsp;&nbsp;</font>&nbsp;<input type="text" name="user">&nbsp;</p>
                    <p>&nbsp;&nbsp;&nbsp;<span style="font-size:11pt;"><font face="Verdana">Password</font></span> 
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="pass"></p>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="formbutton1" value="Log in" style="font-family:Verdana;"></p>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
                </td>
            </tr>
        </table>
    </form>
    <p>&nbsp;</p>
    </body>

  • #8
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    And by the way "Need Help" is not an appropriate subject/title for your topic.

    Please review our Posting Guidelines before creating any more topics:

    http://www.codingforums.com/postguide.htm
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #9
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts


    And by the way, "fork?", "Help! I need a PHP Expert!", "File". How much different is "Need Help"?
    Last edited by Phantom; 02-17-2003 at 07:31 PM.

  • #10
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by Phantom


    And by the way, "fork?", "Help! I need a PHP Expert!", "File". How much different is "Need Help"?
    Those other subjects/titles are not appropriate either. If you have a problem with our policies you can contact the Administrator WA as he is who instittuted them. Otherwise abide by the policies and you won't have any problems.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #11
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, I'm not going against the policy - very good one to enforce actually. But what I am going against is you singling me out - I didn't see you post in any of the other topics I just pointed out.

  • #12
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by Phantom
    Well, I'm not going against the policy - very good one to enforce actually. But what I am going against is you singling me out - I didn't see you post in any of the other topics I just pointed out.
    I do not single people out. I catch most violations of policies and rules. I don't always have time to respond to every single violation immediately I do not always enforce policies outside the PHP forum as the other forums have their own moderators in charge.

    If you feel you have been wronged you are more than welcome to discuss it with the Administrator. As of right now you are violating our rules:

    http://www.codingforums.com/rules.htm

    Rules 1.1 and 1.5 to be exact.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #13
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    1.1 - How?
    1.5 - Yes, I apologize. I'm done with this topic. Lock it, delete it, whatever.


  •  

    Posting Permissions

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