For the start, I'm using mysql, you can change into your DBE(Database Engine) U use right now! the table contain:
- id. Primary key (Integer)
- ip. index (char)this is for log purpose
- time. unique(datetime or timestamp) is better autoupdate then input it
for the ip, we using variable $_SERVER['REMOTE_ADDR']
for time, I rather using timestamp because it have auto update time. So you don't need to type now() actualy. The number I have then using with other table like user, then if you want to know when the user created, just peek on this. You will have IP created the user and what time the user created. This log can be used and integrated with log!!<?php function newId() { /* view the last value */ $s='select id from my_id order by desc limit 1'; $q=mysql_query($s); $r=mysql_fetch_array($q); $id=$r[0]+1; /* view the last value */ $s="insert into `my_id` values($id,'$_SERVER['REMOTE_ADDR']',now())"; $q=mysql_query($s); return $id; }
Tidak ada komentar:
Posting Komentar