????
Current Path : /home2/morganrand/backup.morganrand.com/ |
Current File : /home2/morganrand/backup.morganrand.com/new25a.php |
<?php // ** MySQL settings ** // define('DB_NAME', 'db11634_common'); // The name of the database define('DB_USER', 'db11634_common'); // Your MySQL username define('DB_PASSWORD', 'fj5RV753nZ'); // ...and password define('DB_HOST', 'internal-db.s11634.gridserver.com'); // 99% chance you won't need to change this value define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); $password_length = 6; function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } srand(make_seed()); $alfa = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"; $token = ""; for($i = 0; $i < $password_length; $i ++) { $token .= $alfa[rand(0, strlen($alfa))]; } mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(mysql_error()); // echo "Connected to MySQL<br />"; mysql_select_db(DB_NAME) or die(mysql_error()); // echo "Connected to Database<br />"; $now = time(); $room = "0"; $result = mysql_query("SELECT * FROM design_room") or die(mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC) ) { if ($now - $row['last_login_php'] > 3600) { //echo $row['room_num']; //echo $row['last_login_php']."\n"; $room = $row['room_num']; break; } } if ($room != "0") { mysql_free_result($result); $result = mysql_query("UPDATE design_room SET last_login_php='" . $now . "', password='" . $token . "' WHERE room_num='" . $room . "'") or die(mysql_error()); echo $token; } echo $room; ?>