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