Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.0.7.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. ini_set( 'memory_limit', '-1' );
  15. ini_set( 'max_execution_time', 60 );
  16. ini_set( 'displayerrors', 0 );
  17. ob_implicit_flush( );
  18. error_reporting( 32767 );
  19. ini_set( 'display_errors', 0 );
  20. ignore_user_abort( false );
  21. $config = include 'config.php';
  22. extract( $config );
  23. session_start( );
  24. $Utilities = new Utilities( );
  25. $ayarlar = get_option( );
  26. $lisansCheck = lisansCheck( );
  27. $main_controller = new main_controller( );
  28. define( 'CR', "\r" );
  29. define( 'LF', "\n" );
  30. define( 'CRLF', "\r\n" );
  31. define( 'BR', '<br />' . LF );
  32.  
  33. class Utilities
  34. {
  35. private static $instance = null;
  36. public $cache_time = 1800;
  37. private $con = null;
  38. private $result = null;
  39. private $ayarlar = null;
  40.  
  41. public function __construct()
  42. {
  43. global $config;
  44. self::$instance = &$this;
  45.  
  46. if (isset( $config ) && !(empty( $config )) && is_array( $config )) {
  47. extract( $config );
  48. $this->con = new PDO( 'mysql:host=' . $DB_SERVER . ';dbname=' . $DB_DATABASE, $DB_USERNAME, $DB_PASSWORD );
  49. $this->con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
  50. $queries = array( 'SET NAMES \'utf8\'' );
  51.  
  52. foreach ($queries as $query) {
  53. $this->con->query( $query );
  54. }
  55. }
  56. }
  57.  
  58. public function __destruct()
  59. {
  60. $this->con = NULL;
  61. $this->result = NULL;
  62. }
  63.  
  64. public function query($queryString, $bindValues = NULL, $fetch_style = PDO::FETCH_OBJ)
  65. {
  66. $result = NULL;
  67. $queryType = NULL;
  68.  
  69. if (preg_match( '/update\\s([a-zA-Z0-9_]{1,20}+)\\sset/siU', $queryString, $table_match )) {
  70. $queryType = 'UPDATE';
  71. }
  72. else if (preg_match( '/insert\\sinto\\s([a-zA-Z0-9_]{1,20}+)/siU', $queryString, $table_match )) {
  73. $queryType = 'INSERT';
  74. }
  75. else if (preg_match( '/delete\\sfrom\\s([a-zA-Z0-9_]{1,20}+)/siU', $queryString, $table_match )) {
  76. $queryType = 'DELETE';
  77. }
  78. else if (preg_match( '/from\\s*([a-zA-Z0-9_]{1,20}+)/siU', $queryString, $table_match )) {
  79. $queryType = 'SELECT';
  80. }
  81.  
  82. $query = $this->con->prepare( $queryString );
  83.  
  84. if (isset( $bindValues ) && is_array( $bindValues )) {
  85. foreach ($bindValues as $key => $value) {
  86. $key = ':' . $key;
  87. $query->bindValue( $key, $value, PDO::PARAM_STR );
  88. }
  89. }
  90.  
  91. $query->execute( );
  92.  
  93. if ($queryType == 'INSERT') {
  94. $lastInsertId = $this->con->lastInsertId( );
  95. return $lastInsertId;
  96. }
  97.  
  98. $result = new stdClass( );
  99. $rowCount = $query->rowCount( );
  100. $result->rowCount = $rowCount;
  101.  
  102. if ($queryType == 'SELECT') {
  103. $result->fetchAll = $query->fetchAll( $fetch_style );
  104.  
  105. if (0 < count( $result->fetchAll )) {
  106. $result->fetch = $result->fetchAll[0];
  107. }
  108. }
  109.  
  110. return $result;
  111. }
  112.  
  113. public function insert($table, $data)
  114. {
  115. $values = '';
  116. $i = 0;
  117. $keys = '';
  118. $bindValues = array( );
  119.  
  120. foreach ($data as $key => $val) {
  121. $bindValues[$key] = $val;
  122. $keys .= (($i == 0 ? $key : ',' . $key));
  123. $values .= (($i == 0 ? ':' . $key : ', :' . $key));
  124. ++$i;
  125. }
  126.  
  127. $sql = 'INSERT INTO ' . $table . ' (' . $keys . ') values(' . $values . ')';
  128. return $this->query( $sql, $bindValues );
  129. }
  130.  
  131. public function update($table, $data, $where = NULL)
  132. {
  133. $values = '';
  134. $bindValues = array( );
  135. $i = 0;
  136.  
  137. foreach ($data as $key => $val) {
  138. $bindValues[$key] = $val;
  139. $values .= (($i == 0 ? $key . ' = :' . $key : ',' . $key . ' = :' . $key));
  140. ++$i;
  141. }
  142.  
  143. $sql = 'UPDATE ' . $table . ' SET ' . $values;
  144.  
  145. if (isset( $where ) && $where) {
  146. if (is_array( $where )) {
  147. $_where = '';
  148. $i = 0;
  149.  
  150. foreach ($where as $key => $value) {
  151. $bindValues[$key] = $value;
  152. $_where .= (($i == 0 ? $key . ' = :' . $key : ' AND ' . $key . ' = :' . $key));
  153. ++$i;
  154. }
  155.  
  156. $where = $_where;
  157. }
  158.  
  159. $sql .= ' WHERE ' . $where . ' ';
  160. }
  161.  
  162. return $this->query( $sql, $bindValues );
  163. }
  164.  
  165. public function delete($table, $where = NULL, $bindValues = NULL)
  166. {
  167. $values = '';
  168. $i = 0;
  169. $sql = 'DELETE FROM ' . $table . ' ';
  170.  
  171. if (isset( $where ) && $where) {
  172. if (is_array( $where )) {
  173. $_where = '';
  174. $i = 0;
  175.  
  176. foreach ($where as $key => $value) {
  177. $bindValues[$key] = $value;
  178. $_where .= (($i == 0 ? $key . ' = :' . $key : ' AND ' . $key . ' = :' . $key));
  179. ++$i;
  180. }
  181.  
  182. $where = $_where;
  183. }
  184.  
  185. $sql .= ' WHERE ' . $where . ' ';
  186. }
  187.  
  188. return $this->query( $sql, $bindValues );
  189. }
  190. }
  191.  
  192. class main_controller
  193. {
  194. public $Model = null;
  195. public $Models = null;
  196.  
  197. public function __construct()
  198. {
  199. global $Utilities;
  200. global $ayarlar;
  201. $script_name = str_replace( '/', '\\', $_SERVER['SCRIPT_FILENAME'] );
  202. $script_name = str_replace( '\\', '/', $script_name );
  203. $script_name = str_replace( realpath( dirname( __FILE__ ) ), '', $script_name );
  204. $scr = pathinfo( $script_name );
  205. $base_name = $scr['basename'];
  206. $_do = $scr['basename'] . ((isset( $_GET['do'] ) ? '_' . $_GET['do'] : ''));
  207. $queryString = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
  208. parse_str( $queryString, $queryString );
  209.  
  210. if (isset( $queryString ) && (0 < count( $queryString ))) {
  211. foreach ($queryString as $key => $val) {
  212. if (!(isset( $_GET[$key] ))) {
  213. $_GET[$key] = $val;
  214. }
  215. }
  216. }
  217.  
  218. if ($scr['basename'] == 'login.php') {
  219. if ($this->IsAuthenticated( )) {
  220. yonlendir( base_url( ) );
  221. }
  222. else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  223. $username = $_POST['username'];
  224. $password = $_POST['password'];
  225. $giris = $Utilities->query( 'SELECT * FROM ayarlar WHERE kullanici_adi = :kullanici_adi and kullanici_sifre = :kullanici_sifre and id = \'1\' ', array(
  226. 'kullanici_adi' => $username,
  227. 'kullanici_sifre' => $password
  228. ) );
  229.  
  230. if (0 < $giris->rowCount) {
  231. ...........................................................................................................
  232. ......................................................
  233. .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement