By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

Log username and password

P: 3
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!!
Apr 8 '12 #1
Share this Question
Share on Google+
5 Replies


Expert 100+
P: 1,031
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.
Apr 8 '12 #2

P: 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.
Apr 8 '12 #3

Expert 100+
P: 1,031
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....
Apr 8 '12 #4

P: 3
I Got it working!
The "index.php" code
Expand|Select|Wrap|Line Numbers
  1. <form action="log.php" method="post">
  2.  <p>username<input type="text" name="name" /></p>
  3.  <p>password<input type="text" name="age" /></p>
  4.  <p><input type="submit" /></p>
  5. </form>
and for "log.php"
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.     $name = $_POST['name'];
  4.     $age = $_POST['age'];
  5.     $file = "log-information.htm";
  6.     $open = fopen($file, "a+");        
  7.     fwrite($open, "<b>name</b> " .$name . "<br/>"); 
  8.     fwrite($open, "<b>age</b>". $age . "<br/>");
  9.     fclose($open);    
  10. ?>
Apr 8 '12 #5

Expert 100+
P: 1,031
i would add this line of code after line 9:
Expand|Select|Wrap|Line Numbers
  1. 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
Apr 9 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.