summary refs log tree commit diff stats
path: root/includes/functions.php
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2008-12-12 17:42:19 -0500
committerStarla Insigna <hatkirby@fourisland.com>2008-12-12 17:42:19 -0500
commit391f6825d7b5bc986d6529b2a2a4c043555d9f07 (patch)
tree54c36c9673a3c0639ee79828c1d6d6a8fd538428 /includes/functions.php
parentf1577ed1afb1aa65041ba5b6cdd812e2c6085d91 (diff)
downloadfourisland-391f6825d7b5bc986d6529b2a2a4c043555d9f07.tar.gz
fourisland-391f6825d7b5bc986d6529b2a2a4c043555d9f07.tar.bz2
fourisland-391f6825d7b5bc986d6529b2a2a4c043555d9f07.zip
Fixed unique_id overriding
Diffstat (limited to 'includes/functions.php')
-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?>