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.
|