/** * Logins the user * @return null on success and string containing error message on error. */ public function login() { session_start(); $sql = SqlConnect::getInstance(); $result = $sql->runQuery("SELECT admin, member_id, pass_hash, salt FROM Member where player_tag = '" . $this->player_tag . "';"); if ($result->num_rows == 0) { return "Username does not exist."; } $row = $result->fetch_assoc(); $hash = $row["pass_hash"]; $salt = $row["salt"]; $this->id = $row["member_id"]; $admin = $row["admin"]; echo $admin; // verify that password matches with stored password $success = authUtil::verifyPass(HASHALGO, $hash, $salt, $this->player_tag, $this->password); if ($success) { $_SESSION["id"] = $this->id; $_SESSION["player_tag"] = $this->player_tag; $_SESSION["admin"] = $admin; return NULL; } else { return "Username and password did not match."; } }
public function fsInit() { if ($_POST['id'] != '') { $id = $_POST['id']; $del = $_POST['del']; $db = new SqlConnect(); $db->sqlInit(); $finalURL = $db->getNameById($id); if ($del == 'true') { unlink('../images/' . $finalURL); echo "URL: " . $finalURL . " DELETED"; $db->updateColumn($id); } if ($del == 'false') { $db->addCounter($id); echo 'Added ++ Count'; } } }
/** * Constructor * Constructor, create a new instance of a registry for a table. Load all the registry info in the Registry object. * To make it available to apply the registry in the different contexts. * @param object sqlConnect $dbc Database connexion * @param String $table name of the table where to apply the registry. * @access public * * Constructor now is going to load the reqistry XML or table * for each field get its type (if not defined use default char) * create a new instance of the associated field type object and store it into an array * indexed by the field name. * Built a [rtype]=rdata array and pass it to the constructor * */ function __construct($table = '', $dbc = '') { parent::__construct(); if (is_resource($table)) { $dbc = $table; $table = ''; } // temporary hack for backward compatibility. (th4bc) if ($dbc == '') { $dbc = $GLOBALS['conx']; } if ($dbc != "") { $this->dbc = $dbc; $this->project_path = $this->dbc->getProjectDirectory(); } if (!empty($GLOBALS['cfg_local_pasdir'])) { $this->radria_core_path = $GLOBALS['cfg_local_pasdir']; } if (defined("RADRIA_LOG_RUN_FIELDS")) { $this->setLogRun(RADRIA_LOG_RUN_FIELDS); } $this->setLog("\n \n Fields object constructor: " . $table); if (strlen(trim($table)) > 0) { $table = trim($table); $this->table = $table; $this->setLog("\n loading from registry: " . $table); if (strpos($table, ",") === false) { if (file_exists($this->project_path . "/" . $this->tbl_registry . "/" . $this->table . ".reg.xml")) { $this->setLog(" \n loading from xml registry:" . $this->table); $this->registryFromXML($table); } else { $this->setLog(" \n loading from Table registry:" . $this->table); $this->registryFromTable($table); } } else { $this->setLog("\n Multiple registries detected"); $a_tables = explode(",", $table); foreach ($a_tables as $reg_table) { $reg_table = trim($reg_table); if (file_exists($this->project_path . "/" . $this->tbl_registry . "/" . $reg_table . ".reg.xml")) { $this->setLog(" \n loading from xml registry:" . $reg_table); $this->registryFromXML($reg_table); } else { $this->registryFromTable($reg_table); $this->setLog(" \n loading from Table registry:" . $reg_table); } } } } }
<?php $tournament_id = $_GET["tournament_id"]; include_once '../../resources/sqlconnect.php'; $sql = SqlConnect::getInstance(); $sql->runQuery("UPDATE Tournament SET open=0 WHERE tournament_id='{$tournament_id}';"); header('Location: ../tournaments_display.php?tournament_id=' . $tournament_id); die;
/** * Escapes the given string */ public function escape($str) { SqlConnect::getInstance(); return mysqli_real_escape_string($this->connection, $str); }
<?php require 'classes/AutoLoad.php'; ?> <?php $db = new SqlConnect(); $db->sqlInit(); ?> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'> </head> <form action = "classes/UploadImage.php" method = "post" enctype = 'multipart/form-data'> <input type = "file" name = "somename" /> <input type = "submit" value = "Загрузить" /> </form> <script> $(document).ready(function(){ $("img").click(function(){ var id = $(this).attr('id'); $.post( "/classes/FileSystem.php", { id: id, del: false },