Exemple #1
0
         } else {
             copy("../config.php", "../config.php.bak");
             //Create a backup of the current config file
             $newconfig = "<?php\r\n/*************************************/\r\n/*           ezRPG script            */\r\n/*         Written by Zeggy          */\r\n/*    http://ezrpg.bbgamezone.com    */\r\n/*************************************/\r\n\r\n\$config_server = \"" . $_POST['config_server'] . "\"; //Database host\r\n\$config_database = \"" . $_POST['config_database'] . "\"; //Database name\r\n\$config_username = \"" . $_POST['config_username'] . "\"; //Database username\r\n\$config_password = \"" . $_POST['config_password'] . "\"; //Database password\r\n\$secret_key = \"" . $_POST['secret_key'] . "\"; //Secret key, make it a random word/sentence/whatever\r\n\r\n\$config_language = \"" . $_POST['config_language'] . "\"; //Language of the game\r\n\$config_name = \"" . $_POST['config_name'] . "\"; //Name of your game\r\n\r\n//Do not edit below this line\r\n\r\n\$version = \"" . $version . "\";";
             $newconfig .= "?";
             $newconfig .= ">";
             if (!($handle = fopen("../config.php", 'w'))) {
                 include "./header.php";
                 echo "Cannot open config.php.<br />\nPlease check the file permissions are 0755.";
                 include "./footer.php";
                 break;
             }
             fwrite($handle, $newconfig);
             fclose($handle);
             $logmsg = "<a href=\"users.php?id=" . $player->username . "\">" . $player->username . "</a> changed the game configuration file. (IP " . $ip . ")";
             gmlog($logmsg, $db);
             header("Location: config.php");
             break;
         }
     }
     break;
 default:
     include "./header.php";
     if (!is_writable("../config.php")) {
         $noedit = " disabled=\"disabled\"";
         echo "<b>config.php can't be edited!</b><br />\n";
         echo "Please change the file permissions to 0755. They are currently " . $perms . ".<br />\n";
         echo "This can be done from your FTP client, or from within your file manager.<br />\n";
         echo "<br /><hr width=\"80%\" /><br />";
     }
     echo "Here you can edit your game configuration settings, but it is recommended to leave them alone!<br /><br />\n";
        if (!$query) {
            $could_not_register = $lang['error_register'] . "<br /><br />";
            $logmsg = "IP " . $ip . " attempted to register, but an error occurred.";
            errorlog($logmsg, $db);
        } else {
            $insertid = $db->Insert_ID();
            //If IP logging is enabled for registration
            if ($config_register_multis == 1) {
                $query2 = $db->execute("select `username` from `players` where `ip`=? or `last_ip`=?", array($ip, $ip));
                if ($query2->recordcount() > 0) {
                    $multis = "The following users have registered with the same IP (" . $ip . "): <br />";
                    while ($multi = $query2->fetchrow()) {
                        $multis .= "<a href=\"users.php?id=" . $multi['username'] . "\">" . $multi['username'] . "</a> | ";
                    }
                }
                gmlog($multis, $db);
            }
            include "templates/header.php";
            echo $lang['msg_registered'];
            include "templates/footer.php";
            exit;
        }
    }
}
$msg1 .= "</font>";
//Username error?
$msg2 .= "</font>";
//Password error?
$msg3 .= "</font>";
//Verify Password error?
$msg4 .= "</font>";