Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mini PHP Project
#11
Just reads the IP address and source I came from??
Anyway, at least the song is pretty Tongue
[Image: di-0ECG.png]
Reply
#12
And the time aswell, but still need to sort that out.
Reply
#13
(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.
[Image: TYzKF.png]
Reply
#14
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 Big Grin
Reply
#15
(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 Big Grin

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'];

?>
Reply
#16
You should make the clock count by the seconds. Instead of having to refresh the page to see the time change.
[Image: 2.png]
Reply
#17
(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. Tongue

(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 Tongue.
Reply
#18
(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. Tongue

Then you can still use $_SERVER['REMOTE_ADDR']

;)
[Image: TYzKF.png]
Reply
#19
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.
Reply
#20
(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.
[Image: TYzKF.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 941 07-27-2020, 11:26 PM
Last Post: tk-hassan
  My PHP Project, V.03 [UPDATE] ChromeWolf 3 1,145 11-17-2011, 12:59 PM
Last Post: HF~Legend
  PHP Video Tutorials (PHP For Beginners) Eleqtriq 4 3,668 10-10-2011, 01:00 PM
Last Post: Greyersting
  PHP Forum Software Project Saint Michael 1 995 12-12-2010, 10:01 PM
Last Post: Saint Michael

Forum Jump:


Users browsing this thread: 9 Guest(s)