Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. diff --git a/configuration.php b/configuration.php
  2. index 9bf085d..ee2464f 100644
  3. --- a/configuration.php
  4. +++ b/configuration.php
  5. @@ -21,6 +21,7 @@ default css,default tax,default currency
  6. #ini_set("memory_limit", "64M");
  7.  
  8. include_once("libs/database.php");
  9. +include_once("libs/db.php");
  10. include_once("libs/template.php");
  11. include_once("libs/upload.php");
  12. include_once("libs/htmlMimeMail.php");
  13. @@ -235,7 +236,7 @@ if(!defined('DATABASE_HOST')){
  14. }
  15.  
  16. # Setting up the database connection
  17. -$obDatabase = new database();
  18. +$obDatabase = new db();
  19. $obDatabase->db_host = DATABASE_HOST;
  20. $obDatabase->db_user = DATABASE_USERNAME;
  21. $obDatabase->db_password = DATABASE_PASSWORD;
  22. diff --git a/libs/db.php b/libs/db.php
  23. new file mode 100644
  24. index 0000000..823f8f6
  25. --- /dev/null
  26. +++ b/libs/db.php
  27. @@ -0,0 +1,31 @@
  28. +<?php
  29. +class db extends database
  30. +{
  31. + function escape($string){
  32. +
  33. + $hasMagicQuotesEnabled = (bool)get_magic_quotes_gpc();
  34. + $canEscapeString = function_exists('mysql_real_escape_string');
  35. +
  36. + if($hasMagicQuotesEnabled){
  37. + $string = stripslashes($string);
  38. + }
  39. +
  40. + if($canEscapeString){
  41. + if($escaped = @mysql_real_escape_string($string)){
  42. + return $escaped;
  43. + }
  44. + }
  45. +
  46. + $replacements = array(
  47. + '\\' => '\\\\',
  48. + "\0" => '\\0',
  49. + "\n" => '\\n',
  50. + "\r" => '\\r',
  51. + "'" => "\\'",
  52. + '"' => '\\"',
  53. + "\x1a" => '\\Z',
  54. + );
  55. +
  56. + return strtr($string, $replacements);
  57. + }
  58. +}
  59. \ No newline at end of file
  60. diff --git a/modules/adminindex.php b/modules/adminindex.php
  61. index 81eb5e4..c19804c 100644
  62. --- a/modules/adminindex.php
  63. +++ b/modules/adminindex.php
  64. @@ -4,7 +4,14 @@ Modified: 12/03/2008
  65. Revision: 6.0.0
  66. Copyright: Tradingeye
  67. ====================================================================*/
  68. - session_start();
  69. + session_start();
  70. +
  71. + if(isset($_SESSION['uname']) && $_SESSION['uname']!= '' && !isset($_SESSION['adminFlag']) && !$_SESSION['adminFlag']){
  72. + session_destroy();
  73. + $_SESSION = array();
  74. + header("Location:".SITE_URL."adminindex.php");
  75. + exit;
  76. + }
  77.  
  78. if ($_REQUEST['flag']=="dashboard"){
  79. unset ($_SESSION['flag']);
  80. diff --git a/modules/default/authentication.php b/modules/default/authentication.php
  81. index fcdee14..fe1fbf5 100644
  82. --- a/modules/default/authentication.php
  83. +++ b/modules/default/authentication.php
  84. @@ -88,7 +88,7 @@ class c_authentication
  85.  
  86. function m_loginCheck()
  87. {
  88. - $this->obDb->query= "select iAdminid_PK,vUsername FROM ".ADMINUSERS." WHERE vUsername = '".trim($this->request['username'])."' AND vPassword=PASSWORD('".trim($this->request['password'])."')";
  89. + $this->obDb->query= "select iAdminid_PK,vUsername FROM ".ADMINUSERS." WHERE vUsername = '".$this->obDb->escape($this->request['username'])."' AND vPassword=PASSWORD('".$this->obDb->escape($this->request['password'])."')";
  90. $qryResult = $this->obDb->fetchQuery();
  91. $rCount=$this->obDb->record_count;
  92. if($rCount>0)
  93. @@ -96,6 +96,7 @@ class c_authentication
  94. $_SESSION['uid'] = trim($qryResult[0]->iAdminid_PK);
  95. $_SESSION['uname'] = trim($qryResult[0]->vUsername);
  96. $_SESSION['dashSelec'] = "class='selected'";
  97. + $_SESSION['adminFlag'] = "1";
  98. $this->libFunc->m_mosRedirect(SITE_URL."adminindex.php");
  99. }
  100. else
  101. @@ -106,7 +107,7 @@ class c_authentication
  102.  
  103. function m_forgetPassword()
  104. {
  105. - $this->obDb->query= "select iAdminid_PK,vUsername,vPassword,vEmail FROM ".ADMINUSERS." WHERE vUsername = '".trim($this->request['username'])."' AND vEmail='".trim($this->request['email'])."'";
  106. + $this->obDb->query= "select iAdminid_PK,vUsername,vPassword,vEmail FROM ".ADMINUSERS." WHERE vUsername = '".$this->obDb->escape($this->request['username'])."' AND vEmail='".$this->obDb->escape($this->request['email'])."'";
  107. $qryResult = $this->obDb->fetchQuery();
  108. $rCount=$this->obDb->record_count;
  109. $uniqID=uniqid (3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement