コード例 #1
0
ファイル: help.php プロジェクト: BruceHad/marslaw-website
<h2 id="info">Page Information</h2>
 <form id="pp" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <fieldset style="border:0;">
   <legend><span class="offset">Donate</span></legend>
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input class="right" type="image" src="http://green-beast.com/gbcf-v3/images/donate.png" name="submit" style="width:200px; height75px" alt="Donate at PayPal" title="Donate at PayPal" />
     <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" alt="" />
    <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYB3zBUZxJFaHKeRQkuYHzPTCk3ID/TlTkyRQxxQk6KbWlbTVnOtt7ZOznzv3G2EYxapoPPnM4W3wRjkT5ao/YdAJ/SB5Zep3DiIyujerh0VvD+wi9eIEwSLvwg4bCq4CZmKjOkcx4bnTVqukbsokjUoH3Qv5ADQjqVFBxts28tQRTELMAkGBSsOAwIaBQAwgdQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI6QUrmmPjmcWAgbD1Ile/pj/ZiguDJUc9mTHhy7iuvXvCWU+Mbwr+rRRj4BYWgfL4booePTmu4VAArInY7+HArQSQksgR9rib1Gxo+dHDZMz51D0OLyjiP8CTec5HCmGAL1Rxo6LRK9lDkqLYv20LKsrUgAV2JASi4OHQRBfl3ydduKerk0qLwnoq9wEcmTX5VfhJkra7RJyyzuSBOXTfQ5hSj8PuSb9x6tm/kbX8iI7s12oWas5Paam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692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA3MTIzMDA3MjY0MlowIwYJKoZIhvcNAQkEMRYEFKvB/mWePibbYVMFMkWqXop87bKtMA0GCSqGSIb3DQEBAQUABIGApVeDhohOTHlutctqiWMRaLTNf5OM9TRvGGhnkPZ72crL65ydaCXIVM37COsIrJ1YhWdZ6ONCzk8wDuEe83ozTkBWvg9+y0pFu6TQfvu/bRZ6yVBVlsdsYwYSB72PJd4ZLYZG6aiYx/SJt3YygZV7zHQ7eSIhahX0Kq7LOKBexWw=-----END PKCS7-----" />
  </fieldset>
 </form>
 <p>On this page you will find helpful answers, about script <a href="#installation">installation</a>, <a href="#configuration">configuration</a>, and <a href="#language">language management</a>. Also get answers to your <a href="#faqs">frequently asked questions</a>. If you find yourself in need of more help, you can check out the <a href="http://green-beast.com/gbcf-v3/help.php">demo site help page</a><?php 
$currentdomain = $_SERVER['HTTP_HOST'];
if ($currentdomain == "green-beast.com") {
    echo ', <span class="error">last updated on ';
    file_update("help.php");
    echo '</span>';
}
?>
. You can also contact <a href="http://green-beast.com/" title="Green-Beast.com">Mike Cherim</a> if all else fails. You may also <a href="http://green-beast.com/blog/?p=238">post a comment</a> on Mike's <a href="http://green-beast.com/blog/">Beast-Blog</a> web log.</p>
<hr />

<h2 id="installation">Script Installation</h2>
 <p>This section will help guide you through the simple installation process. Please note that some <a href="#configuration">configuration</a> is required.</p>
  <ol>
   <li>Unzip and check out the readme file. It is these instructions, repeated. Open the <code>gbcf-v3</code> and <code>files</code> folders to locate the <code>CONFIG.php</code> file.</li>
   <li>Open that file using a text editor like Notepad, Textpad, or a markup editor that won't mess up the scripting. Don't use Word, and Dreamweaver can be dangerous. Some FTP programs can work well, and you may be able to edit the file from within your server admin.</li>
   <li>Enter the first two variables, <code>$send_email</code> and <code>$reply_email</code>, as a minimum. The next two, <code>$addressee</code> and <code>$web_site</code> are a good idea as well. There are many other variables, like language, if needed, display options, and more, but they can wait until the script <?php 
echo $validate_link;
?>
 is done.</li>
