Example #1
0
                    }
                }
            }
        }
    }
    // END 1 === count($arrUser)
    // No records found for this username & password
    exit(json::encode(array(array('msg', 'Invalid login combination!'))));
} else {
    if (isset($_POST['pwdvergeten'])) {
        $q = db_query("SELECT id,email,password FROM planets WHERE email = '{$_POST['email']}';");
        if (0 < mysql_num_rows($q)) {
            $i = mysql_fetch_assoc($q);
            $newpwd = substr(md5(time()), 0, 12);
            db_query("UPDATE planets SET password ='******'id'] . ':' . $newpwd) . "' WHERE id = " . (int) $i['id'] . ";");
            logbook('pwd_reminder', 'email=' . $i['email'] . '&new=' . $newpwd, (int) $i['id']);
            $gameaddress = str_replace("index.php", "misc.php", $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
            $gamename0 = str_replace("www.", "", $_SERVER['HTTP_HOST']);
            $gamename = "PS " . $gamename0 . " LOGIN";
            $headers = "From: PornStarS PASSWORD <pornstars@" . $gamename0 . ">\r\n";
            $headers .= "Return-Path: <pornstars@" . $gamename0 . ">\r\n";
            $headers .= "X-Sender: <pornstars@" . $gamename0 . ">\r\n";
            $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
            $mailed = mail($i['email'], "PORNSTARS - Forgotten Password", "Your new password: "******"Your password has been sent to \"<b>" . htmlspecialchars($i['email']) . "\"" : "We have failed in sending you your password. Wrong e-mail server";
            $color = $mailed ? "green" : "red";
            Save_Msg($msg, $color);
            Go();
        }
        Save_Msg("Cant find the emailaddress \"<b>" . htmlspecialchars($_POST['email']) . "</b>\"", "red");
        Go();
Example #2
0
function Make_GC($f_iGalaxyId)
{
    $arrGalaxy = db_select('galaxies', 'id = ' . (int) $f_iGalaxyId);
    $arrGalaxy = $arrGalaxy[0];
    $iPlanetsInGalaxy = db_count('planets', 'galaxy_id = ' . (int) $f_iGalaxyId);
    $iVotesNeeded = floor($iPlanetsInGalaxy / 2) + 1;
    $iNewGCPlanetId = (int) db_select_one('planets', 'voted_for_planet_id', 'galaxy_id = ' . (int) $f_iGalaxyId . ' group by voted_for_planet_id having count(1) >= ' . $iVotesNeeded);
    if ($iNewGCPlanetId && $iNewGCPlanetId !== (int) $arrGalaxy['gc_planet_id']) {
        // Enough votes and not the same as before and the planet is in the galaxy
        db_update('galaxies', 'gc_planet_id = ' . (int) $iNewGCPlanetId . ', moc_planet_id = NULL, mow_planet_id = NULL', 'id = ' . (int) $f_iGalaxyId);
        logbook('election', 'galaxy_id=' . $f_iGalaxyId . '&gc=' . $iNewGCPlanetId . '&x=' . $arrGalaxy['x'] . '&y=' . $arrGalaxy['y']);
    } else {
        if (!$iNewGCPlanetId) {
            // No planets has enough votes
            db_update('galaxies', 'gc_planet_id = NULL, moc_planet_id = NULL, mow_planet_id = NULL', 'id = ' . (int) $f_iGalaxyId);
        }
    }
}