09-04-2011, 06:12 AM
09-04-2011, 07:00 AM
And the time aswell, but still need to sort that out.
09-04-2011, 07:10 AM
(09-04-2011, 07:00 AM)BreShiE Wrote: [ -> ]And the time aswell, but still need to sort that out.
You're not going to be able to accurately get the time for each user using PHP. Not without having them tell you their timezone, at least.
JavaScript might work, though.
09-04-2011, 12:17 PM
Actually, The time() function in PHP grabs the time of the server it is hosted on. In this case, it is showing 3:15 pm for me because the server is hosted in the eastern time zone while I am in the Central time zone. It is a good start to learn PHP.
Getting the persons IP address is also quite simple. 2 Lines of code can simple get your IP address and display it:
Basic as that. But i do like the skull head btw
Getting the persons IP address is also quite simple. 2 Lines of code can simple get your IP address and display it:
Code:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
?>
Basic as that. But i do like the skull head btw
09-04-2011, 01:37 PM
(09-04-2011, 12:17 PM)FritoBandito Wrote: [ -> ]Actually, The time() function in PHP grabs the time of the server it is hosted on. In this case, it is showing 3:15 pm for me because the server is hosted in the eastern time zone while I am in the Central time zone. It is a good start to learn PHP.
Getting the persons IP address is also quite simple. 2 Lines of code can simple get your IP address and display it:
Code:<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
?>
Basic as that. But i do like the skull head btw
The "skull head" is the troll face, how didn't you know that?
Also you can cut that down to one line as I did.
PHP Code:
<?php
echo $_SERVER['REMOTE_ADDR'];
?>
09-04-2011, 01:41 PM
You should make the clock count by the seconds. Instead of having to refresh the page to see the time change.
09-04-2011, 01:50 PM
(09-04-2011, 01:37 PM)BreShiE Wrote: [ -> ]The "skull head" is the troll face, how didn't you know that?
lol my bad. Wasn't paying that much attention...
And that works too, but what if you want to use the $ip variable later on? :O. Like....to make a logger on who comes on your website.
(09-04-2011, 01:41 PM)alabama Wrote: [ -> ]You should make the clock count by the seconds. Instead of having to refresh the page to see the time change.
Or use javascript .
09-04-2011, 04:23 PM
(09-04-2011, 01:50 PM)FritoBandito Wrote: [ -> ]lol my bad. Wasn't paying that much attention...
And that works too, but what if you want to use the $ip variable later on? :O. Like....to make a logger on who comes on your website.
Then you can still use $_SERVER['REMOTE_ADDR']
;)
09-04-2011, 05:13 PM
Really simple.
I'm learning PHP and this is similar to my first project.
I made an IP logging script which added it to a mysql database.
I'm learning PHP and this is similar to my first project.
I made an IP logging script which added it to a mysql database.
09-04-2011, 05:18 PM
(09-04-2011, 05:13 PM).edit Wrote: [ -> ]Really simple.
I'm learning PHP and this is similar to my first project.
I made an IP logging script which added it to a mysql database.
I think everyone starts with an IP logging script. Not a bad thing, really; if you make a half-decent one, you can learn quite a bit.