Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. Index: db.class.php
  2. ===================================================================
  3. --- db.class.php (revision 20533)
  4. +++ db.class.php (working copy)
  5. @@ -64,12 +64,6 @@
  6. timestamp FLOAT
  7. )
  8. END;
  9. - $admin_table = <<<END
  10. -CREATE TABLE admins (
  11. - name TEXT PRIMARY KEY,
  12. - pass TEXT
  13. -)
  14. -END;
  15. $target_table = <<<END
  16. CREATE TABLE targets (
  17. shortname TEXT PRIMARY KEY,
  18. @@ -91,7 +85,6 @@
  19. $this->query($target_table);
  20. $this->query($checkwps_table);
  21. $this->query($theme_table);
  22. - $this->query($admin_table);
  23. $this->query($log_table);
  24. }
  25. }
  26. Index: adduser.sh
  27. ===================================================================
  28. --- adduser.sh (revision 20533)
  29. +++ adduser.sh (working copy)
  30. @@ -1,27 +0,0 @@
  31. -#!/bin/sh
  32. -if [ -z "$1" -o ! -f "$1" ]; then
  33. - printf "Usage: %s dbfile\n" `basename "$0"`
  34. - exit 1
  35. -elif [ ! -w "$1" ]; then
  36. - printf "Error: You need write permissions for %s\n" "$1" 1>&2
  37. - exit 2
  38. -else
  39. - dbfile=$1
  40. -fi
  41. -for util in md5sum sqlite; do
  42. - if [ ! -x "`which $util 2>/dev/null`" ]; then
  43. - echo "We need the $util utility"
  44. - exit 3
  45. - fi
  46. -done
  47. -
  48. -echo "Add a user to the admin table"
  49. -echo ""
  50. -
  51. -printf "Username: "
  52. -read user
  53. -printf "Password: "
  54. -read pass
  55. -md5pass=`printf "$pass"|md5sum|cut -c 1-32`
  56. -sql=`printf "INSERT INTO admins (name, pass) VALUES ('%s', '%s')" "$user" "$md5pass"`
  57. -sqlite "$dbfile" "$sql"
  58. Index: themesite.class.php
  59. ===================================================================
  60. --- themesite.class.php (revision 20533)
  61. +++ themesite.class.php (working copy)
  62. @@ -116,12 +116,25 @@
  63. }
  64.  
  65. public function adminlogin($user, $pass) {
  66. - $sql = sprintf("SELECT COUNT(*) as count FROM admins WHERE name='%s' AND pass='%s'",
  67. - db::quote($user),
  68. - db::quote(md5($pass))
  69. + /* Don't use db.class.php for this, as that could be non-MySQL */
  70. + $r = mysql_connect(config::smf_server, config::smf_username, config::smf_password);
  71. + if($r === false)
  72. + return false;
  73. +
  74. + mysql_select_db(config::smf_db, $r);
  75. +
  76. + $sql = sprintf("SELECT realName FROM %smembers WHERE memberName = '%s' AND passwd = '%s' AND ID_GROUP IN (%s)",
  77. + config::smf_db_prefix,
  78. + mysql_escape_string($user),
  79. + sha1(strtolower($user . $pass)), /* Found in ./Sources/LogInOut.php in SMF 1.1.4 */
  80. + config::smf_groupids
  81. );
  82. - $result = $this->db->query($sql)->next();
  83. - return $result['count'] == 1 ? true : false;
  84. +
  85. + $q = mysql_query($sql, $r);
  86. + $result = mysql_num_rows($q);
  87. + mysql_close($r);
  88. +
  89. + return $result == 1 ? true : false;
  90. }
  91.  
  92. public function target2fullname($shortname) {
  93. Index: config.inc.php
  94. ===================================================================
  95. --- config.inc.php (revision 20533)
  96. +++ config.inc.php (working copy)
  97. @@ -51,6 +51,15 @@
  98.  
  99. // Location of 'unzip'
  100. const unzip = "/usr/bin/unzip";
  101. +
  102. + // The data for the SMF MySQL database containing the users allowed to login
  103. + // smf_groupids contains the SMF groups that are allow to log in (comma-separated)
  104. + const smf_db_prefix = "";
  105. + const smf_server = "localhost";
  106. + const smf_username = "";
  107. + const smf_password = "";
  108. + const smf_db = "";
  109. + const smf_groupids = "0,1";
  110. }
  111.  
  112. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement