diff options
Diffstat (limited to 'includes/functions.php')
-rwxr-xr-x | includes/functions.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/includes/functions.php b/includes/functions.php index 73a6e17..64628a5 100755 --- a/includes/functions.php +++ b/includes/functions.php | |||
@@ -251,4 +251,33 @@ function removeTags($id, $type = 'published') | |||
251 | $deltags2 = mysql_query($deltags); | 251 | $deltags2 = mysql_query($deltags); |
252 | } | 252 | } |
253 | 253 | ||
254 | function unique_id() | ||
255 | { | ||
256 | static $dss_seeded = false; | ||
257 | |||
258 | $getconfig = "SELECT * FROM config WHERE name = \"rand_seed\""; | ||
259 | $getconfig2 = mysql_query($getconfig); | ||
260 | $getconfig3 = mysql_fetch_array($getconfig2); | ||
261 | |||
262 | $val = $getconfig3['value'] . microtime(); | ||
263 | $val = md5($val); | ||
264 | $rand_seed = md5($getconfig3['value'] . $val . $extra); | ||
265 | |||
266 | $getconfig = "SELECT * FROM config WHERE name = \"rand_seed_last_update\""; | ||
267 | $getconfig2 = mysql_query($getconfig); | ||
268 | $getconfig3 = mysql_fetch_array($getconfig2); | ||
269 | if ($dss_seeded !== true && ($getconfig3['value'] < time() - rand(1,10))) | ||
270 | { | ||
271 | $setconfig = "UPDATE config SET value = \"" . $rand_seed . "\" WHERE name = \"rand_seed\""; | ||
272 | $setconfig2 = mysql_query($setconfig); | ||
273 | |||
274 | $setconfig = "UPDATE config SET value = \"" . time() . "\" WHERE name = \"rand_seed_last_update\""; | ||
275 | $setconfig2 = mysql_query($setconfig); | ||
276 | |||
277 | $dss_seeded = true; | ||
278 | } | ||
279 | |||
280 | return substr($val, 4, 16); | ||
281 | } | ||
282 | |||
254 | ?> | 283 | ?> |