Log username and password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dridia
    New Member
    • Apr 2012
    • 3

    Log username and password

    Hi! I'm looking for a script to keep track of players password and usernames. Simply, keep track of information that enters into a textbox. I've tried to make it work for about 1 week now, but i really can't find anything. I'm new to php but i know the bases of PHP.
    I would appreciate if someone could help me with this!!
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    Why not post the code you have so far?
    If you know 'some' PHP, it cannot be SO BAD that you are afraid to post it....

    BTW, its not the website that is responsible for keeping track of passwords. A website only has to validate if the password is correct.

    Comment

    • dridia
      New Member
      • Apr 2012
      • 3

      #3
      I mean, when you enter something in the two textboxes and hit a button it will create another HTML page like "log.htm" and when you enter that website you will be able to see what the person writed.

      Comment

      • Luuk
        Recognized Expert Top Contributor
        • Mar 2012
        • 1043

        #4
        a very simple, but straightforward example is here http://www.php.net/manual/en/tutorial.forms.php
        This gives an example of how to enter name and age, and how to display this on another page.

        If you understand how to do that, you can go a step further to learn hoe to store the info in some database, and retreive it for later reviewing....

        Comment

        • dridia
          New Member
          • Apr 2012
          • 3

          #5
          I Got it working!
          The "index.php" code
          Code:
          <form action="log.php" method="post">
           <p>username<input type="text" name="name" /></p>
           <p>password<input type="text" name="age" /></p>
           <p><input type="submit" /></p>
          </form>
          and for "log.php"
          Code:
          <?php
          
          	$name = $_POST['name'];
          	$age = $_POST['age'];
          	$file = "log-information.htm";
          	$open = fopen($file, "a+");		
          	fwrite($open, "<b>name</b> " .$name . "<br/>"); 
          	fwrite($open, "<b>age</b>". $age . "<br/>");
          	fclose($open);	
          ?>

          Comment

          • Luuk
            Recognized Expert Top Contributor
            • Mar 2012
            • 1043

            #6
            i would add this line of code after line 9:
            Code:
            header('Location: log-information.htm');
            Becasue in you examle the user will see a blank page when sibmitting, with this line he will be redirected to the log-information page

            Comment

            Working...