Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "config.php";
- class NOOB{
- private $method;
- private $args;
- private $conn;
- public $file;
- public function __construct($method,$args,$file) {
- $this->method = $method;
- $this->args = $args;
- $this->file = $file;
- $this->conn();
- }
- function show() {
- list($username) = func_get_args();
- $sql = sprintf("SELECT * FROM users WHERE username='%s'", $username);
- $obj = $this->query($sql);
- if ( $obj != false ) {
- $this->ret( sprintf("%s - %s", $obj->username, $obj->role) );
- } else {
- $this->ret("Baby Dont hurt me, Dont hurt me, No more...");
- }
- }
- function login() {
- global $FLAG,$fl;
- list($username,$password,$data,$file) = func_get_args();
- $username = strtolower(trim(mysql_escape_string($username)));
- $password = strtolower(trim(mysql_escape_string($password)));
- if(!preg_match('/(file|filter|or|and|data|&&|base64|read)/',$username) && !preg_match('/(file|filter|or|and|data|&&|base64|read)/',$password)){
- $sql = sprintf("SELECT * FROM users WHERE username='%s' AND password='%s'", $username, $password);
- if ( $username == 'admin' || stripos($sql, 'admin') != false ) {
- $this->ret("Assim não, pensa um pouco mais");
- }
- $obj = $this->query($sql);
- if ( $obj != false && $obj->role == 'admin' ) {
- session_start();
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- $_SESSION['data'] = $data;
- session_encode();
- $this->file = str_replace("../","",$this->file);
- if(!preg_match('/(file|filter|or|and|data|&&|base64|read|access|error)/i',$this->file) && isset($data)){
- include($this->file); //inc.php
- }else{
- $this->ret("blocked!");
- }
- } else {
- $this->ret("Saia daqui!");
- }
- }else{
- $this->ret("blocked!");
- }
- }
- function source() {
- highlight_file(__FILE__);
- }
- function conn() {
- global $db_host, $db_name, $db_user, $db_pass, $passwd,$db;
- if (!$this->conn)
- $this->conn = mysql_connect($db_host, $db_user, $db_pass);
- mysql_select_db($db_name, $this->conn);
- if(isset($db)){
- $sql = "INSERT INTO users VALUES ('admin', '$passwd', 'admin'), ('hackaflag', 'h3ll0fr13nd', 'user')";
- $this->query($sql,$back=false);
- }
- mysql_query("SET names utf8");
- mysql_query("SET sql_mode = 'strict_all_tables'");
- }
- function query($sql, $back=true) {
- $result = @mysql_query($sql);
- if ($back) {
- return @mysql_fetch_object($result);
- }
- }
- function ret($msg) {
- $this->close();
- header("Content-Type: application/json");
- die( json_encode( array("msg"=> $msg) ) );
- }
- function close() {
- mysql_close($this->conn);
- }
- function __destruct() {
- $this->conn();
- if (in_array($this->method, array("show", "login", "source"))) {
- @call_user_func_array(array($this, $this->method), $this->args);
- } else {
- $this->ret("Oq vc ta fazendo?");
- }
- $this->close();
- }
- function __wakeup() {
- foreach($this->args as $k => $v) {
- $this->args[$k] = strtolower(trim(mysql_escape_string($v)));
- }
- }
- }
- if(isset($_GET["data"])) {
- @unserialize($_GET["data"]);
- } else {
- new NOOB("source", array());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement