LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-04-2003, 04:21 PM   #1
CurlyMo
LQ Newbie
 
Registered: Feb 2003
Posts: 26

Rep: Reputation: 15
How to get date in guestbook (php)


I have a php guestbook and i want to record the date and time that a user is posting. I came this far:

$date_format = date("d-m-'y G:i");
if ($Pointer) {
fwrite ($Pointer, "<?PHP\n");
fwrite ($Pointer, "\$id = $id;\n\$pg = $pg;\n");
for ($indx = 1; $indx <= $id; $indx++) {
if ($e["$indx"]["n"]) {
$e["$indx"]["n"] = ereg_replace("\\\'","'",$e["$indx"]["n"]);
$e["$indx"]["n"] = ereg_replace("\\\"",""",$e["$indx"]["n"]);
fwrite ($Pointer, "\$e[\"$indx\"][\"n\"] = \"{$e["$indx"]["n"]}\";\n");
}
if ($e["$indx"]["m"]) {
fwrite ($Pointer, "\$e[\"$indx\"][\"m\"] = \"{$e["$indx"]["m"]}\";\n");
}
{
fwrite ($Pointer, "\$e[\"$indx\"][\"d\"] = \"{$e["$indx"]["$date_format"]}\";\n");
}
if ($e["$indx"]["c"]) {
$e["$indx"]["c"] = ereg_replace("\\\'","'",$e["$indx"]["c"]);
$e["$indx"]["c"] = ereg_replace("\\\"",""",$e["$indx"]["c"]);
fwrite ($Pointer, "\$e[\"$indx\"][\"c\"] = \"{$e["$indx"]["c"]}\";\n");
}
}
fwrite ($Pointer, "?>");

The letters N/M/C are Name/Mail/Comments these three things are recorded in my data file but the D leaves only this:

$e["1"]["n"] = "CurlyMo";
$e["1"]["m"] = "nobody@hotmail.com";
$e["1"]["d"] = "";
$e["1"]["c"] = "test";

// Edit crabboy: Changed email address at Ops request.

Last edited by crabboy; 03-07-2013 at 03:15 PM.
 
Old 02-10-2003, 06:32 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
http://www.php.net/manual/en/function.strftime.php
i guess that's what u need
cheers, jens
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Guestbook Linuxidiot Programming 1 04-17-2005 09:53 AM
php guestbook Boby Programming 3 06-21-2004 01:58 PM
Get the date on PHP and insert it into SQL poeta_boy Programming 4 11-26-2003 03:25 AM
PHP date functions cmfarley19 Programming 1 10-17-2003 08:58 AM
php date compare omarswan Programming 2 10-02-2002 04:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration