Skip to content

Commit

Permalink
Redirect function simplified
Browse files Browse the repository at this point in the history
Simplified redirect function and commented most of the functions
  • Loading branch information
darksoke committed May 21, 2017
1 parent 6a6c425 commit c34f684
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 24 deletions.
11 changes: 10 additions & 1 deletion engine/config/global.php
Expand Up @@ -21,23 +21,32 @@ function date_string($dateint, $format = "Y-m-d H:i:s"){
}
function encrypt($username, $password)
{
//encryption method for passwords
$password = sha1(strtoupper($username) . ":" . strtoupper($password));
$password = strtoupper($password);
return $password;
}
function logout()
{
//log out function for website
session_unset();
redirect("index");
}
function redirect($url){
echo "<script type='text/javascript'>window.location.href = '".$url."'</script>";
//redirect to a specified path
$mainPath = $_SERVER['REQUEST_URI'];
$url = "Location: {$mainPath}{$url}";
header($url);
}
function get_countries_list(){
//return countries strings list from countries table
//establish a database connection and prepare the sql query
global $database;
$con = connect($database['web_db']);
$sql = "SELECT * FROM `countries`";
$countries = array();

//execute the query and return the countries list
if ($stmt = $con->prepare($sql)){
$stmt->execute();
$result = $stmt->get_result();
Expand Down
11 changes: 8 additions & 3 deletions engine/config/strings.php
@@ -1,5 +1,6 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
function rank_string($rank){
//return player's rank string based on his rank id
switch($rank){
case 0: return "Player"; break;
case 4: return "V.I.P"; break;
Expand All @@ -17,6 +18,7 @@ function rank_string($rank){
}
}
function char_name_color($class){
//return class specific color for character names
switch ($class)
{
case 6: return "C41F3B";break;
Expand All @@ -32,6 +34,7 @@ function char_name_color($class){
}
}
function class_strings($class){
//return character class string based on class id
switch($class){
case 1: return 'Warrior'; break;
case 2: return 'Paladin'; break;
Expand All @@ -47,6 +50,7 @@ function class_strings($class){
}

function race_strings($race){
//return character race string based on character race id
switch($race){
case 1: return 'Human'; break;
case 2: return 'Orc'; break;
Expand All @@ -63,10 +67,11 @@ function race_strings($race){
}
}
function rank_color($username,$rank,$icon = 0){
//return player name color based on curent rank |deprecated and need rewrite|
$color = '#FFFFFF';
if ($icon == 0) {
$icon = '<img class="avatar-name" src="style/images/staff.png" alt="Staff Icon"/>';
$vip = '<img class="avatar-name" src="style/images/vip.png" alt="Vip Icon"/>';
$icon = '<img class="avatar-name" src="style/images/icons/staff.png" alt="Staff Icon"/>';
$vip = '<img class="avatar-name" src="style/images/icons/vip.png" alt="Vip Icon"/>';
}
else{
$icon = '';
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/account_engine.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
class Account {
public $account = array();
function __construct(&$username){
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/bb_functions.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
class BbParser {

private $find = array(
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/login_engine.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");

class Login {
public $login_errors = array();
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/logs_functions.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");

class Logger{
function clearLogs($log){
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/mailing_functions.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
class Mailing{
function sendInbox($from, $to, $subject, $body){
global $database;
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/news_engine.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
class News{
public $news = array(), $news_errors = array();
function __construct(){
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/ra_functions.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
class RemoteAccess
{
public $errors = array();
Expand Down
2 changes: 1 addition & 1 deletion engine/functions/register_engine.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../../');
<?php if (!defined("DARKCORECMS")) redirect("../../");
class Registration{
public $registration_errors = array();
function register_user($username,$_new_password,$re_password,$email,$re_email,$country,$age,$foundus,$robot1,$total = 0,$robot2,$checktext = NULL){
Expand Down
2 changes: 1 addition & 1 deletion pages/armory.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS")) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "This module is under development" ?></label>
Expand Down
2 changes: 1 addition & 1 deletion pages/donate.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS")) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "This module is under development" ?></label>
Expand Down
2 changes: 1 addition & 1 deletion pages/forum.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS")) redirect("../"); ?>
<div id="notify">Builtin forum module is not coded yet</div>
<?php /* <div id='content'>
<div id="forum-left">
Expand Down
2 changes: 1 addition & 1 deletion pages/guides.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS")) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "This module is under development" ?></label>
Expand Down
2 changes: 1 addition & 1 deletion pages/home.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../');
<?php if (!defined("DARKCORECMS")) redirect("../");
$login = new Login;
if (isset($_POST['login']))
$login->do_login($_POST['login_username'], $_POST['login_password']);
Expand Down
2 changes: 1 addition & 1 deletion pages/login.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS") || isset($_SESSION['usr'])) header('Location: ../');
<?php if (!defined("DARKCORECMS") || isset($_SESSION['usr'])) redirect("../");
$login = new Login;
if (isset($_POST['login']))
$login->do_login($_POST['login_username'], $_POST['login_password']);
Expand Down
2 changes: 1 addition & 1 deletion pages/news.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS") || !isset($_GET['id'])) header('Location: ../');
<?php if (!defined("DARKCORECMS") || !isset($_GET['id'])) redirect("../");
$news_engine = new News;
$news = $news_engine->news;
?>
Expand Down
2 changes: 1 addition & 1 deletion pages/realm.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS") || !isset($_GET['id'])) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS") || !isset($_GET['id'])) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "This module is under development" ?></label>
Expand Down
2 changes: 1 addition & 1 deletion pages/register.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS") || isset($_SESSION['usr'])) header('Location: ../');
<?php if (!defined("DARKCORECMS") || isset($_SESSION['usr'])) redirect("../");
$registration = new Registration;
$first=rand(1,10);
$second=rand(1,10);
Expand Down
2 changes: 1 addition & 1 deletion pages/rules.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS")) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "This module is under development" ?></label>
Expand Down
2 changes: 1 addition & 1 deletion pages/user.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS") || !isset($_SESSION['usr'])) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS") || !isset($_SESSION['usr'])) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "Welcome back ".$account['info']['username']." this module is under development" ?></label>
Expand Down
2 changes: 1 addition & 1 deletion pages/vote.php
@@ -1,4 +1,4 @@
<?php if (!defined("DARKCORECMS")) header('Location: ../'); ?>
<?php if (!defined("DARKCORECMS")) redirect("../"); ?>
<div id='content'>
<div id='errors-box'>
<label class="ok"><?php echo "This module is under development" ?></label>
Expand Down

0 comments on commit c34f684

Please sign in to comment.