public function login($uNow, $pNow) { $uname = $uNow; $pw = md5($pNow); $this->logGood = false; $this->tableMaster = "proxyLog"; $this->hookup = UniversalConnect::doConnect(); $sql = "SELECT uname, pw FROM {$this->tableMaster} WHERE uname='{$uname}'"; if ($result = $this->hookup->query($sql)) { $row = $result->fetch_array(MYSQL_ASSOC); if ($row['pw'] == $pw) { $this->logGood = true; } $result->close(); } elseif (($result = $this->hookup->query($sql)) === false) { printf("Błąd: %s <br>", $this->hookup->error); exit; } $this->hookup->close(); if ($this->logGood) { $this->request(); } else { echo "Podane dane są nieprawidłowe"; } }
public function login($uNow, $pNow) { $uname = $uNow; $pw = md5($pNow); $this->logGood = false; $this->tableMaster = "proxyLog"; $this->hookup = UniversalConnect::doConnect(); $sql = "SELECT pw FROM {$this->tableMaster} WHERE uname='{$uname}'"; if ($result = $this->hookup->query($sql)) { $row = $result->fetch_array(MYSQLI_ASSOC); if ($row['pw'] == $pw) { $this->logGood = true; } $result->close(); } elseif (($result = $this->hookup->query($sql)) === false) { printf("Failed %s <br> ", $this->hookup->error); exit; } $this->hookup->close(); if ($this->logGood) { $this->request(); } else { echo "Username or password not on record."; } }
public function algorithm(array $dataPack) { $this->tableMaster = IStrategy::TABLENOW; $this->hookup = UniversalConnect::doConnect(); //Create Query Statement $sql = "SELECT * FROM {$this->tableMaster}"; //Conditional statement in MySQL command if ($result = $this->hookup->query($sql)) { printf("Select returned %d rows.<p />", $result->num_rows); echo "<link rel='stylesheet' href='main.css'>"; echo "<table>"; while ($finfo = mysqli_fetch_field($result)) { echo "<th> {$finfo->name}</th>"; } echo "</tr>\n"; while ($row = mysqli_fetch_row($result)) { echo "<tr >"; foreach ($row as $cell) { echo "<td >{$cell}</td>"; } echo "</tr>"; } echo "</table>"; $result->close(); } $this->hookup->close(); }
public function giveProduct() { $this->return .= <<<HTML <div id="currencyHistoryBoard" class="card"> <table style="width:100%"> <tr class="blue"> <th class="center">Currency</th> <th class="center">Time</th> <th class="center">Bid Rate</th> <th class="center">Offer Rate</th> </tr> HTML; $db = UniversalConnect::doConnect(); $query = "SELECT starttime FROM startendtime LIMIT 1"; $result = $db->query($query); $row = $result->fetch_assoc(); $startTime = $row["starttime"]; $query = "SELECT currency.shortname, valuechanges.newbuyvalue, valuechanges.newsellvalue, valuechanges.time FROM valuechanges INNER JOIN currency ON valuechanges.currencyid = currency.currencyid WHERE valuechanges.yetcompleted=0 ORDER BY valuechanges.time DESC"; $result = $db->query($query) or die($db->error); while ($row = $result->fetch_assoc()) { $this->return .= "<tr>"; $this->return .= "<td class=\"center\">" . $row["shortname"] . "</td>"; $this->return .= "<td class=\"center\">" . FormatTimePassed::format($row["time"] + $startTime) . "</td>"; $this->return .= "<td class=\"center\">" . number_format($row["newbuyvalue"], 2) . "</td>"; $this->return .= "<td class=\"center\">" . number_format($row["newsellvalue"], 2) . "</td>"; $this->return .= "</tr>"; } $this->return .= "</table></div>"; return $this->return; }
public function removeRecord() { $this->hookup = UniversalConnect::doConnect(); $this->disappear = $this->hookup->real_escape_string($_POST['delete']); $this->dataPack = array($this->disappear); $this->hookup->close(); }
public function authenticate($username = null, $password = null) { if (is_null($username) || is_null($password)) { return false; } $db = UniversalConnect::doConnect(); $usernameToCheck = $db->real_escape_string(trim($username)); $passwordToCheck = $db->real_escape_string(trim($password)); $query = "SELECT userkey, password, usertype FROM users WHERE userid=\"{$usernameToCheck}\" LIMIT 1"; $result = $db->query($query) or die($db->error . $query); if ($result->num_rows < 1) { return false; } while ($row = $result->fetch_assoc()) { if (password_verify($passwordToCheck, $row["password"])) { if (password_needs_rehash($row["password"], PASSWORD_DEFAULT)) { $newHash = password_hash($passwordToCheck, PASSWORD_DEFAULT); $query = "UPDATE users SET password=\"{$newHash}\" WHERE userkey=" . $row["userkey"]; $db->query($query); } return true; } else { return false; } } }
public function algorithm(array $dataPack) { $this->tableMaster = IStrategy::TABLENOW; $this->hookup = UniversalConnect::doConnect(); $this->dataPack = $dataPack; $field = $this->dataPack[0]; $term = $this->dataPack[1]; $this->sql = "SELECT * FROM {$this->tableMaster} WHERE {$field}='{$term}'"; //Conditional statement in MySQL query for data output $ret = $this->hookup->query($this->sql); if ($result = $this->hookup->query($this->sql)) { echo "<link rel='stylesheet' href='main.css'>"; echo "<table>"; while ($row = mysqli_fetch_row($result)) { echo "<tr>"; foreach ($row as $cell) { echo "<td>{$cell}</td>"; } echo "</tr>"; } echo "</table>"; $result->close(); } $this->hookup->close(); return $ret; }
public function __construct($directoryLayer) { if (session_status() === PHP_SESSION_NONE) { session_start(); } $this->pathToRoot = GenerateRootPath::getRoot($directoryLayer); $userkey = intval($_SESSION["userkey"]); $db = UniversalConnect::doConnect(); $query = "SELECT name, networth FROM users WHERE userkey={$userkey} LIMIT 1"; $result = $db->query($query) or die; if ($row = $result->fetch_assoc()) { $this->name = $row["name"]; $this->marketValue = $row["networth"]; } $query = "SELECT amount FROM wallet WHERE userkey={$userkey} AND currencyid=1 LIMIT 1"; $result = $db->query($query) or die; if ($row = $result->fetch_assoc()) { $this->netPosition = $row["amount"] - 10000000; } $query = "SELECT transid FROM transactions WHERE userkey={$userkey} AND (transtype=0 OR transtype=1)"; $result = $db->query($query) or die; $this->transactionCount = $result->num_rows; $this->basecurr = new BaseCurrency(); $this->return = ""; $db->close(); }
public function executeStrategy() { //Get table name and make connection $this->tableMaster = IAdminStrat::ULTRA; $this->hookup = UniversalConnect::doConnect(); $this->displayAll(); $this->hookup->close(); }
public function __construct() { $this->tableMaster = "proxyLog"; $this->hookup = UniversalConnect::doConnect(); $this->un = $this->un = $this->hookup->real_escape_string(trim($_POST['uname'])); $this->pw = $this->un = $this->hookup->real_escape_string(trim($_POST['pw'])); $this->getIface($this->proxy = new Proxy()); }
public function __construct() { $this->hookup = UniversalConnect::doConnect(); $this->tableMaster = "your_table_name"; $this->dropTable(); $this->makeTable(); $this->hookup->close(); }
public function __construct() { try { $this->test = UniversalConnect::doConnect(); mysqli_set_charset($this->test, 'utf8'); //echo "You're hooked up, Ace!<br/>"; } catch (Exception $e) { echo $e->getMessage(); } }
public function __construct() { $this->tableMaster = "survey"; $this->hookup = UniversalConnect::doConnect(); $sql = "CREATE TABLE IF NOT EXISTS {$this->tableMaster} (\n id SERIAL,\n company NVARCHAR(40),\n devdes NVARCHAR(12),\n lang NVARCHAR(15),\n plat NVARCHAR(15),\n style NVARCHAR(20),\n device NVARCHAR(12),\n PRIMARY KEY (id))"; if ($this->hookup->query($sql) === true) { printf("Tabela {$this->tableMaster} zostala utworzona <br>"); } $this->hookup->close(); }
public function executeStrategy() { //Get table name and make connection $this->tableMaster = IAdminStrat::ULTRA; $this->hookup = UniversalConnect::doConnect(); $this->getLastRecord(); $this->page = $this->getPage(); $this->hookup->close(); return $this->page; }
public function __construct() { $this->tableMaster = "helpdesk"; $this->hookup = UniversalConnect::doConnect(); $sql = "CREATE TABLE IF NOT EXISTS {$this->tableMaster} (\n id INT NOT NULL AUTO_INCREMENT,\n chain VARCHAR(3),\n response TEXT,\n PRIMARY KEY (id))"; if ($this->hookup->query($sql) === true) { printf("Tabela {$this->tableMaster} zostala utworzona <br>"); } $this->hookup->close(); }
public function giveProduct() { $this->return .= <<<HTML <div id="leaderboard" class="card"> <table style="width:100%"> <tr class="blue"> <th class="center">Rank</th> <th class="center">Name</th> <th class="center"> HTML; $this->return .= "Mark-to-Market Value "; $this->return .= "(" . $this->basecurr->getShortName() . ")</th></tr>"; $db = UniversalConnect::doConnect(); $query = "SELECT name, networth FROM users WHERE usertype=1 ORDER BY networth DESC"; $result = $db->query($query) or die($db->error); $number = 1; $tietally = 0; $previousNetWorth = -PHP_INT_MAX; while ($row = $result->fetch_assoc()) { $this->return .= "<tr>"; if ($row["networth"] == $previousNetWorth) { $number--; $this->return .= "<td class=\"center\">" . $number . "</td>"; $tietally++; $this->return .= "<td class=\"center\">" . $row["name"] . "</td>"; //if($gameEnded) $this->return .= "<td class=\"center\">" . number_format($row["networth"], 2) . "</td>"; //else // $this->return .= "<td class=\"center\">".number_format($row["networth"], 2)."</td>"; } else { if ($tietally != 0) { $number += $tietally; $this->return .= "<td class=\"center\">" . $number . "</td>"; $tietally = 0; $this->return .= "<td class=\"center\">" . $row["name"] . "</td>"; //if($gameEnded) $this->return .= "<td class=\"center\">" . number_format($row["networth"], 2) . "</td>"; //else // $this->return .= "<td class=\"center\">".number_format($row["networth"], 2)."</td>"; } else { $this->return .= "<td class=\"center\">" . $number . "</td>"; $this->return .= "<td class=\"center\">" . $row["name"] . "</td>"; //if($gameEnded) $this->return .= "<td class=\"center\">" . number_format($row["networth"], 2) . "</td>"; //else // $this->return .= "<td class=\"center\">".number_format($row["networth"], 2)."</td>"; } } $number++; $previousNetWorth = $row["networth"]; $this->return .= "</tr>"; } $this->return .= "</table></div>"; return $this->return; }
public function __construct() { //Get table name and make connection $this->tableMaster = "Addresses"; $this->hookup = UniversalConnect::doConnect(); //Get data from HTML form $this->id = $_POST['id']; //Call private methods for MySql operations $this->doDelete(); $this->hookup->close(); }
private function updateData() { $this->hookup = UniversalConnect::doConnect(); $this->sql = "UPDATE {$this->tableMaster}\n\t\t\t\tSET topic='{$this->topic}',\n\t\t\t\theader='{$this->header}',\n\t\t\t\tgraphic='{$this->graphic}',\n\t\t\t\tstory='{$this->story}'\n\t\t\t\tWHERE id='{$this->id}'"; try { $this->hookup->query($this->sql); printf("Story with topic, %s and header %s and %s graphic has been updated in table, %s :", $this->topic, $this->header, $this->graphic, $this->tableMaster); } catch (Exception $e) { echo "There is a problem: " . $e->getMessage(); exit; } }
public function __construct() { $operation = new UniversalConnect(); $this->hookup = $operation->doConnect(); $res = "SHOW TABLES LIKE {$this->tableMaster}"; if (!$this->hookup->query($res)) { $sql = "CREATE TABLE {$this->tableMaster} (uname NVARCHAR(15),\npw NVARCHAR(120))"; } if ($this->hookup->query($sql) === true) { printf("Tabela {$this->tableMaster} została utworzona.<br/> \n"); } $this->hookup->close(); }
private function enterData() { $this->tableMaster = IAdminStrat::ULTRA; $this->hookup = UniversalConnect::doConnect(); $this->sql = "INSERT INTO {$this->tableMaster} (topic,header,graphic,story)\n\t\t\t\t\t VALUES ('{$this->topic}','{$this->header}', '{$this->graphic}','{$this->story}')"; try { $this->hookup->query($this->sql); printf("Story with topic, %s and header %s and %s graphic has been entered into table, %s :", $this->topic, $this->header, $this->graphic, $this->tableMaster); } catch (Exception $e) { echo "There is a problem: " . $e->getMessage(); exit; } }
public function authenticate() { $db = UniversalConnect::doConnect(); date_default_timezone_set('Asia/Singapore'); $query = "SELECT starttime FROM startendtime WHERE timeid = 1 LIMIT 1"; $result = $db->query($query); $row = $result->fetch_assoc(); if (time() < $row["starttime"]) { return false; } else { return true; } }
public function giveProduct() { if (session_status() === PHP_SESSION_NONE) { session_start(); } $userkey = intval($_SESSION["userkey"]); $db = UniversalConnect::doConnect(); $this->return .= <<<HTML <div id="currencyHistoryBoard" class="card"> <table style="width:100%"> <tr class="blue center"> <th>No.</th> <th>Time</th> <th>Transaction Type</th> <th>Rate Transacted</th> <th>Amount Sold</th> <th>Amount Received</th> </tr> HTML; $query = "SELECT transactions.transtype, currency.shortname, transactions.amount, transactions.rate, transactions.receiveamt, transactions.time FROM transactions INNER JOIN currency ON currency.currencyid = transactions.currencyid WHERE transactions.userkey = {$userkey} ORDER BY time DESC"; $result = $db->query($query) or die($db->error); $count = 1; if ($result->num_rows <= 0) { $this->return .= "<tr><td class=\"center\" colspan=\"6\">No previous transactions found.</td></tr>"; } else { while ($row = $result->fetch_assoc()) { $this->return .= "<tr class=\"center\">"; if (intval($row["transtype"]) === 0) { $newcurrname = $row["shortname"]; $this->return .= "<td>{$count}</td>"; $this->return .= "<td>" . FormatTimePassed::format($row["time"]) . "</td>"; $this->return .= "<td>" . $this->baseCurrency->getShortName() . " to {$newcurrname} (Sell)</td>"; $this->return .= "<td>" . $row["rate"] . "</td>"; $this->return .= "<td>" . $this->baseCurrency->getShortName() . number_format($row["amount"], 2) . "</td>"; $this->return .= "<td>{$newcurrname}" . number_format($row["receiveamt"], 2) . "</td>"; } else { $newcurrname = $row["shortname"]; $this->return .= "<td>{$count}</td>"; $this->return .= "<td>" . FormatTimePassed::format($row["time"]) . "</td>"; $this->return .= "<td>{$newcurrname} to " . $this->baseCurrency->getShortName() . " (Buy)</td>"; $this->return .= "<td>" . $row["rate"] . "</td>"; $this->return .= "<td>{$newcurrname}" . number_format($row["amount"]) . "</td>"; $this->return .= "<td>" . $this->baseCurrency->getShortName() . number_format($row["receiveamt"]) . "</td>"; } $count++; $this->return .= "</tr>"; } } $this->return .= "</table></div>"; return $this->return; }
public function algorithm(array $dataPack) { $this->tableMaster = IStrategy::TABLENOW; $this->hookup = UniversalConnect::doConnect(); $this->dataPack = $dataPack; $destroy = $this->dataPack[0]; $destroy = intval($destroy); $this->sql = "DELETE FROM {$this->tableMaster} WHERE id='{$destroy}'"; if ($result = $this->hookup->query($this->sql)) { echo "Rekord #{$destroy} został usunięty z tabeli {$this->tableMaster}"; } else { "Usunięcie nieudane: " . $this->hookup->error; } }
public function gameEnded() { date_default_timezone_set('Asia/Singapore'); $db = UniversalConnect::doConnect(); $query = "SELECT endtime FROM startendtime WHERE timeid=1 LIMIT 1"; $result = $db->query($query); // or die($db->error); $row = $result->fetch_assoc(); if ($row["endtime"] < time()) { return true; } else { return false; } }
public function __construct() { $operation = new UniversalConnect(); $this->hookup = $operation->doConnect(); $drop = "DROP TABLE IF EXISTS {$this->tableMaster}"; if ($this->hookup->query($drop) === true) { printf("Stara tabela {$this->tableMaster} została usunięta<br>"); } $sql = "CREATE TABLE {$this->tableMaster} (uname NVARCHAR(15),\n pw NVARCHAR(120))"; if ($this->hookup->query($sql) === true) { printf("Tabela {$this->tableMaster} zostala utworzona <br>"); } $this->hookup->close(); }
public function algorithm(array $dataPack) { $this->tableMaster = IStrategy::TABLENOW; $this->hookup = UniversalConnect::doConnect(); $this->dataPack = $dataPack; $destroy = $this->dataPack[0]; $destroy = intval($destroy); $this->sql = "DELETE FROM {$this->tableMaster} WHERE id='{$destroy}'"; //Conditional statement in MySQL query for error checking if ($result = $this->hookup->query($this->sql)) { echo "Record #{$destroy} removed from table: {$this->tableMaster}"; } else { echo "Removal failed: " . $hookup->error; } }
public function __construct() { $this->tableMaster = "proxyLog"; $this->hookup = UniversalConnect::doConnect(); $username = $this->hookup->real_escape_string(trim($_POST['uname'])); $pwNow = $this->hookup->real_escape_string(trim($_POST['pw'])); $sql = "INSERT INTO {$this->tableMaster} (uname, pw) VALUES ('{$username}',md5('{$pwNow}'))"; if ($this->hookup->query($sql)) { echo "Registration completed:"; } elseif (($result = $this->hookup->query($sql)) === false) { printf("Invalid query: %s <br> Whole query: %s <br>", $this->hookup->error, $sql); exit; } $this->hookup->close(); }
public function algorithm(array $dataPack) { $this->tableMaster = IStrategy::TABLENOW; $this->hookup = UniversalConnect::doConnect(); $this->dataPack = $dataPack; $changeField = $this->dataPack[0]; $oldData = $this->dataPack[1]; $newData = $this->dataPack[2]; $this->sql = "UPDATE {$this->tableMaster} SET {$changeField}='{$newData}' WHERE {$changeField}='{$oldData}'"; if ($result = $this->hookup->query($this->sql)) { echo "{$changeField} zmienione z {$oldData} na {$newData}"; } else { "zmiana nieudana: " . $this->hookup->error; } }
public function __construct() { $this->tableMaster = "helpdesk"; $this->hookup = UniversalConnect::doConnect(); $chain = $this->hookup->real_escape_string($_POST['chain']); $response = $this->hookup->real_escape_string($_POST['response']); $sql = "INSERT INTO {$this->tableMaster} (chain, response) VALUES ('{$chain}', '{$response}')"; if ($this->hookup->query($sql)) { printf("Zapytanie łańcucha: %s <BR> odpowiedź %s<br> została wstawiona do tabeli %s", $chain, $response, $this->tableMaster); } elseif (($result = $this->hookup->query($sql)) === false) { printf("Błąd w zapytaniu: %s <BR> całe zapytanie: %s<br>", $this->hookup->error, $sql); exit; } $this->hookup->close(); }
public function algorithm(array $dataPack) { $this->tableMaster = IStrategy::TABLENOW; $this->hookup = UniversalConnect::doConnect(); $this->dataPack = $dataPack; $changeField = $this->dataPack[0]; $oldData = $this->dataPack[1]; $newData = $this->dataPack[2]; $this->sql = "UPDATE {$this->tableMaster} SET {$changeField}='{$newData}'\nWHERE {$changeField}='{$oldData}'"; //Conditional statement in MySQL query for error checking if ($result = $this->hookup->query($this->sql)) { echo "{$changeField} changed from {$oldData} to: {$newData}"; } else { echo "Change failed: " . $hookup->error; } }