コード例 #2
0
function delete_file($req)
{
    $source = source_lookup_auth($req->authenticator);
    if (!$source) {
        error("auth failure");
        return;
    }
    $store = store_lookup_name($req->store_name);
    if (!$store) {
        error("bad store name");
        return;
    }
    $file = file_lookup_name_store($req->name, $store->id);
    if (!$file) {
        error("no such file");
        return;
    }
    $now = time();
    $ret = file_update($file->id, "deleted=1, extract(epoch from deleted_time)={$now}");
    if (!$ret) {
        error(db_error());
        return;
    }
    store_update($store->id, "used = used-{$file->size}");
    echo json_encode(success());
}
コード例 #3
0
ファイル: installer.php プロジェクト: jwest00724/mccodefree
function install()
{
    menuprint('sql');
    $paypal = isset($_POST['paypal']) && valid_email($_POST['paypal']) ? gpc_cleanup($_POST['paypal']) : '';
    $adm_email = isset($_POST['a_email']) && valid_email($_POST['a_email']) ? gpc_cleanup($_POST['a_email']) : '';
    $adm_username = isset($_POST['a_username']) && strlen($_POST['a_username']) > 3 ? gpc_cleanup($_POST['a_username']) : '';
    $adm_gender = isset($_POST['gender']) && in_array($_POST['gender'], array('Male', 'Female'), true) ? $_POST['gender'] : 'Male';
    $description = isset($_POST['game_description']) ? gpc_cleanup($_POST['game_description']) : '';
    $owner = isset($_POST['game_owner']) && strlen($_POST['game_owner']) > 3 ? gpc_cleanup($_POST['game_owner']) : '';
    $game_name = isset($_POST['game_name']) ? gpc_cleanup($_POST['game_name']) : '';
    $adm_pswd = isset($_POST['a_password']) && strlen($_POST['a_password']) > 3 ? gpc_cleanup($_POST['a_password']) : '';
    $adm_cpswd = isset($_POST['a_cpassword']) ? gpc_cleanup($_POST['a_cpassword']) : '';
    $db_hostname = isset($_POST['hostname']) ? gpc_cleanup($_POST['hostname']) : '';
    $db_username = isset($_POST['username']) ? gpc_cleanup($_POST['username']) : '';
    $db_password = isset($_POST['password']) ? gpc_cleanup($_POST['password']) : '';
    $db_database = isset($_POST['database']) ? gpc_cleanup($_POST['database']) : '';
    $errors = array();
    if (empty($db_hostname)) {
        $errors[] = 'No Database hostname specified';
    }
    if (empty($db_username)) {
        $errors[] = 'No Database username specified';
    }
    if (empty($db_database)) {
        $errors[] = 'No Database database specified';
    }
    if (empty($adm_username) || !preg_match("/^[a-z0-9_]+([\\s]{1}[a-z0-9_]|[a-z0-9_])+\$/i", $adm_username)) {
        $errors[] = 'Invalid admin username specified';
    }
    if (empty($adm_pswd)) {
        $errors[] = 'Invalid admin password specified';
    }
    if ($adm_pswd !== $adm_cpswd) {
        $errors[] = 'The admin passwords did not match';
    }
    if (empty($adm_email)) {
        $errors[] = 'Invalid admin email specified';
    }
    if (empty($owner) || !preg_match("/^[a-z0-9_]+([\\s]{1}[a-z0-9_]|[a-z0-9_])+\$/i", $owner)) {
        $errors[] = 'Invalid game owner specified';
    }
    if (empty($game_name)) {
        $errors[] = 'Invalid game name specified';
    }
    if (empty($description)) {
        $errors[] = 'Invalid game description specified';
    }
    if (empty($paypal)) {
        $errors[] = 'Invalid game PayPal specified';
    }
    if (count($errors) > 0) {
        echo "Installation failed.<br />\n        There were one or more problems with your input.<br />\n        <br />\n        <b>Problem(s) encountered:</b>\n        <ul>";
        foreach ($errors as $error) {
            echo "<li><span style='color: red;'>{$error}</span></li>";
        }
        echo "</ul>\n        &gt; <a href='installer.php?code=config'>Go back to config</a>";
        require_once 'installer_foot.php';
        exit;
    }
    // Try to establish DB connection first...
    echo 'Attempting DB connection...<br />';
    $c = mysql_connect($db_hostname, $db_username, $db_password);
    mysql_select_db($db_database, $c);
    // Done, move on
    echo '... Successful.<br />';
    echo 'Writing game config file...<br />';
    echo 'Write DB Connector...<br />';
    $code = md5(rand(1, 100000000000));
    if (file_exists("mysql.php")) {
        unlink("mysql.php");
    }
    $e_db_hostname = addslashes($db_hostname);
    $e_db_username = addslashes($db_username);
    $e_db_password = addslashes($db_password);
    $e_db_database = addslashes($db_database);
    $config_file = <<<EOF
<?php
\$c = mysql_connect('{$e_db_hostname}', '{$e_db_username}', '{$e_db_password}') or die(mysql_error());
mysql_select_db('{$e_db_database}', \$c);
EOF;
    $f = fopen('mysql.php', 'w');
    fwrite($f, $config_file);
    fclose($f);
    echo '... file written.<br />';
    echo 'Writing base database schema...<br />';
    $fo = fopen("dbdata.sql", "r");
    $query = '';
    $lines = explode("\n", fread($fo, 1024768));
    fclose($fo);
    foreach ($lines as $line) {
        if (!(strpos($line, "--") === 0) && trim($line) != '') {
            $query .= $line;
            if (!(strpos($line, ";") === FALSE)) {
                mysql_query($query);
                $query = '';
            }
        }
    }
    echo '... done.<br />';
    echo 'Writing game configuration...<br />';
    $ins_username = mysql_real_escape_string(htmlentities($adm_username, ENT_QUOTES, 'ISO-8859-1'), $c);
    $salt = generate_pass_salt();
    $e_salt = mysql_real_escape_string($salt, $c);
    $encpsw = encode_password($adm_pswd, $salt);
    $e_encpsw = mysql_real_escape_string($encpsw, $c);
    $ins_email = mysql_real_escape_string($adm_email, $c);
    $IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR'], $c);
    $ins_game_name = htmlentities($game_name, ENT_QUOTES, 'ISO-8859-1');
    $ins_game_desc = nl2br(htmlentities($description, ENT_QUOTES, 'ISO-8859-1'));
    $ins_game_owner = htmlentities($owner, ENT_QUOTES, 'ISO-8859-1');
    $ins_game_id1name = htmlentities($adm_username, ENT_QUOTES, 'ISO-8859-1');
    mysql_query("INSERT INTO `users`\n             (`username`, `login_name`, `userpass`, `level`, `money`,\n             `crystals`, `donatordays`, `user_level`, `energy`, `maxenergy`,\n             `will`, `maxwill`, `brave`, `maxbrave`, `hp`, `maxhp`, `location`,\n             `gender`, `signedup`, `email`, `bankmoney`, `lastip`,\n             `pass_salt`)\n             VALUES ('{$ins_username}', '{$ins_username}', '{$e_encpsw}', 1,\n             100, 0, 0, 2, 12, 12, 100, 100, 5, 5, 100, 100, 1,\n             '{$adm_gender}', " . time() . ", '{$ins_email}', -1, '{$IP}',\n             '{$e_salt}')", $c) or die(mysql_error());
    $i = mysql_insert_id($c);
    mysql_query("INSERT INTO `userstats`\n    \t\t VALUES({$i}, 10, 10, 10, 10, 10)", $c);
    $gamename_files = array('authenticate.php', 'donator.php', 'explore.php', 'gamerules.php', 'header.php', 'helptutorial.php', 'loggedin.php', 'login.php', 'new_staff.php', 'register.php', 'voting.php');
    $gameowner_files = array('header.php', 'login.php');
    $paypal_files = array('donator.php', 'willpotion.php');
    $gamedesc_files = array('login.php');
    $id1_files = array('gamerules.php');
    $cron_files = array('crons/cron_day.php', 'crons/cron_fivemins.php', 'crons/cron_hour.php', 'crons/cron_minute.php');
    foreach ($gamename_files as $file) {
        file_update($file, '{GAME_NAME}', $ins_game_name);
    }
    foreach ($gameowner_files as $file) {
        file_update($file, '{GAME_OWNER}', $ins_game_owner);
    }
    foreach ($paypal_files as $file) {
        file_update($file, '{PAYPAL}', $paypal);
    }
    foreach ($gamedesc_files as $file) {
        file_update($file, '{GAME_DESCRIPTION}', $ins_game_desc);
    }
    foreach ($id1_files as $file) {
        file_update($file, '{ID1_NAME}', $ins_game_id1name);
    }
    foreach ($cron_files as $file) {
        file_update($file, '{CRON_CODE}', $code);
    }
    echo '... Done.<br />';
    $path = dirname($_SERVER['SCRIPT_FILENAME']);
    echo "\n    <h2>Installation Complete!</h2>\n    <hr />\n    <h3>Cron Info</h3>\n    <br />\n    This is the cron info you need for section <b>1.2 Cronjobs</b> of the installation instructions.<br />\n    <pre>\n    */5 * * * * php {$path}/crons/cron_fivemins.php {$code}\n    * * * * * php {$path}/crons/cron_minute.php {$code}\n    0 * * * * php {$path}/crons/cron_hour.php {$code}\n    0 0 * * * php {$path}/crons/cron_day.php {$code}\n    </pre>\n       ";
    echo "<h3>Installer Security</h3>\n    Attempting to remove installer... ";
    @unlink('./installer.php');
    $success = !file_exists('./installer.php');
    echo "<span style='color: " . ($success ? "green;'>Succeeded" : "red;'>Failed") . "</span><br />";
    if (!$success) {
        echo "Attempting to lock installer... ";
        @touch('./installer.lock');
        $success2 = file_exists('installer.lock');
        echo "<span style='color: " . ($success2 ? "green;'>Succeeded" : "red;'>Failed") . "</span><br />";
        if ($success2) {
            echo "<span style='font-weight: bold;'>" . "You should now remove dbdata.sql, installer.php, installer_foot.php and installer_home.php from your server." . "</span>";
        } else {
            echo "<span style='font-weight: bold; font-size: 20pt;'>" . "YOU MUST REMOVE dbdata.sql, installer.php, " . "installer_foot.php and installer_home.php from your server.<br />" . "Failing to do so will allow other people " . "to run the installer again and potentially " . "mess up your game entirely." . "</span>";
        }
    } else {
        require_once 'installer_foot.php';
        @unlink('./installer_head.php');
        @unlink('./installer_foot.php');
        @unlink('./dbdata.sql');
        exit;
    }
}