function displayConfigForm() { $query = "SELECT * FROM vars_text"; $query_2 = "SELECT * FROM vars_numeric"; $database = connectToDatabase(); $result = mysqlQuery($query, $database); $result_2 = mysqlQuery($query_2, $database); echo "<form method='post'><table>"; while ($result_array = mysql_fetch_array($result)) { //debugArray( "text", $result_array ); echo "<tr>"; echo "<td>"; echo "<input type='text' name='text_" . $result_array['name'] . "' value='" . $result_array['value'] . "' size='50' />"; echo "</td>"; echo "<td>"; echo $result_array['description']; echo "</td>"; echo "</tr>"; } while ($result_array_2 = mysql_fetch_array($result_2)) { echo "<tr>"; echo "<td>"; echo "<input type='text' name='" . $result_array_2['name'] . "' value='" . $result_array_2['value'] . "' size='50' />"; echo "</td>"; echo "<td>"; echo $result_array_2['description']; echo "</td>"; echo "</tr>"; } echo "<tr>"; echo "<td><input type='submit' value='Submit' /></td><td><input type='hidden' name='submitted' value='1' /></td></tr>"; echo "</table></form>"; }
function fetchMunicipalities($municipalities) { $query = "SELECT * FROM municipalities group by name order by name"; $result = mysqlQuery($query); while ($row = mysqlFetchArray($result)) { $municipalities[$row["id"]] = $row["name"]; } return $municipalities; }
function mysqlGetSingleValue($query, $database = null) { global $mysql_debug; if (!$database) { $database = connectToDatabase(); } $result = mysqlQuery($query, $database); if (!$result || mysql_num_rows($result) != 1 || mysql_error()) { renderError("MySQL; " . mysql_error()); return 0; } $result_array = mysql_fetch_array($result); if (!$result_array || mysql_error()) { renderError("MySQL; " . mysql_error()); return 0; } if ($mysql_debug) { debug("DONE; result=" . $result_array[0]); } return $result_array[0]; }
fenceGate(); $error = ""; if ($_GET["p"] == "buy" or $_GET["p"] == "sell") { if ($_POST["aktie"] != "" and $_POST["type"] != "") { if ($_POST["menge"] != "" and intval($_POST["menge"]) > 0) { $aktie = $_POST["aktie"]; $menge = $_POST["menge"]; $type = $_POST["type"]; $limit = floatval($_POST["limit"]); if ($limit == 0 and $type == "sellLimit") { $type = "sellInstant"; } else { if ($limit == 0 and $type == "buyLimit") { $type = "buyInstant"; } else { if ($limit == 0 and $type == "stopBuy") { $type = "buyInstant"; } else { if ($limit == 0 and $type == "stopLoss") { $type = "sellInstant"; } } } } mysqlQuery("INSERT INTO auftrage (`depotID`, `stocksID`, `menge`, `type`, `limit`, `date`) VALUES ('" . $_SESSION['depot'] . "', '" . $aktie . "', '" . $menge . "', '" . $type . "', '" . $limit . "', '" . date("Y-m-d H:i:s") . "'); "); $error = "Auftrag wurde Gespeichert !"; } else { $error = "Die Stückzahl ist inkorrekt !"; } } }
function stopBuy($row, $guthaben, $price) { if (aktKurs($row["stocksID"]) >= $row["limit"]) { buyInstant($row, $guthaben, $price); } else { $diff = date_diff(date_create($row["date"]), date_create(date("m.d.y"))); $diff_days = $diff->format('%a'); if ($diff_days > 20) { //falls auftrag älter als 20d => löschen $bearbeitung = 2; //2€ gebühr mysqlQuery("DELETE FROM auftrage WHERE id = '" . $row["id"] . "';"); mysqlQuery("UPDATE `depot` SET `guthaben`= `guthaben` - '" . $bearbeitung . "' WHERE `id` = '" . $row["depotID"] . "';"); } } }
require_once "_config.php"; if ($address && $name && !OFFLINE) { $gCode = geoCodeConvert($address); if ($gCode) { $message = 'Modified'; if (!$id) { mysqlQuery("INSERT INTO geocodes(latitude, longitude) VALUES ('0', '0')"); $gid = mysql_insert_id(); mysqlQuery("INSERT INTO locations(address, geoCodeId, name, municipality_id) VALUES ('0', '0', '0', '0')"); $id = mysql_insert_id(); $message = 'Added'; } $query = "UPDATE geocodes SET latitude='%s', longitude='%s' WHERE '{$s}'"; mysqlQuery($query, array($gCode['latitude'], $gCode['longitude'], $gid)); $query = "UPDATE locations SET address='%s', geocodeId='%s', name='%s', municipality_id='%s' WHERE id='%s'"; mysqlQuery($query, array($address, $gid, $name, $mun, $id)); $message .= ' GeoCode successfully. gCode = ' . $gCode['latitude'] . "," . $gCode['longitude'] . " " . $name . " " . $address . " " . $mun . " " . $id; $redirect_URL .= 'list'; } else { $message = 'Error: Not a valid address.'; $redirect_URL .= 'editLocation'; } } else { if (OFFLINE) { $message = "operating in offline mode."; $redirect_URL .= 'list'; } else { $message = 'Error: Not a valid GeoCode.'; $redirect_URL .= 'editLocation'; } }
/* Create a purchase by user */ } else { if (isset($_POST['ip']) && isset($_POST['delivery_country'])) { $ip = $_POST['ip']; //Your IP address $delivery_country = $_POST['delivery_country']; //Your delivery country /* Insert the pruchase to the table Purchase_List */ $query = "INSERT INTO Purchase_List(IP, Country_Name) "; $query .= "VALUES ('" . $ip . "', '" . $delivery_country . "') "; mysqlQuery($connection, $query); /* If the user want to empty the table Purchase_List */ } else { if (isset($_POST['clear'])) { $query = "TRUNCATE TABLE Purchase_List"; mysqlQuery($connection, $query); } } } /* Display the current Purchase_List on the page */ $query = "SELECT * FROM Purchase_List "; $query .= "ORDER BY Purchase_ID DESC "; $result = mysqlQuery_Result($connection, $query); $count = mysqli_num_rows($result); /* Check if the table is empty */ if ($count == 0) { echo "Current purchase list is empty"; } else { while ($count) { $row = mysqli_fetch_assoc($result); echo "Purchase ID: " . $row['Purchase_ID'] . " | IP Address: " . $row['IP'] . " | Delivery Country: " . $row['Country_Name'] . "<br >";
function displayComponentHierarchy() { global $tables; $database = connectToDatabase(); if (!$database) { return; } $result_class = mysqlQuery("SELECT id,name FROM " . $tables['classes'] . " ORDER BY priority", $database); if (!$result_class) { renderError("Cannot obtain classes list!"); return; } while ($result_array_class = mysql_fetch_array($result_class)) { $class_count++; echo "<p class='class'>" . $result_array_class['name'] . " "; if ($class_count > 1) { echo "<span class='up'><a href='?increase_priority=" . $result_array_class['id'] . "'>[UP]</a></span>"; } if ($class_count < mysql_num_rows($result_class)) { echo "<span class='down'><a href='?decrease_priority=" . $result_array_class['id'] . "'>[DOWN]</a></span>"; } $result_family = mysqlQuery("SELECT id,name FROM " . $tables['families'] . " WHERE class_id=" . $result_array_class['id'], $database); if (!$result_family) { renderError("Cannot obtain families list!"); return; } $first_family = true; while ($result_array_family = mysql_fetch_array($result_family)) { if ($first_family) { echo "<span class='edit'><a href='?edit_class=" . $result_array_class['id'] . "'>[Edit]</a></span></p>"; } $first_family = false; $family_count++; echo "<p class='family'>*" . $result_array_family['name'] . " <span class='edit'><a href='?edit_family=" . $result_array_family['id'] . "'>[Edit]</a></span>"; $result_component = mysqlQuery("SELECT id,name FROM " . $tables['components'] . " WHERE family_id=" . $result_array_family['id'], $database); if (!$result_component) { renderError("Cannot obtain components list!"); return; } $first_component = true; while ($result_array_component = mysql_fetch_array($result_component)) { $first_component = false; if ($first_component) { echo "</p>"; } echo "<p class='component'>-" . $result_array_component['name'] . " <span class='edit'><a href='?edit_component=" . $result_array_component['id'] . "'>[Edit]</a></span><span class='remove'><a href='?remove_component=" . $result_array_component['id'] . "&name=" . $result_array_component['name'] . "'>[Remove]</a></span></p>"; } if ($first_component) { echo "<span class='remove'><a href='?remove_family=" . $result_array_family['id'] . "&name=" . $result_array_family['name'] . "'>[Remove]</a></span></p>"; } echo "\r\n\t\t\t\t\t<form class='component' method='post' action='index.php'><p>-\r\n\t\t\t\t\t<input type='hidden' name='submitted' value='1' />\r\n\t\t\t\t\t<input type='hidden' name='next_page' value='3' />\r\n\t\t\t\t\t<input type='hidden' name='family_id' value='" . $result_array_family['id'] . "' />\r\n\t\t\t\t\t<input type='text' name='name' />\r\n\t\t\t\t\t<input type='submit' value='Submit' /></p>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t\t"; } if ($first_family) { echo "<span class='edit'><a href='?edit_class=" . $result_array_class['id'] . "'>[Edit]</a></span>"; echo "<span class='remove'><a href='?remove_class=" . $result_array_class['id'] . "&name=\"" . $result_array_class['name'] . "\"'>[Remove]</a></span></span><br/>"; } //display all families in this class and all components in those families and the new component form for each family echo "\r\n\t\t\t\t\t<form class='family' method='post' action='index.php'><p>*\r\n\t\t\t\t\t<input type='hidden' name='submitted' value='1' />\r\n\t\t\t\t\t<input type='hidden' name='next_page' value='2' />\r\n\t\t\t\t\t<input type='hidden' name='class_id' value='" . $result_array_class['id'] . "' />\r\n\t\t\t\t\t<input type='text' name='name' />\r\n\t\t\t\t\t<input type='submit' value='Submit' /></p>\r\n\t\t\t\t\t</form><br/>\r\n\t\t\t\t\t"; } ?> <form class='class' method="post" action="index.php"><p> <input type='hidden' name='submitted' value='1' /> <input type='hidden' name='next_page' value='1' /> <input type='text' name='name' /> <input type='submit' value="Submit" /></p> </form> <?php }
<?php require_once "../functions.php"; fenceGate(); if ($_POST["taskID"] != "") { $depotID = singleRowQuery("SELECT depotID FROM auftrage WHERE id = " . $_POST["taskID"] . ""); $depotID = $depotID[0]; if ($_SESSION['depot'] == $depotID) { mysqlQuery("DELETE FROM auftrage WHERE id = " . $_POST["taskID"] . ""); } exit; } ?> <script type="text/javascript"> function deleteTask(id) { if (confirm("Möchten Sie den Auftrag wirklich löschen ?") == true) { $.post( "index.php?p=tasks", { taskID: id }, function() { document.getElementById("openTask-"+id).style.display = "none"; } ); } } </script> <h1 class="page-header">Aufträge</h1> <h3 class="sub-header">Laufende Aufträge</h3> <div class="table-responsive">
function displayShippingInfoFromPOSTAdmin($order_id_in) { global $tables; $database = connectToDatabase(); $query = "SELECT * FROM " . $tables['shippinginfo']; $result = mysqlQuery($query); if (!$result || mysql_num_rows($result) < 1) { renderError("SHIPPING INFO TABLE EMPTY"); return; } echo "<form method='post'>"; echo "<table>"; echo "<tr><td>First Name:</td><td><input type=text name='first_name' value='" . $_POST['first_name'] . "'></td></tr>"; echo "<tr><td>Last Name:</td><td><input type=text name='last_name' value='" . $_POST['last_name'] . "'></td></tr>"; echo "<tr><td>Middle Initial:</td><td><input type=text name='middle_initial' value='" . $_POST['middle_initial'] . "'></td></tr>"; echo "<tr><td>Street Address:</td><td><input type=text name='street_address' value='" . $_POST['street_address'] . "'></td></tr>"; echo "<tr><td>City:</td><td><input type=text name='city' value='" . $_POST['city'] . "'></td></tr>"; echo "<tr><td>State:</td><td><select name='state'>"; $states = "<option>AL</option> <option>AK</option> <option>AS</option> <option>AZ</option>\r\n\t<option>AR</option> <option>CA</option> <option>CO</option> <option>CT</option>\r\n\t<option>DE</option> <option>DC</option> <option>FM</option> <option>FL</option>\r\n\t<option>GA</option> <option>GU</option> <option>HI</option> <option>ID</option>\r\n\t<option>IL</option> <option>IN</option> <option>IA</option> <option>KS</option>\r\n\t<option>KY</option> <option>LA</option> <option>ME</option> <option>MH</option>\r\n\t<option>MD</option> <option>MA</option> <option>MI</option> <option>MN</option>\r\n\t<option>MS</option> <option>MO</option> <option>MT</option> <option>NE</option>\r\n\t<option>NV</option> <option>NH</option> <option>NJ</option> <option>NM</option>\r\n\t<option>NY</option> <option>NC</option> <option>ND</option> <option>MP</option>\r\n\t<option>OH</option> <option>OK</option> <option>OR</option> <option>PW</option>\r\n\t<option>PA</option> <option>PR</option> <option>RI</option> <option>SC</option>\r\n\t<option>SD</option> <option>TN</option> <option>TX</option> <option>UT</option>\r\n\t<option>VT</option> <option>VI</option> <option>VA</option> <option>WA</option>\r\n\t<option>WV</option> <option>WI</option> <option>WY</option></select></td></tr>"; if (isset($_POST['state'])) { $states = str_replace(">" . $_POST['state'], " selected='selected'>" . $_POST['state'], $states); } else { $states = str_replace(">AL", " selected='selected'>AL", $states); } echo $states; echo "<tr><td>Zip-Code:</td><td><input type=text name='zip_code' value='" . $_POST['zip_code'] . "'></td></tr>"; echo "<tr><td>Shipping Method:</td><td><select name='OC_ship'>"; while ($result_array = mysql_fetch_array($result)) { echo "<option value='" . $result_array['id'] . "'>" . $result_array['name'] . "- \$" . number_format($result_array['cost'], 2, '.', ',') . "</option>"; } echo "</select></td></tr>"; echo "<tr>"; echo "<td>Payment Received:</td>"; echo "<td><input type='checkbox' name='payment' /></td>"; echo "</tr>"; echo "<tr>"; echo "<td>Order Shipped:</td>"; echo "<td><input type='checkbox' name='shipped' /></td>"; echo "</tr>"; echo "<input type='hidden' name='order_id' value='" . $order_id_in . "' />\r\n <tr><td><input type='submit' value='SUBMIT SHIPPING INFO' name='ship_submit' /></td><td></td>\r\n </table>\r\n </form>"; }
//sanitize $redirect_URL = "{$base}/view/"; if ($name && $zoom && $id && !OFFLINE) { $name2 = urlencode($name); $geoCode = geoCodeConvert($name2); $geoCode = $geoCode['latitude'] . "," . $geoCode['longitude']; if ($geoCode) { $message = 'Modified'; if ($id == "new") { mysqlQuery("INSERT INTO municipalities(name, zoom, longitude, latitude) VALUES ('0', '0', '0', '0')"); $id = mysql_insert_id(); $message = 'Added'; } //FIXME: update to new database structures. $query = "UPDATE municipalities SET name='%s', geoCode='%s', zoom = '%s' WHERE id='%s'"; mysqlQuery($query, array($name, $geoCode, $zoom, $id)); $message .= ' municipality successfully. gCode = ' . $geoCode . " " . $name . " " . $zoom . " " . $id; $redirect_URL .= 'list'; } else { $message = 'Error: Not a valid Municipality.'; $redirect_URL .= 'editMunicipality'; } } else { if (OFFLINE) { $message = "operating in offline mode"; $redirect_URL .= "list"; } else { $message = 'Error: All fields must be filled in.'; $redirect_URL .= 'editMunicipality'; } }
if ($_POST["passNew"] == $_POST["passNew1"]) { mysqlQuery("UPDATE `depot` SET `pass` = '" . md5($_POST["passNew"]) . "' WHERE `id` = " . $_SESSION['depot'] . "; "); $pass_error = "Das neue Passwort wurde gespeichert !"; } else { $pass_error = "Die neuen Passwörter stimmen nicht überein !"; } } else { $pass_error = "Das Alte Passwort ist inkorrekt !"; } } else { $pass_error = "Sie müssen alle Felder Ausfüllen !"; } } //Vorschlag speichen if ($_POST["suggestion"] != "") { mysqlQuery("INSERT INTO `suggestions` (`type`, `wert`, `depotID`, `date`) VALUES ('wertpapier', '" . $_POST["suggestion"] . "', '" . $_SESSION['depot'] . "', '" . date("Y-m-d H:i:s") . "'); "); $suggestion_error = "Ihr Vorschlag wurde gespeichert und wird in kürze angewandt !"; } ?> <h1 class="page-header">Einstellungen</h1> <h3 class="sub-header">Passwort ändern</h3> <?php if ($pass_error != "") { ?> <div class="alert alert-warning" role="alert"> <?php
$count = $count[0]; if ($count == 0) { $strafe = $row["guthaben"] * 2.0E-5; mysqlQuery("UPDATE `depot` SET `guthaben`= `guthaben` - '" . $strafe . "' WHERE `id` = '" . $row["id"] . "';"); } } unset($res); //alte freundschaftsanfragen $res = multiRowQuerry("SELECT * FROM friends"); while ($row = $res->fetch_assoc()) { $diff = date_diff(date_create($row["date"]), date_create(date("m.d.y"))); $diff_days = $diff->format('%a'); if ($diff_days > 20) { mysqlQuery("DELETE FROM friends WHERE id = '" . $row["id"] . "';"); } } //nicht aktivierte nutzer löschen $res = multiRowQuerry("SELECT id,date FROM depot WHERE confirmed = '1'"); while ($row = $res->fetch_assoc()) { $diff = date_diff(date_create($row["date"]), date_create(date("m.d.y"))); $diff_days = $diff->format('%a'); if ($diff_days > 20) { mysqlQuery("DELETE FROM depot WHERE id = '" . $row["id"] . "';"); } } } //close if daily echo "[Total_Errors]: " . $_totalErrors; } else { echo "Wrong Passwort !"; }
<?php session_start(); if ($_SESSION['login'] == true and $_SESSION['depot'] == 1) { include "../functions.php"; if (isset($_POST["shortcutName"]) and $_POST["shortcutName"] != "") { mysqlQuery("INSERT INTO `stocks` (`shortcut`, `price`, `date`) VALUES ('" . $_POST["shortcutName"] . "', '0', CURRENT_TIMESTAMP); "); $addStockInfo = "Das Wertpapier wurde hinzugefügt !"; } if (isset($_POST["suggID"]) and $_POST["suggID"] != "") { mysqlQuery("DELETE FROM suggestions WHERE id = '" . $_POST["suggID"] . "'; "); } ?> <!DOCTYPE html> <html> <head> <title>Admin</title> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <link href="../bootstrap/css/adminMods.css" rel="stylesheet"> <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet"> <script src="../bootstrap/js/jquery.min.js"></script> <script src="../bootstrap/js/bootstrap.min.js"></script> </head> <body> <div class="container">
<?php if ($_POST['id'] && is_numeric($_POST['id'])) { $redirect_URL = $base . "/view/list"; $rowID = $_POST['id']; $gid = mysqlFetchArray(mysqlQuery("SELECT geoCodeId FROM locations WHERE id=%s", $rowID)); mysqlQuery("DELETE FROM locations WHERE id=%s", $rowID); mysqlQuery("DELETE FROM geocodes WHERE id=%s", $gid); $message = "Location Removed."; } else { $message = "error"; } $_SESSION['msg'] = $message; // Could use an array if more than one message was needed simultaneously. header('Location: ' . $redirect_URL); exit;
<?php include "functions.php"; $auth = $_GET["auth"]; $affRows = mysqlQuery("UPDATE depot SET confirmed = '1', emailAuth = '' WHERE emailAuth = '" . $auth . "' AND confirmed = '0';"); if ($affRows > 0) { $status = "Ihr Depot wurde aktiviert ! Sie können sich jetzt anmelden."; } else { $status = "Fehler bei der Aktivierung des Depots!"; } ?> <!DOCTYPE html> <html lang="de"> <head> <title>Phunsoft Börsenspiel</title> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <link href="bootstrap/css/startpage.css" rel="stylesheet"> </head> <body>
createNewOrderline($_POST['order_id']); setup(); } else { if ($_POST['submit'] && is_numeric($_POST['configuration_system_name'])) { $database = connectToDatabase(); $query = "SELECT " . $tables['classes'] . ".id FROM " . $tables['components'] . " JOIN ( " . $tables['classes'] . ", " . $tables['families'] . " ) ON ( " . $tables['components'] . ".family_id=" . $tables['families'] . ".id AND " . $tables['families'] . ".class_id=" . $tables['classes'] . ".id ) WHERE " . $tables['components'] . ".id=" . $_POST['configuration_system_name']; $class_id = mysqlGetSingleValue($query, $database); $query = "SELECT " . $tables['selectedcomponents'] . ".id FROM " . $tables['selectedcomponents'] . " JOIN ( " . $tables['orderlines'] . ", " . $tables['components'] . ", " . $tables['families'] . ", " . $tables['classes'] . " ) ON ( " . $tables['selectedcomponents'] . ".orderline_id=" . $tables['orderlines'] . ".id AND " . $tables['components'] . ".id=" . $tables['selectedcomponents'] . ".component_id AND " . $tables['families'] . ".id=" . $tables['components'] . ".family_id AND " . $tables['classes'] . ".id=" . $tables['families'] . ".class_id ) WHERE " . $tables['orderlines'] . ".id=" . $_POST['orderline_id'] . " AND " . $tables['classes'] . ".id=" . $class_id; $result = mysqlQuery($query, $database); if (mysql_num_rows($result) > 0) { $result_array = mysql_fetch_array($result); $query = "UPDATE " . $tables['selectedcomponents'] . " SET component_id=" . $_POST['configuration_system_name'] . " WHERE " . $tables['selectedcomponents'] . ".id=" . $result_array[0] . " LIMIT 1"; } else { $query = "INSERT INTO " . $tables['selectedcomponents'] . " VALUES ( NULL, " . $_POST['configuration_system_name'] . ", " . $_POST['orderline_id'] . ", 0 )"; } mysqlQuery($query, $database); updateFlags($class_id, $database); if ($_GET['finished']) { redirect($_GET['finished']); } else { if ($_POST['finished']) { redirect($_POST['finished']); } else { if (isOrderLineFull($_POST['orderline_id'])) { if ($_GET['return_to_class']) { $class_id = $_GET['return_to_class']; setup(); } else { orderComplete($_POST['orderline_id']); } } else {
function del($id_for_del) { $query = "DELETE FROM `adStore`\n WHERE ((`id` = '" . $id_for_del . "'));"; $result = mysqlQuery($query); }
$diff = $row['time']; $diff = time() - $diff; $up = true; } else { $diff = 4 * 3600; $up = false; } if ($diff >= 4 * 3600) { $url = sprintf("http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv&e=.csv", $_GET['name']); $handle = fopen($url, "r"); if ($handle !== FALSE) { $data = fgetcsv($handle); fclose($handle); } if (!$up) { $sql = "Insert into price (avg,max,min,code,time) values (%s,%s,%s,'%s',%d)"; $sql = sprintf($sql, $data[1], $data[6], $data[7], $data[0], time()); } else { $sql = "update price set avg=%s,max=%s,min=%s,time=%s where code = '%s'"; $sql = sprintf($sql, $data[1], $data[6], $data[7], time(), $data[0]); } mysqlQuery($con, $sql); echo $data[1] . " " . $data[6] . " " . $data[7] . " " . $data[0]; } else { echo $row['avg'] . " " . $row['max'] . " " . $row['min'] . " " . $row['code']; } mysql_close($con); ?>
function generate_list($count, $percentage, $connection) { /* Select items from table IP randomly and insert into the Purchase_List */ $query = "INSERT INTO Purchase_List(IP, Country_Name) "; $query .= "SELECT IP_Start, Country_Name "; $query .= "FROM IP ORDER BY RAND() LIMIT " . $count . " "; mysqlQuery($connection, $query); /* Calculate how many rows are going to be set to NOT match */ $count_update = floor($count * (1 - $percentage)); /* Set some of the purchases county names to be wrong, here I set the country name = "United States". Then the items have been changed will be the not-matched items */ $query = "UPDATE Purchase_List "; $query .= "SET Country_Name='United States' "; $query .= " LIMIT " . $count_update . " "; mysqlQuery($connection, $query); }
/** * drop and create mapping tables */ function dropAndCreateMappingTables() { mysqlQuery("DROP TABLE IF EXISTS class"); mysqlQuery("CREATE TABLE IF NOT EXISTS class (\r\n\t\t id int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t name varchar(50) NOT NULL DEFAULT '',\r\n\t\t parent_id int(11) DEFAULT NULL,\r\n\t\t description varchar(255) DEFAULT NULL,\r\n\t\t label varchar(255) DEFAULT NULL,\r\n\t\t PRIMARY KEY (id),\r\n\t\t UNIQUE KEY name (name)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS class_property"); mysqlQuery("CREATE TABLE IF NOT EXISTS class_property (\r\n\t\t id int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t name varchar(255) NOT NULL DEFAULT '',\r\n\t\t class_id int(11) DEFAULT NULL,\r\n\t\t type enum('object','datatype') NOT NULL DEFAULT 'object',\r\n\t\t description varchar(255) DEFAULT NULL,\r\n\t\t datatype_range varchar(100) DEFAULT NULL,\r\n\t\t uri varchar(100) DEFAULT NULL,\r\n\t\t label varchar(255) DEFAULT NULL,\r\n\t\t PRIMARY KEY (id),\r\n\t\t UNIQUE KEY name (name,class_id)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS class_property_range"); mysqlQuery("CREATE TABLE IF NOT EXISTS class_property_range (\r\n\t\t property_id int(11) NOT NULL DEFAULT '0',\r\n\t\t range_class_id int(11) NOT NULL DEFAULT '0',\r\n\t\t PRIMARY KEY (property_id,range_class_id)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS parser_type_rule"); mysqlQuery("CREATE TABLE IF NOT EXISTS parser_type_rule (\r\n\t\t class_property_id int(11) NOT NULL,\r\n\t\t parser_type enum('date','geocoordinates','unit','currency','url','merge') NOT NULL,\r\n\t\t unit_type enum('Length','Area','Volume','Speed','Force','Energy','Temperature','Mass','Pressure','Torque','FuelEfficiency','Power','PopulationDensity','Currency','Time','InformationUnit','Frequency','FlowRate','Density','Angle') DEFAULT NULL,\r\n\t\t target_unit varchar(255) DEFAULT NULL,\r\n\t\t PRIMARY KEY (class_property_id,parser_type)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS template_class"); mysqlQuery("CREATE TABLE IF NOT EXISTS template_class (\r\n\t\t template_id int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t class_id int(11) NOT NULL DEFAULT '0',\r\n\t\t PRIMARY KEY (template_id,class_id),\r\n\t\t UNIQUE KEY class_id (class_id)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS template_parser_type_rule"); mysqlQuery("CREATE TABLE IF NOT EXISTS template_parser_type_rule (\r\n\t\t template_property_id int(11) NOT NULL,\r\n unit_exact_type varchar(255) DEFAULT NULL,\r\n\t\t standard_unit varchar(50) DEFAULT NULL,\r\n \t\t PRIMARY KEY template_property_id (template_property_id, unit_exact_type, standard_unit)\r\n ) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS template_property"); mysqlQuery("CREATE TABLE IF NOT EXISTS template_property (\r\n\t\t name varchar(255) NOT NULL,\r\n\t\t id int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t template_id int(11) NOT NULL,\r\n\t\t PRIMARY KEY (id),\r\n\t\t UNIQUE KEY name (name,template_id)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS template_property_class_property"); mysqlQuery("CREATE TABLE IF NOT EXISTS template_property_class_property (\r\n\t\t template_property_id int(11) NOT NULL,\r\n\t\t class_property_id int(11) NOT NULL,\r\n\t\t PRIMARY KEY (template_property_id,class_property_id)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS template_property_merge_rule"); mysqlQuery("CREATE TABLE IF NOT EXISTS template_property_merge_rule (\r\n\t\t ordered_template_property_ids varchar(255) NOT NULL,\r\n\t\t class_property_id int(11) NOT NULL,\r\n\t\t template_id int(11) NOT NULL,\r\n\t\t UNIQUE KEY ordered_template_property_ids (ordered_template_property_ids,class_property_id)\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); mysqlQuery("DROP TABLE IF EXISTS template_uri"); mysqlQuery("CREATE TABLE IF NOT EXISTS template_uri (\r\n\t\t template_id int(11) NOT NULL,\r\n\t\t uri varchar(255) NOT NULL\r\n\t\t) ENGINE=MyISAM CHARSET=binary;"); }
$result = mysqlQuery("SELECT name, class_id FROM class_property WHERE id NOT IN (SELECT property_id AS id FROM class_property_range) AND TYPE = \"object\" AND class_id >=0", __LINE__); while ($row = mysql_fetch_row($result)) { $property_name = $row[0]; $class_id = $row[1]; echo " " . getClassNameFromClassId($class_id) . "." . $property_name . "\n"; } // get template properties w/o mapping to class property echo "\n\n3. Properties with > 1 Range:\n"; $result = mysqlQuery("SELECT name, class_id, type, datatype_range FROM class_property WHERE class_id >= 1 GROUP BY name HAVING COUNT(name) > 1", __LINE__); $property_names = array(); while ($row = mysql_fetch_row($result)) { $properties[]["name"] = $row[0]; } if (sizeof($properties) > 0) { foreach ($properties as $id => $property) { $result = mysqlQuery("SELECT name, class_id, type, datatype_range FROM class_property WHERE name = '" . $property["name"] . "'", __LINE__); while ($row = mysql_fetch_row($result)) { $properties[$id]["datatype_range"][] = $row[3]; $properties[$id]["type"][] = $row[2]; $properties[$id]["class_id"][] = $row[1]; } foreach ($properties[$id]["type"] as $tid => $type) { if ($tid == 0) { $this_old_type = $type; } if ($this_old_type != $type) { $properties_ranges[$id] = $properties[$id]; } $this_old_type = $type; } }
//Database Server $database_server = "localhost"; //Database Username $database_username = "******"; //Database Password $database_password = "******"; //Name of the database on the MySQL Server $database_name = "oc"; //////////////////////////////////////////////////////////////////////////////////////////////// //Administrators: do not touch anything below this line unless you're a skilled PHP developer!// //////////////////////////////////////////////////////////////////////////////////////////////// $query = "SELECT * FROM vars_text"; $query_2 = "SELECT * FROM vars_numeric"; $database = connectToDatabase(); $result = mysqlQuery($query, $database); $result_2 = mysqlQuery($query_2, $database); while ($result_array = mysql_fetch_array($result)) { //debugArray( "text", $result_array ); $first = stripos($result_array['name'], "'"); $second = stripos($result_array['name'], "'", $first + 1); if ($first > 0 && $second > 0 && $second > $first) { $table_var = substr($result_array['name'], $first + 1, $second - $first - 1); $tables[$table_var] = $result_array['value']; } else { ${$result_array}['name'] = $result_array['value']; } } while ($result_array_2 = mysql_fetch_array($result_2)) { //debugArray( "numeric", $result_array_2 ); ${$result_array_2}['name'] = $result_array_2['value']; }
function updateDatabase($database) { global $tables; if (!$database) { renderError("Account update method was passed a null database resource"); return 0; } if (!$this->first_name || !$this->last_name || !$this->street_address || !$this->city || !$this->state || !$this->zip_code || !$this->email_address || !$this->area_code || !$this->phone_number || !$this->password || !$this->username) { renderError("The update cannot be processed."); return 0; } if ($this->database_id) { //UPDATE table SET field='newval', field2='newval2' WHERE id='$database_id' $query = "UPDATE " . $tables['accounts'] . " SET " . "first_name='" . $this->first_name . "'," . "last_name='" . $this->last_name . "'," . "middle_initial='" . $this->middle_initial . "'," . "street_address='" . $this->street_address . "'," . "city='" . $this->city . "'," . "state='" . $this->state . "'," . "zip_code='" . $this->zip_code . "'," . "email_address='" . $this->email_address . "'," . "area_code='" . $this->area_code . "'," . "phone_number='" . $this->phone_number . "'," . "password='******' WHERE id='" . $this->database_id . "'"; } else { $query = "INSERT INTO " . $tables['accounts'] . " VALUES ( " . "NULL, " . "'" . $this->last_name . "'," . "'" . $this->first_name . "'," . "'" . $this->middle_initial . "'," . "'" . $this->street_address . "'," . "'" . $this->city . "'," . "'" . $this->state . "'," . "'" . $this->zip_code . "'," . "'" . $this->email_address . "'," . "'" . $this->area_code . "'," . "'" . $this->phone_number . "'," . "'" . $this->username . "'," . "'" . $this->password . "' )"; } if (!query) { renderError("Update Failed -- Account update query was empty!!!"); return 0; } $query_result = mysqlQuery($query, $database); if (mysql_error()) { //debug( "query", $query ); renderError("Unknown MySQL Error; " . mysql_error()); return 0; } $query = "SELECT id FROM " . $tables['accounts'] . " WHERE username='******'"; $query_result = mysqlQuery($query, $database); $result_array = mysql_fetch_array($query_result); $this->database_id = $result_array[0]; if (!$this->database_id) { renderError("Account creation successful, but failed to set database id."); return 0; } return 1; }
* GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this software. If not, see <http://www.gnu.org/licenses/>. * * * * index.php: * * Display the fair trade finder map. * * * **************************************************************************/ // General includes include '../config.php'; include '../functions.php'; // Set up templating system require_once "../smarty/Smarty.class.php"; $smarty = new Smarty(); $smarty->template_dir = '../templates'; $smarty->compile_dir = '../smarty/templates_c'; $smarty->cache_dir = '../smarty/cache'; $smarty->config_dir = '.'; $smarty->caching = 0; $smarty->assign('base', $base); $municipalities = array("" => "Select a city..."); $municipalities = fetchMunicipalities($municipalities); $smarty->assign('municipalities', $municipalities); if ($input && is_numeric($input)) { $rowID = $input; $location = mysqlFetchArray(mysqlQuery("SELECT * FROM locations WHERE id=%s", $rowID)); $smarty->assign("location", $location); } $smarty->assign("body", 'list.html'); $smarty->display("wrapper.html");
mysqlQuery("DELETE FROM friends WHERE (depotID1 = '" . $_POST["deleteFriendID"] . "' AND depotID2 = '" . $_SESSION['depot'] . "') OR (depotID2 = '" . $_POST["deleteFriendID"] . "' AND depotID1 = '" . $_SESSION['depot'] . "'); "); exit; } if ($_POST["acceptFriendID"] != "") { mysqlQuery("UPDATE `friends` SET `confirmed`='1' WHERE `id` = '" . $_POST["acceptFriendID"] . "' AND `depotID2` = '" . $_SESSION['depot'] . "'; "); exit; } if ($_POST["friendRequest"] != "") { $id = singleRowQuery("SELECT id FROM depot WHERE id = '" . $_POST["friendRequest"] . "'; "); $id = $id[0]; if ($id != "") { $gegenTest = singleRowQuery("SELECT id FROM friends \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE (depotID1 = '" . $id . "' AND depotID2 = '" . $_SESSION['depot'] . "') \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t OR (depotID2 = '" . $id . "' AND depotID1 = '" . $_SESSION['depot'] . "'); "); $gegenTest = $gegenTest[0]; if ($gegenTest == "") { if ($id != $_SESSION['depot']) { mysqlQuery("INSERT INTO `friends`(`depotID1`, `depotID2`, `confirmed`, `date`) VALUES ('" . $_SESSION['depot'] . "', '" . $id . "', '0','" . date("Y-m-d H:i:s") . "'); "); $friend_error = "Es wurde eine Freundschaftsanfrage versendet !"; } else { $friend_error = "Sie können sich nicht selber eine Freundschaftsanfrage senden !"; } } else { $friend_error = "Es wurde schon eine Freundschaftsanfrage versendet !"; } } else { $friend_error = "Es wurde kein Depot mit der Nummer " . $_POST["friendRequest"] . " gefunden !"; } } ?> <script type="text/javascript">
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty * * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this software. If not, see <http://www.gnu.org/licenses/>. * * * * index.php: * * Display the fair trade finder map. * * * **************************************************************************/ // General includes include '../config.php'; include '../functions.php'; // Set up templating system require_once "../smarty/Smarty.class.php"; $smarty = new Smarty(); $smarty->template_dir = '../templates'; $smarty->compile_dir = '../smarty/templates_c'; $smarty->cache_dir = '../smarty/cache'; $smarty->config_dir = '.'; $smarty->caching = 0; $smarty->assign('base', $base); if ($input && is_numeric($input)) { $rowID = $input; $municipality = mysqlFetchArray(mysqlQuery("SELECT * FROM municipalities WHERE id='%s'", $rowID)); $smarty->assign("municipality", $municipality); $smarty->assign("input", $input); } $smarty->assign("body", 'list.html'); $smarty->display("wrapper.html");
//prüfen ob überhaupt ein feld ausgefüllt wurde if ($_POST["mail"] != "" and $_POST["pass"] != "" and $_POST["name"] != "") { //prüfen ob alle felder ausgefüllt wurden if (filter_var($_POST["mail"], FILTER_VALIDATE_EMAIL)) { //prüfen ob die email eine legale form hat //reCAPTCHA $params = array('secret' => '', 'response' => $_POST["g-recaptcha-response"], 'remoteip' => $_SERVER['REMOTE_ADDR']); //daten die zu google gesendet werden $googleRequest = http_post_flds("https://www.google.com/recaptcha/api/siteverify", $params); //Anfrage an google senden $googleRequestArray = json_decode($googleRequest, true); // Antwort interpretieren if ($googleRequestArray["success"] == "true") { //prüfen ob google reCAPTCHA bestätigt $emailAuth = md5(rand() . date("h:i:s:s:")); mysqlQuery("INSERT INTO depot (name,pass,mail,guthaben,emailAuth,confirmed,date) VALUES ('" . $_POST["name"] . "', '" . md5($_POST["pass"]) . "', '" . $_POST["mail"] . "', '50000', '" . $emailAuth . "', '0','" . date("Y-m-d H:i:s") . "'); "); //Depot anlegen $id = $mysqli->insert_id; $error = "Ihr Depot wurde angelegt ! </br>Es werden Ihnen die Zugangsdaten per Email zugeschickt."; $nachricht = "Hallo " . $_POST["name"] . " !\nIhr Depot wurde für Sie eingerichtet und steht nun bereit.\n\nBevor Sie sich auf ihrem Depot einloggen können müssen sie noch diesen Link bestätigen:\nhttp://boerse.phunsoft.de/authenticate.php?auth=" . $emailAuth . "\n\nSie können sich danach mit folgenden Zugangsdaten einloggen:\nLogin-Webseite: http://boerse.phunsoft.de/depot\nDepot-Nummer: " . $id . "\nPasswort: " . $_POST["pass"] . "\n\t\t\t\t\nIch wünsche Ihnen ein erfolgreiches Börsenspiel\nTim Römisch"; $nachricht = wordwrap($nachricht, 70); mail($_POST["mail"], 'Ihre Zugangsdaten für das Börsenspiel', $nachricht, 'From: info@phunsoft.de'); //info mail senden } else { $error = "Das reCAPTCHA Feld wurde nicht bestätigt !"; } } else { $error = "Es muss eine echte Email-Adresse eingetragen werden !"; } } else { $error = "Es müssen alle Felder ausgefüllt werden !";
$number = 1; while ($result_array = mysql_fetch_array($result)) { echo "<div class='cart_item'>Item #" . $number . "</div>"; displayPreviouslySelectedComponentList($result_array[0], 'cart.php'); echo "<br/>"; $number++; } } else { if (isLoggedIn() && $_GET['edit_id']) { //edit order edit_id displayShippingInfo($_GET['edit_id']); } else { if (isLoggedIn()) { $database = connectToDatabase(); $query = "SELECT *\r\n FROM " . $tables['orders'] . "\r\n WHERE account_id=" . $_SESSION['id'] . " AND placed_date IS NOT NULL"; $result = mysqlQuery($query, $database); $rows = mysql_num_rows($result); if ($rows < 1) { renderError("You have not placed any orders yet."); } else { if ($rows >= 1) { echo "\r\n <table border='1' width='100%'>\r\n <thead>\r\n <tr>\r\n <th><span class='edit_account_table_header'>Shipping Name</span></th>\r\n <th><span class='edit_account_table_header'>Shipping Address</span></th>\r\n <th><span class='edit_account_table_header'>Created Date</span></th>\r\n <th><span class='edit_account_table_header'>Placed Date</span></th>\r\n <th><span class='edit_account_table_header'>Payment Date</span></th>\r\n <th><span class='edit_account_table_header'>Shipped Date</span></th>\r\n <th><span class='edit_account_table_header'>Subtotal</span></th>\r\n <th/>\r\n <th/>\r\n </tr>\r\n </thead><tbody>"; for ($row = 0; $row < $rows; $row++) { $result_array = mysql_fetch_array($result); $name = $result_array['shipping_last_name'] . ", " . $result_array['shipping_first_name'] . " " . $result_array['shipping_middle_initial']; $address = $result_array['shipping_address'] . "<br/>" . $result_array['shipping_city'] . ", " . $result_array['shipping_state'] . " " . $result_array['shipping_zip_code']; $subtotal = number_format($result_array['subtotal'], 2, '.', ','); echo "\r\n <tr>\r\n <td>" . $name . "</td>\r\n <td>" . $address . "</td>\r\n <td>" . $result_array['created_date'] . "</td>\r\n <td>" . $result_array['placed_date'] . "</td>\r\n <td>" . $result_array['payment_date'] . "</td>\r\n <td>" . $result_array['shipped_date'] . "</td>\r\n <td>\$" . $subtotal . "</td>"; echo "<td><span class='edit_accounts'><a href='?view_id=" . $result_array['id'] . "'>[View]</a></span></td>"; if ($result_array['shipped_date']) { echo "<td></td></tr>";
<?php require_once __DIR__ . '/.ignore.calendar-ics-authentication.inc.php'; require_once __DIR__ . '/config.inc.php'; require_once APP_PATH . '/include/canvas-api.inc.php'; require_once APP_PATH . '/include/mysql.inc.php'; require_once __DIR__ . '/common.inc.php'; // FIXME: should filter so that the syncs for the server we're running against (INDEX_WEB_PATH) are called (or is that already happening?) $schedulesResponse = mysqlQuery("\n\tSELECT *\n\t\tFROM `schedules`\n\t\tWHERE\n\t\t\t`schedule` = '" . mysqlEscapeString($argv[INDEX_SCHEDULE]) . "'\n\t\tORDER BY\n\t\t\t`synced` ASC\n"); while ($schedule = $schedulesResponse->fetch_assoc()) { $calendarResponse = mysqlQuery("\n\t\tSELECT *\n\t\t\tFROM `calendars`\n\t\t\tWHERE\n\t\t\t\t`id` = '{$schedule['calendar']}'\n\t"); if ($calendar = $calendarResponse->fetch_assoc()) { shell_exec('curl -u ' . MYSQL_USER . ':' . MYSQL_PASSWORD . ' -k "https://skunkworks.stmarksschool.org/canvas/ics-sync/import.php?cal=' . urlencode($calendar['ics_url']) . '&canvas_url=' . urlencode($calendar['canvas_url']) . '&schedule=' . urlencode($schedule['id']) . '"'); } }