Guest User

Untitled

a guest
Jun 27th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. CREATE TABLE IF NOT EXISTS `_config` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `name` varchar(255) NOT NULL,
  4. `content` text NOT NULL,
  5. UNIQUE KEY `id` (`id`)
  6. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
  7.  
  8. --
  9. -- Daten für Tabelle `_settings`
  10. --
  11.  
  12. INSERT INTO `_config` (`id`, `name`, `content`) VALUES
  13. (1, 'texte1', 'Texte eintrag!'),
  14. (2, 'admin_username', 'admin'),
  15. (3, 'admin_password', 'd033e22ae348aeb5660fc2140aec35850c4da997'),
  16. (4, 'admin_username', 'hunterz'),
  17. (5, 'admin_password', 'd033e22ae348aeb5660fc2140aec35850c4da997');
  18.  
  19.  
  20.  
  21. ############################################################################
  22.  
  23. // Abfrage
  24.  
  25.  
  26.  
  27. $sql = "SELECT id, name, content FROM ".DB_PREFIX."config WHERE `id` != '1'"; # felname1
  28. $result = $db->query($sql);
  29. while($row = $result->fetch_assoc()){
  30. ${$row['name']} = $row['content'];
  31.  
  32.  
  33. }
  34.  
  35.  
  36. ##############################################################################
  37.  
  38. // Admin index.php
  39.  
  40. $template->tplpath = "../template";
  41. $is_admin = (isset($_SESSION['admin']) && $_SESSION['admin'] == true) ? true : false;
  42. $template->assign('ADMIN', true);
  43. if(!$is_admin){
  44. $username = request_var("username");
  45. $password = request_var("password");
  46. if($username != "" && $password != ""){
  47. if($username == $admin_username && $admin_password == sha1($password)){
  48. $_SESSION['admin'] = true;
  49. header("Location: ".$url."/admin/");
  50. }else{
  51. $template->assign('WRONG_DETAILS', 1);
  52. }
  53. }
  54. $template->assign('PAGE_TITLE', 'Administrationsbereich - Login');
  55. # display login form!
  56. $template->display("admin_login.html");
  57. die();
Add Comment
Please, Sign In to add comment