This method allows you to specify multiple (method chaining optional) AND WHERE statements for SQL queries.
public where ( string $whereProp, mixed $whereValue = 'DBNULL', string $operator = '=', string $cond = 'AND' ) : MysqliDb | ||
$whereProp | string | The name of the database field. |
$whereValue | mixed | The value of the database field. |
$operator | string | Comparison operator. Default is = |
$cond | string | Condition of where statement (OR, AND) |
리턴 | MysqliDb |
/** * @description Elimina una comentario * @param $comentario_id */ function removeComentario($comentario_id) { validateRol(0); $db = new MysqliDb(); $db->where("comentario_id", $comentario_id); $results = $db->delete('posts_comentarios'); if ($results) { echo json_encode(1); } else { echo json_encode(-1); } }
function order_paid() { require_once './submodules/php-mysqli-database-class/MysqliDb.php'; require './includes/config.php'; $db = new MysqliDb($db_host, $db_user, $db_pass, $db_name); $payid = $_GET['out_trade_no']; $aPayId = explode('_', $payid); $mtrid = $aPayId[1]; $params = json_encode($_GET); //验证是否已经支付过 $db->where("mtr_id = '{$mtrid}'")->get('mark_trafficpolice_reward'); if ($db->count == 0) { $aNew = array('mtr_id' => $mtrid, 'pay_id' => $payid, 'pay_success' => 1, 'pay_money' => $_GET['total_fee'], 'pay_date' => $_GET['gmt_payment'], 'pay_params' => $params, 'created_date' => $db->now()); $id = $db->insert('mark_trafficpolice_reward', $aNew); //给用户增加余额 $sql = "SELECT mt.user_id,u.user_money FROM `mark_trafficpolice` mt\n LEFT JOIN mark_trafficpolice_received mtr ON mt.id=mtr.mt_id\n LEFT JOIN users u ON u.user_id=mt.user_id\n WHERE mtr.id= '{$mtrid}'"; $aUser = $db->rawQuery($sql); if ($db->count) { $aUpdate = array('user_money' => $aUser[0]['user_money'] + $_GET['total_fee'], 'updated_date' => $db->now()); $db->where('user_id', $aUser[0]['user_id']); $db->update('users', $aUpdate); } } else { echo "already rewarded"; } }
echo json_encode(true); } else { echo json_encode(false); } } /** * esta funcion me retorna un cliente filtrando x email * @param $email */ function update($item) { $db = new MysqliDb(); $decoded = json_decode($item);
echo json_encode(true); } else { echo json_encode(false); } } function update($item) { $db = new MysqliDb(); $decoded = json_decode($item); $db->where('revista_id', $decoded->revista_id); $data = array('nombre' => $decoded->nombre, 'link' => $decoded->link); if ($db->update('revistas', $data)) {
function GET($matches) { if ($matches[1]) { $db = new MysqliDb($this->config["host"], $this->config["user"], $this->config["pass"], $this->config["base"]); $results = $db->where('idphoto', $matches[1])->get('photo', 1); if (!empty($results) && count($results) > 0) { header("Content-Type: image/jpg"); header("Content-Length: " . strlen($results[0]["contenu"])); echo $results[0]["contenu"]; } } }
function saveSlider($slider) { $db = new MysqliDb(); $item_decoded = $slider; // $fotos_decoded = json_decode($producto->fotos); $db->where('oferta_id', $item_decoded->slider_id); $data = array('producto_id' => $item_decoded->producto_id, 'precio' => $item_decoded->precio, 'descripcion' => $item_decoded->descripcion, 'imagen' => $item_decoded->imagen, 'titulo' => $item_decoded->titulo); $results = $db->update('ofertas', $data); $res = ['status' => 1, 'results' => 0]; echo json_encode($results); if ($results) { $res["results"] = $results; echo json_encode($res); } else { $res->status = 0; echo $res; } }
public function routeToCrm($host, $username, $password, $databaseName) { if (isset($_COOKIE['username'])) { $user = $_COOKIE['username']; } if (isset($_COOKIE['mdp'])) { //Récupération du mot de passe stocké $db = new MysqliDb($host, $username, $password, $databaseName); $db->where("user_name", $user); $users = $db->getOne("users"); $pwd = $users['user_hash']; // Création du mot de passe hashé // $mdp = crypt(strtolower($_COOKIE['mdp']),$pwd); $mdp = $_COOKIE['mdp']; } // Login au CRM $url = "http://localhost/mysite/crm74/service/v4_1/soap.php?wsdl"; require_once "../crm74/include/nusoap/lib/nusoap.php"; //retrieve WSDL $client = new nusoap_client($url, 'wsdl'); $proxy = $client->getProxy(); //Affichage des erreurs $err = $client->getError(); if ($err) { echo '<h2>Erreur du constructeur</h2><pre>' . $err . '</pre>'; echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; exit; } // login ---------------------------------------------------- $login_parameters = array('user_auth' => array('user_name' => $user, 'password' => $mdp, 'version' => '1'), 'application_name' => 'SugarTest'); $login_result = $client->call('login', $login_parameters); echo '<pre>'; //get session id $session_id = $login_result['id']; $result = $proxy->seamless_login($session_id); // Ouverture de la session SuiteCRM header("Location: http://localhost/mysite/crm74/index.php?module=Administration&action=index&MSID={$session_id}"); }
<?php //Authentication script require_once 'MysqliDb.php'; $email_id = "*****@*****.**"; //$POST_['email_id']; $password = "******"; //$POST_['password']; $db = new MysqliDb('localhost', 'root', 'hack123', 'colgpolls'); $db->where("email_id", $email_id); $user = $db->getOne("users"); if ($user['password'] == $password) { echo "authenticated"; } else { echo "wrong username or password"; }
if ($password1 != $password2) { header("Location: " . $baseurl . "user/new/provider/?status=error&code=password&" . $querystring); exit; } $secret = "6LfdFBUTAAAAAF40Be_HnpwT_Oj6CyDAsgtLohW_"; $recaptcha = new \ReCaptcha\ReCaptcha($secret); $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); if ($resp->isSuccess()) { // verified! } else { $errors = $resp->getErrorCodes(); header("Location: " . $baseurl . "user/new/provider/?status=error&code=captcha&" . $querystring . "&respcode=" . http_build_query($errors)); exit; } $db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $db->where("email", $email); if ($db->has("users")) { header("Location: " . $baseurl . "user/new/provider/?status=error&code=exists&" . $querystring); exit; } $Auth = new Auth(); // $result = $Auth->createUser($email, $password, $fname, $lname, $is_active = 1, $is_admin = 0, $is_provider = 0, $is_super = 0, $is_verified = 0); $result = $Auth->createUser($email, $password1, $fn, $ln, 1, 0, 1, 0, 0); if ($result['status']) { $attribute = array('pn' => $pn, 'ph' => $ph, 'title' => $prof, 'zip' => $zip); if ($Auth->setAttr($result['id'], $attribute)) { header("Location: " . $baseurl . "user/new/provider/done.php?e=" . $email); } else { die("auth error"); } } else {
/** * @description Mueve una determinada cantidad de un producto a otra sucursal * @param $origen_id * @param $destino_id * @param $producto_id * @param $cantidad */ function trasladar($origen_id, $destino_id, $producto_id, $cantidad) { $db = new MysqliDb(); $cant_a_mover = $cantidad; $stock_origen = $db->rawQuery('select stock_id, cant_actual, costo_uni, proveedor_id from stock where sucursal_id = ' . $origen_id . ' and producto_id = ' . $producto_id . ' order by stock_id asc'); foreach ($stock_origen as $row) { if ($cant_a_mover > 0 && $row["cant_actual"] > 0) { if ($row["cant_actual"] < $cant_a_mover) { $db->where('stock_id', $row['stock_id']); $data = array('cant_actual' => 0); $db->update('stock', $data); $insertar = array('producto_id' => $producto_id, 'proveedor_id' => $row['proveedor_id'], 'sucursal_id' => $destino_id, 'cant_actual' => $cant_a_mover - $row["cant_actual"], 'cant_inicial' => $cant_a_mover - $row["cant_inicial"], 'costo_uni' => $row['costo_uni']); $db->insert('stock', $insertar); $cant_a_mover = $cant_a_mover - $row["cant_actual"]; } if ($row["cant_actual"] > $cant_a_mover) { $db->where('stock_id', $row['stock_id']); $data = array('cant_actual' => $row["cant_actual"] - $cant_a_mover); $db->update('stock', $data); $insertar = array('producto_id' => $producto_id, 'proveedor_id' => $row['proveedor_id'], 'sucursal_id' => $destino_id, 'cant_actual' => $cant_a_mover, 'cant_inicial' => $cant_a_mover, 'costo_uni' => $row['costo_uni']); $db->insert('stock', $insertar); $cant_a_mover = 0; } if ($row["cant_actual"] == $cant_a_mover) { $db->where('stock_id', $row['stock_id']); $data = array('cant_actual' => 0); $db->update('stock', $data); $insertar = array('producto_id' => $producto_id, 'proveedor_id' => $row['proveedor_id'], 'sucursal_id' => $destino_id, 'cant_actual' => $cant_a_mover, 'cant_inicial' => $cant_a_mover, 'costo_uni' => $row['costo_uni']); $db->insert('stock', $insertar); $cant_a_mover = 0; } } } echo json_encode($db->getLastError()); }
/** * @descr Obtiene los productos. En caso de enviar un usuario_id != -1, se traerán todos los carritos. Solo usar esta opción cuando se aplica en la parte de administración */ function getCarritos($usuario_id) { $db = new MysqliDb(); if ($usuario_id != -1) { $db->where('c.usuario_id', $usuario_id); } $db->join("usuarios u", "u.usuario_id=c.usuario_id", "LEFT"); $results = $db->get('carritos c', null, 'c.carrito_id, c.status, c.total, c.fecha, c.usuario_id, u.nombre, u.apellido'); foreach ($results as $key => $row) { $db = new MysqliDb(); $db->where('carrito_id', $row['carrito_id']); $db->join("productos p", "p.producto_id=c.producto_id", "LEFT"); $productos = $db->get('carrito_detalles c', null, 'c.carrito_detalle_id, c.carrito_id, c.producto_id, p.nombre, c.cantidad, c.en_oferta, c.precio_unitario'); $results[$key]['productos'] = $productos; } echo json_encode($results); }
echo '<html lang="en">' . "\n"; echo ' <head>' . "\n"; echo ' <meta charset="utf-8">' . "\n"; echo ' <title>Log In</title>' . "\n"; echo ' <link rel="stylesheet" type="text/css" href="css/login_form.css">' . "\n"; echo ' </head>' . "\n"; echo ' <body>' . "\n"; if (isset($_POST['submitted'])) { $submited = $_POST['submitted']; $name = explode(" ", $_POST['name']); $pass = $_POST['pass']; if (isset($pass) && !empty($pass)) { if (isset($name) && !empty($name[0])) { if (count($name) >= 1 && count($name) <= 2) { if (count($name) > 1) { $db->where('fName', $name[0]); $db->where('lName', $name[1]); } else { $db->where('fName', $name); $db->orWhere('lName', $name); } $user = $db->getOne("Users"); $hash = $user['password']; if (password_verify($pass, $hash)) { echo 'Password is valid!'; $_SESSION['user'] = new User($user['id'], $user['fName'], $user['lName'], $user['admin']); } else { echo 'Invalid password.'; } } else { echo "invalid Name given";
/** * @description Retorna las donaciones, en caso de ser la consulta de un usuario, solo trae las del usuario * @param $usuario_id */ function getDonaciones($usuario_id) { $db = new MysqliDb(); $where = ''; if ($usuario_id != -1) { $where = 'c.donador_id in (select usuario_id from proyectos p1 where p1.proyecto_id = p.proyecto_id)'; } $results = $db->rawQuery('donaciones c', null, 'c.donacion_id, c.status, c.total, c.fecha, c.usuario_id, u.nombre, u.apellido'); foreach ($results as $key => $row) { $db = new MysqliDb(); $db->where('donacion_id', $row['donacion_id']); $db->join("proyectos p", "p.proyecto_id=c.proyecto_id", "LEFT"); $proyectos = $db->get('donacion_detalles c', null, 'c.donacion_detalle_id, c.donacion_id, c.proyecto_id, p.nombre, c.cantidad, c.en_oferta, c.precio_unitario'); $results[$key]['proyectos'] = $proyectos; } echo json_encode($results); }
$form = new Form(); $log = new LogActivity(); $db2 = new MysqliDb(DBHOST, DBUSER, DBPASS, DBNAME); isset($_POST['page']) ? $currentPage = $_POST['page'] : ($currentPage = 0); $pageLimit = 50; if ($currentPage == 0) { $currentPage = 1; } $limitFrom = $pageLimit * $currentPage - $pageLimit; switch ($_POST['f']) { //search by region case 'fetch_logs': //db2 is for getting total number of rows if (isset($_POST['search_term']) && $_POST['search_term'] != null) { $db->where('action LIKE "%' . $_POST['search_term'] . '%"'); $db2->where('action LIKE "%' . $_POST['search_term'] . '%"'); } else { $db->where('action LIKE "%%"'); $db2->where('action LIKE "%%"'); } if (isset($_POST['user']) && $_POST['user'] != null) { $db->where('user_id="' . $_POST['user'] . '"'); $db2->where('user_id="' . $_POST['user'] . '"'); } else { $db->where('user_id LIKE "%%"'); $db2->where('user_id LIKE "%%"'); } $db->orderBy("date_time", "DESC"); $results = $db->get("log_activity", array($limitFrom, $pageLimit)); //$db->echoQuery(); $db2->withTotalCount()->get("log_activity");
<?php require_once 'MysqliDb.php'; require_once 'constantes.php'; $bd = new MysqliDb(SERVER_DB_URL, SERVER_DB_USUARIO, SERVER_DB_PASS, SERVER_DB_NOMBRE); if (!$bd->ping()) { $bd->connect(); } if ($_SERVER["REQUEST_METHOD"] == REQUEST_METODO_POST) { $postdata = json_decode(file_get_contents('php://input')); $usuario_form = $postdata->usuario; $pass_form = md5($postdata->pass); $bd->where(COLUMNA_EMAIL, $usuario_form); $bd->where(COLUMNA_PASS, $pass_form); if ($bd->has(TABLA_USUARIO)) { $arr = array(RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO); } else { $arr = array(RESPUESTA_ERROR => ERROR_PHP_POST); } $jsn = json_encode($arr); print_r($jsn); }
function getCupones($cliente_id, $numero) { $db = new MysqliDb(); $db->join("clientes c", "c.cliente_id=u.cliente_id", "LEFT"); if ($cliente_id != -1) { $db->where('u.cliente_id', $cliente_id); } if ($numero != -1) { $db->where('c.numero', $numero); } $result = $db->get('cupones u', null, 'u.numero, u.fecha, c.mail'); echo json_encode($result); }
/** * @description Elimina una sucursal * @param $sucursal_id */ function removeSucursal($sucursal_id) { $db = new MysqliDb(); $db->where("sucursal_id", $sucursal_id); $results = $db->delete('sucursales'); if ($results) { echo json_encode(1); } else { echo json_encode(-1); } }
<div id="msgPanel" class="ui-widget-content"> <h3 class="ui-widget-header">Communicator</h3> <div id="msgTabs"> <ul> <li> <a href="#chatPane">Chat</a> </li> <li> <a href="#pmPane">Private Message</a> </li> </ul> <div id="chatPane"> <?php $posts = $db->get('Posts'); foreach ($posts as $x) { echo '<label><font color="blue">' . $db->where('id', $x['uId'])->getOne('Users')['fName'] . '</font></label>:<span> ' . $x['message'] . '</span><br />' . "\n"; } ?> </div> <div id="pmPane"> <div id="pmAccordion"> <?php $members = $db->where('pId', '0')->get('Parties'); foreach ($members as $member) { echo '<h4>' . $db->where('id', $member['uId'])->getOne('Users')['fName'] . "</h4>\n<div></div>\n"; } ?> <h4>Eric Collett</h4> <div></div> <h4>Ryan King</h4> <div></div>
public function logout() { if ($this->checkSession() == "auth") { $db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $db->where('user_id', $_SESSION['user_id']); $db->delete('logged_in_member'); session_destroy(); return true; } else { return true; } }
require_once 'smarty-3.1.21/libs/Smarty.class.php'; require_once 'vendor/autoload.php'; require_once $ROOTPATH . 'modules/GeodevDB.php'; require_once $ROOTPATH . 'modules/Member.php'; require_once $ROOTPATH . 'modules/convTime.php'; ini_set('date.timezone', 'Europe/Berlin'); $smarty = new Smarty(); $smarty->setTemplateDir($ROOTPATH . 'smarty/templates'); $smarty->setCompileDir($ROOTPATH . 'smarty/templates_c'); $smarty->setCacheDir($ROOTPATH . 'smarty/cache'); $smarty->setConfigDir($ROOTPATH . 'smarty/configs'); $smarty->assign('returnURL', $_SERVER['REQUEST_URI']); $smarty->assign('ROOT', $ROOT); $db = new MysqliDb(array('host' => $dbhost, 'username' => $dbuser, 'password' => $dbpass, 'db' => $dbname, 'charset' => 'utf8')); if ($_SERVER['HTTP_HOST'] == 'localhost') { ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); } else { error_reporting(E_ERROR | E_PARSE); } if (isset($_SESSION["user"]["meetup_id"])) { if (isset($_SESSION['logged'])) { $db->where("meetup_id", $_SESSION["user"]['meetup_id']); $user = $db->getOne("users"); $_SESSION["user"]['cookies'] = $user['cookies']; $_SESSION["user"]['newsletter'] = $user['mailchimp_euid'] ? $user['mailchimp_euid'] : 0; } $smarty->assign("USER", $_SESSION["user"]); $smarty->assign("SESSION", $_SESSION); }
<?php require_once 'MysqliDb.php'; /* updates voting colums for upvote and downvote */ $pid = $vote = $db = new MysqliDb('localhost', 'root', 'hack123', 'colgpolls'); if ($vote == 'yes') { $data = array('upvote' => $db->inc(1)); } else { $data = array('downvote' => $db->inc(1)); } $db->where('pid', $pid); $db->update('polls', $data);
<?php require_once 'MysqliDb.php'; require_once 'constantes.php'; $bd = new MysqliDb(SERVER_DB_URL, SERVER_DB_USUARIO, SERVER_DB_PASS, SERVER_DB_NOMBRE); if (!$bd->ping()) { $bd->connect(); } if ($_SERVER["REQUEST_METHOD"] == REQUEST_METODO_POST) { $postdata = json_decode(file_get_contents('php://input')); $usuario_form = $postdata->usuario; $pass_form = md5($postdata->pass); $bd->where(COLUMNA_EMAIL, $usuario_form); $bd->where(COLUMNA_PASS, $pass_form); if ($bd->has(TABLA_USUARIO)) { // CORRECTO $accion_form = $postdata->form_accion; if ($accion_form == ACCION_OBTENER) { $query = $bd->get(TABLA_PRODUCTO); foreach ($query as $parametro_key => $parametro_valor) { // AGREGOS LAS CATEGORIAS A LA QUE PERTENECE CADA PRODUCTO $bd->where(COLUMNA_ID_PRODUCTO, $parametro_valor[COLUMNA_ID_M]); $referencias = $bd->get(TABLA_REL_PRODUCTO_CATEGORIA); $parametro_valor[VALOR_CATEGORIAS] = $referencias; $query[$parametro_key] = $parametro_valor; } $arr = array(RESPUESTA_DATA => $query, RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO); } else { if ($accion_form == ACCION_AGREGAR) { $data_post = $postdata->form_data; if (!isset($data_post->FOTO)) {
public function getUserReport($uid) { $db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $db->where('uid', $uid); $db->orderBy("id", "Desc"); $result = $db->get("activities"); return $result; }
/** * @Author: ananayarora * @Date: 2016-01-10 14:28:50 * @Last Modified by: ananayarora * @Last Modified time: 2016-01-10 21:22:46 */ session_start(); if (isset($_SESSION['loggedin'])) { header("Location: discover.php"); } if (isset($_POST['submit'])) { require 'conf.php'; require 'sql.php'; $c = new Conf(); $o = new MysqliDb($c->host, $c->username, $c->password, $c->db); $o->where("username", $_POST['username']); $o->where("password", md5($_POST['password'])); $o->get("users"); if ($o->count == 1 && !isset($_GET['next'])) { header("Location: discover.php"); $_SESSION['loggedin'] = true; $_SESSION['username'] = $_POST['username']; } elseif ($o->count == 1 && isset($_GET['next'])) { header("Location: " . $_GET['next']); $_SESSION['loggedin'] = true; $_SESSION['username'] = $_POST['username']; } elseif ($o->count == 0 && !isset($_GET['next'])) { header("Location: signin.php?wrong"); } elseif ($o->count == 0 && isset($_GET['next'])) { header("Location: signin.php?wrong&next=" . $_GET['next']); }
/** * Get object by primary key. * * @access public * @param $id Primary Key * @param array|string $fields Array or coma separated list of fields to fetch * * @return dbObject|array */ private function byId($id, $fields = null) { $this->db->where(MysqliDb::$prefix . $this->dbTable . '.' . $this->primaryKey, $id); return $this->getOne($fields); }
<?php require __DIR__ . '/vendor/autoload.php'; $params = array_merge(require __DIR__ . '/config.php'); $db = new MysqliDb($params['db_config']); $sount = 0; $i = 0; $Error = ''; $neworderarray['0'] = ""; $neworderarray = array_merge($neworderarray, $_POST['neworder']); unset($neworderarray['0']); //loop through the list of ids and update your db foreach ($neworderarray as $order => $id) { $data = array('sort' => $order); $db->where('id', $id); if ($db->update('sob', $data)) { $count++; } else { $Error = $Error . '' . $db->getLastError(); } $i++; } if ($count != $i) { echo $Error; } else { $sob = dbObject::table('sob')->get(); $db->orderBy("sort", "asc"); $sob = sob::get(); foreach ($sob as $s) { $m[] = round($s->kef, 2); }
<?php require_once 'MysqliDb.php'; require_once 'constantes.php'; $bd = new MysqliDb(SERVER_DB_URL, SERVER_DB_USUARIO, SERVER_DB_PASS, SERVER_DB_NOMBRE); if (!$bd->ping()) { $bd->connect(); } if ($_SERVER['REQUEST_METHOD'] == REQUEST_METODO_POST) { $postdata = json_decode(file_get_contents('php://input')); $usuario_form = $postdata->usuario; $pass_form = md5($postdata->pass); $bd->where(COLUMNA_EMAIL, $usuario_form); $bd->where(COLUMNA_PASS, $pass_form); if ($bd->has(TABLA_USUARIO)) { // CORRECTO $accion_form = $postdata->form_accion; if ($accion_form == ACCION_OBTENER) { $query = $bd->get(TABLA_CATEGORIA); $arr = array(RESPUESTA_DATA => $query, RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO); } else { if ($accion_form == ACCION_OBTERNER_POR_ID) { $parametros = $postdata->form_parametros; foreach ($parametros as $parametro_key => $parametro_valor) { // var_dump($parametro_key); // var_dump($parametro_valor); foreach ($parametro_valor as $key => $val) { // var_dump($key); // var_dump($val); switch ($key) { case PARAMETRO_ID:
function getNoticias() { $db = new MysqliDb(); $results = $db->rawQuery('Select noticia_id, titulo, detalles, fecha, creador_id, vistas, tipo, 0 fotos, 0 comentarios from noticias;'); foreach ($results as $key => $row) { $db->where('noticia_id', $row["noticia_id"]); $fotos = $db->get('noticias_fotos'); $results[$key]["fotos"] = $fotos; $db->where('noticia_id', $row["noticia_id"]); $comentarios = $db->get('noticias_comentarios'); $results[$key]["comentarios"] = $comentarios; } echo json_encode($results); }
$attractioncount = $_POST['attractioncount']; $postaction = $_POST['postaction']; $trans_id = $_POST['trans_id']; $attractions = array(); $i = 0; while ($i <= $attractioncount) { array_push($attractions, rawurlencode($_POST['attraction' . $i])); $i++; } $loops = array(); $i = 1; while ($i <= $loopcount) { $loops[$i]["name"] = $_POST['loop' . $i]; $i++; } $data = array('trail_id' => $id, 'lang' => $lang, 'desc' => $desc, 'lighting' => $lighting, 'surface' => $surface, 'parking' => $parking, 'facilities' => $facilities, 'hours' => $hours, 'attractions' => addslashes(json_encode($attractions)), 'loops' => addslashes(json_encode($loops))); if ($postaction == "update") { $db->where('id', $trans_id); if ($db->update('translations', $data)) { header("Location: " . $baseurl . "admin/translate/done.php?status=update&id=" . $id . "&lang=" . $lang); } else { echo 'update failed: ' . $db->getLastError(); } } else { $id = $db->insert('translations', $data); if ($id) { header("Location: " . $baseurl . "admin/translate/done.php?id=" . $id . "&lang=" . $lang); } else { echo 'insert failed: ' . $db->getLastError(); } }
/** * @Author: ananayarora * @Date: 2016-01-14 20:08:08 * @Last Modified by: ananayarora * @Last Modified time: 2016-01-14 23:41:31 */ if (!isset($_GET['id'])) { header("Location: index.php"); } require 'header.php'; require 'conf.php'; require 'sql.php'; $c = new Conf(); $o = new MysqliDb($c->host, $c->username, $c->password, $c->db); $o->where("id", $o->escape($_GET['id'])); $k = $o->get("startups"); ?> <center> <div class="main_startup"> <div style='background-image:url("<?php echo $k[0]['imageurl']; ?> ");' class="startup_photo"></div> <div class="startup_details"> <h3 class="startup_name"><?php echo $k[0]['name']; ?> </h3> <p class="oneliner"><?php echo $k[0]['oneliner'];