/** * Devuelve el error del campo pedido con el formato requerido. * @param unknown $field * @return string */ function escribirError($field) { $error_dado = getError($field); if ($error_dado) { return '<span class="error">' . $error_dado . '</span>'; } }
/** * Gets setting value from config.xml file. * @param sWidget - widget's name. * @param $sSettingKey - setting's key. */ function getSettingValue($sWidget, $sSettingKey, $sFile = "config", $bFullReturn = false, $sFolder = "xml") { global $sModulesPath; global $aXmlTemplates; global $aErrorCodes; //--- Read file ---// $sWidgetFile = $sWidget . "/" . $sFolder . "/" . $sFile . ".xml"; $sFileName = $sModulesPath . $sWidgetFile; if (!file_exists($sFileName)) { if ($bFullReturn) { return array('value' => getError($aErrorCodes[1], $sWidgetFile), 'status' => FAILED_VAL); } else { return ""; } } $sConfigContents = makeGroup("", "items"); if (($rHandle = @fopen($sFileName, "rt")) !== false && filesize($sFileName) > 0) { $sConfigContents = fread($rHandle, filesize($sFileName)); fclose($rHandle); } //--- Update info ---// $sValue = xmlGetValue($sConfigContents, "item", $sSettingKey); if ($bFullReturn) { return array('value' => $sValue, 'status' => SUCCESS_VAL); } else { return $sValue; } }
/** * Update */ public function update($data) { extract($data); $stmt = $this->db->prepare("UPDATE `agreement` SET content = :content WHERE id = 1"); $stmt->bindParam(':content', $agreement, PDO::PARAM_STR); getError($stmt); $stmt->execute(); }
/** * Add new */ public function addnew($array) { extract($array); $query = $this->db->prepare('INSERT INTO `databases` (databasename,shortcode,type,help) VALUES (:databasename,:shortcode,:type,:help)'); $query->bindParam(':databasename', $database, PDO::PARAM_STR); $query->bindParam(':shortcode', $code, PDO::PARAM_STR); $query->bindParam(':type', $type, PDO::PARAM_INT); $query->bindParam(':help', $help, PDO::PARAM_STR); $query->execute(); getError($query); }
/** * Handle error code from modules and send textual message if needed */ function AjaxController_sendResponse($errorCode, $onSuccess) { if ($errorCode < 0) { $status = 'error'; $message = getMessage(getError($errorCode)); } else { $status = 'success'; $message = getMessage($onSuccess); } echo json_encode(['status' => $status, 'message' => $message]); }
public function ByAffiliate($id) { $stmt = $this->db->query("SELECT affiliates.affiliate_name,MONTHNAME(requests.created_at) AS month,YEAR(requests.created_at) as year,\n\t\t\t\t\t\t\t\t\t clients.name,COUNT(*) as requests\n\t\t\t\t\t\t\t \t\t FROM `clients`\n\t\t\t\t\t\t\t\t\t INNER JOIN affiliates ON clients.affiliate_id = affiliates.id\n INNER JOIN requests ON clients.id = requests.client_id\n WHERE clients.affiliate_id = '{$id}'\n\t\t\t\t\t\t\t\t\t GROUP BY YEAR(requests.created_at),MONTH(requests.created_at) \n\t\t\t\t\t\t\t\t\t ORDER BY affiliates.affiliate_name ,requests.created_at ASC\n\t\t\t\t\t\t\t\t\t "); $stmt->setFetchMode(\PDO::FETCH_ASSOC); //If PDO error getError($stmt); while ($result = $stmt->fetch()) { $this->results[] = $result; } return (is_null($this->results) or empty($this->results)) ? array() : $this->results; }
/** * Update */ public function update($data) { extract($data); $stmt = $this->db->prepare("UPDATE `contact` SET address = :address,contact = :contact,facebook = :facebook,twitter = :twitter,google = :google WHERE id = 1"); $stmt->bindParam(':address', $address, PDO::PARAM_STR); $stmt->bindParam(':contact', $contact, PDO::PARAM_STR); $stmt->bindParam(':facebook', $facebook, PDO::PARAM_STR); $stmt->bindParam(':twitter', $twitter, PDO::PARAM_STR); $stmt->bindParam(':google', $google, PDO::PARAM_STR); getError($stmt); $stmt->execute(); }
/** * Fetch all tables for * a database **/ public function lists() { $this->cutOffExpiredAffiliate(); $stmt = $this->db->query("SELECT * FROM `affiliates` LEFT JOIN affiliate_plan\n\t\t\t\t\t\t\t\t ON affiliates.id = affiliate_plan.affiliate_id \n\t\t\t\t\t\t\t\t ORDER BY affiliate_name"); $stmt->setFetchMode(\PDO::FETCH_ASSOC); //If PDO error getError($stmt); while ($result = $stmt->fetch()) { $this->results[] = $result; } // var_dump($this->results); return (is_null($this->results) or empty($this->results)) ? array() : $this->results; }
function set_error($error, $tolink, $act = false, $error_sta = "error") { //Establecemos en sesion el error if (empty($error)) { return false; } if ($act) { $sess_array = array('Error' => array('titulo' => 'Error!', 'mensaje' => $error), 'Error_Sta' => $error_sta); } else { $sess_array = array('Error' => getError($error), 'Error_Sta' => $error_sta); } $CI =& get_instance(); $CI->session->set_userdata($sess_array); redirect(base_url($tolink)); }
function getError($edu, $kirjutamisel, int $i) { $edu = ucword($edu); $vahe = $i++; $summa = $edu + $kirjutamisel; $mingiTehe = $edu - $vahe + $edu; echo $summa . " ei tea midagi"; $edu = mb_strtolower($edu); if ($i > 0) { $i = -10; $edu = getError($i, $kirjutamisel); $edu = ucfirst . getError; } return $edu; }
function log_error($error_code, $model = '') { $CI =& get_instance(); # ensure we have an array in the $response object to hold our error if (!empty($CI->response)) { if (!isset($CI->response->errors) or is_null($CI->response->errors)) { $CI->response->errors = array(); } } # this object will hold this specific error data and be added to the above array at the end $error = new stdClass(); $error->code = $error_code; $error->file = 'system'; $error->model = $model; if (function_exists('getError')) { $error = getError($error->code); $error->message = $error->title; } // log the details of the error to the log file stdlog($error); if (!empty($error->controller) and !empty($eror->function)) { $error->controller = $error->controller . '::' . $error->function; } else { $error->controller = ''; } unset($error->function); // if the error is severe enough, set the error in the response object if (isset($error->severity) and $error->severity <= 3) { error_reporting(E_ALL); unset($error->file); # we don't care about where this was logged (into which file) unset($error->message); # this is for logging only and is already contained in the $error->title $error->link = $CI->config->config['oa_web_folder'] . '/index.php/errors/' . $error->code; if (!empty($CI->response)) { $CI->response->errors[] = $error; $CI->response->meta->header = $error->status; } } }
function ejecutar_consulta($consulta) { $mysqli = conexion(); if (!$mysqli) { return getError($mysqli); } $result = mysqli_query($mysqli, $consulta); if ($result) { if (mysqli_num_rows($result) > 0) { $datos = array(); while ($row = mysqli_fetch_assoc($result)) { $datos[] = $row; } mysqli_free_result($result); mysqli_close($mysqli); return $datos; } } mysqli_free_result($result); mysqli_close($mysqli); return mysqli_errno($mysqli); }
public function __construct() { parent::__construct(); // log the attempt stdlog(); # ensure our URL doesn't have a trailing / as this may break image (and other) relative paths $this->load->helper('url'); if (strrpos($_SERVER['REQUEST_URI'], '/') === strlen($_SERVER['REQUEST_URI']) - 1) { redirect(uri_string()); } $this->load->helper('network'); $this->load->helper('output'); $this->load->helper('error'); $this->load->helper('input'); $this->load->model('m_devices'); $this->load->model('m_orgs'); inputRead(); $this->output->url = $this->config->item('oa_web_index'); if ($this->response->meta->id != '') { $access_level = $this->m_devices->get_user_device_org_access(); if ($access_level < 1) { // we should determine if the device does actually exist or not // then we can throw the correct status code of 404 or 403 $sql = "SELECT system.id FROM system WHERE system.id = ?"; $data = array($this->response->meta->id); $query = $this->db->query($sql, $data); $result = $query->result(); if (count($result) == 0) { $this->response->errors[] = getError('ERR-0007'); } else { $this->response->errors[] = getError('ERR-0008'); } $this->response->meta->header = $this->response->errors[0]->status; output($this->response); exit; } } }
<link href="css/login.css" rel='stylesheet' type='text/css' /> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script> <title>ccms Admin Login</title> </head> <body> <div class="main"> <div style="text-align: center;"> <img src="images/ccms.png" height="250" class="img-responsive" alt="ccms"> </div> <div class="login"> <div class="error"> <?php getError($i, _e('wrong_username_password', '', '', true)); ?> </div> <div class="inset"> <!-----start-main----> <form action="" method="POST"> <div> <span><label>Username</label></span> <span><input type="text" class="textbox" placeholder="<?php _e('username'); ?> " name="username" required></span><!--id="active"--> </div> <div> <span><label>Password</label></span> <span><input type="password" class="password" placeholder="<?php
/** * Update table details */ public function update($data) { extract($data); $stmt = $this->db->prepare("UPDATE `tables` SET table_name = :table ,code = :code WHERE id = :table_id"); $stmt->bindParam(':table', $table, PDO::PARAM_STR); $stmt->bindParam(':code', $code, PDO::PARAM_STR); $stmt->bindParam(':table_id', $table_id, PDO::PARAM_INT); getError($stmt); $stmt->execute(); }
header("Location: logout.php"); exit; } require_once dirname(dirname(dirname(__FILE__))) . '/functions.php'; // require_once(dirname(__file__) . '/functions.php'); require_once dirname(dirname(__FILE__)) . '/wp-load.php'; date_default_timezone_set('Asia/Tokyo'); $queryList = getSQLQuery(getPDO()); $censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]); $regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]); $fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]); $procLockData = getProcLockData(getPDO(), $queryList["SELECT_PROCLOCK"]); $threadData = getThreadDataAll(getPDO(), $queryList["SELECT_THREAD_FOR_SUSPEND"]); $threadDataCount = count($threadData); $nonce = wp_create_nonce(); $error = getError(getPDO(), $queryList["SELECT_ERROR"]); ?> <!DOCTYPE html> <html> <head> <title>StealSystem</title> <meta name="viewport" content="width=device-width"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="<?php echo $fixedList["scriptUrl"]; ?> /js/matome.js"></script> <link rel="stylesheet" type="text/css" href="style.css"> <script> <?php
/** * Update table details */ public function updateSector($data) { extract($data); $stmt = $this->db->prepare("UPDATE `sectors` SET name = :name WHERE id = :id"); $stmt->bindParam(':name', $name, PDO::PARAM_STR); $stmt->bindParam(':id', $id, PDO::PARAM_INT); getError($stmt); $stmt->execute(); }
/** * gets file contents * @param sWidget - the name of the widget. * @param sCase - skins/langs */ function getFileContents($sWidget, $sFile, $bArray = false) { global $sModulesPath; global $aErrorCodes; $sFile = $sWidget . $sFile; $sFileName = $sModulesPath . $sFile; if (!file_exists($sFileName)) { return array('value' => getError($aErrorCodes[1], $sFile), 'status' => FAILED_VAL, 'contents' => $bArray ? array() : ""); } $rHandle = fopen($sFileName, "rt"); $iFileSize = filesize($sFileName); $sContents = $iFileSize > 0 ? fread($rHandle, filesize($sFileName)) : makeGroup("", "items"); fclose($rHandle); $aContents = xmlGetValues($sContents, "item"); return array('value' => "", 'status' => SUCCESS_VAL, 'contents' => $bArray ? $aContents : $sContents); }
You should have received a copy of the GNU General Public License along with Cybermin; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 2006 Namont Nicolas include/admin_form_inter.php V0.1 */ // Formulaire de creation d'une intervention switch ($_GET["error"]) { case 1: echo getError(4); break; case 2: echo getError(0); break; } ?> <div class="row"> <section class="col-lg-7 connectedSortable"> <form method="post" action="index.php?a=3" role="form"> <div class="box box-success"><div class="box-header"><h3 class="box-title">Détail de l'intervention</h3></div> <div class="box-body"> <div class="form-group"><label>Titre</label> <input type="text" name="titr" class="form-control"></div> <div class="form-group"><label>Date*</label> <input type="text" name="date" style="width:100px;" maxlength="10" class="form-control" value="<?php
if (is_array($url)) { $htmlurl = $url[0]; if (array_search($uri, $url) !== false || array_search($_SERVER['REQUEST_URI'], $url) !== false) { $active = ' class="active"'; } } else { $htmlurl = htmlspecialchars($url); if ($url == $uri || $SETTINGS['path'] . $url == $_SERVER['REQUEST_URI']) { $active = ' class="active"'; } } $navbar .= "<li{$active}><a href=\"{$SETTINGS['path']}{$htmlurl}\">{$htmlname}</a></li>\n"; } $navbar .= '</ul>'; } $error = getError(); $warning = false; $info = getInfo(); $boxes = ''; if ($error !== false) { $error_html = htmlspecialchars($error, 0, 'UTF-8'); $boxes .= "<p class=\"error\"><img src=\"{$SETTINGS['path']}/images/icons/error.png\" alt=\"Fehler:\" /> {$error_html}</p>\n"; } if ($warning !== false) { $warning_html = htmlspecialchars($warning, 0, 'UTF-8'); $boxes .= "<p class=\"warning\"><img src=\"{$SETTINGS['path']}/images/icons/error.png\" alt=\"Warnung:\" /> {$warning_html}</p>\n"; } if ($info !== false) { $info_html = htmlspecialchars($info, 0, 'UTF-8'); $boxes .= "<p class=\"info\"><img src=\"{$SETTINGS['path']}/images/icons/information.png\" alt=\"Information:\" /> {$info_html}</p>\n"; }
$title = $_POST['title']; $description = $_POST['description']; $dir = VIDEO_DIR; $files = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) != false) { if ($file != '.' && $file != '..') { $files[] = $file; } } } } if (!in_array($filename, $files)) { http_response_code(400); echo '{"message": "The file was not found.", "info": "The file \'' . $filename . '\' does not exist.","success": false}'; return; } openConnection(); $safeFilename = mysqli_escape_string($connection, $filename); $safeTitle = mysqli_escape_string($connection, $title); $safeDescription = mysqli_escape_string($connection, $description); $query = "INSERT INTO `episode` (`filename`, `title`, `description`) VALUES ('{$safeFilename}', '{$safeTitle}', '{$safeDescription}');"; if (runQuery($query)) { $episodeID = mysqli_insert_id($connection); echo "{\"id\": {$episodeID}, \"filename\": \"{$safeFilename}\", \"title\": \"{$safeTitle}\", \"description\": \"{$safeDescription}\"}"; } else { http_response_code(400); echo '{"message":"There was a problem creating the episode.", "info": "mysql error -' . getError() . '", "query": "' . $query . '","success": false}'; } closeConnection();
} ?> </tbody></table></div></div> <div class="box"> <div class="box-header"><h3 class="box-title">Autre matériel</h3></div> <div class="box-body no-padding"> <table class="table"> <thead><tr> <th>Nom</th><th>OS</th><th>Salle</th><th>Commentaires</th><th> </th><th> </th></tr></thead><tbody> <?php $result = getMaterielFromEpn($epn); if (FALSE == $result) { echo getError(0); } else { $nb = mysqli_num_rows($result); if ($nb == 0) { echo getError(9); } else { $usage = 3; // usage par defaut for ($i = 0; $i < $nb; $i++) { $row = mysqli_fetch_array($result); $salle = getNomsalleforAnim($row["id_salle"]); if ($row["usage_computer"] == $usage) { ?> <tr> <td><?php echo $row["nom_computer"]; ?> </td> <td><?php echo $row["os_computer"];
function generate_thumbnail($sURL, $needConnect) { if (!is_logged_in()) { return getError("no logged-in user"); } $res = array(); //get picture from service //"http://www.sitepoint.com/forums/image.php?u=106816&dateline=1312480118"; $remote_path = str_replace("[URL]", $sURL, WEBSITE_THUMBNAIL_SERVICE); $heurist_path = tempnam(HEURIST_UPLOAD_DIR, "_temp_"); // . $file_id; /*****DEBUG****/ //error_log("22222 WE ARE HERE! ".$remote_path." ".$heurist_path); $filesize = saveURLasFile($remote_path, $heurist_path); /*****DEBUG****/ //error_log(">>>>>SAVED SIZE=".$filesize); if ($filesize > 0) { //check the dimension of returned thumbanil in case it less than 50 - consider it as error if (strpos($remote_path, substr(WEBSITE_THUMBNAIL_SERVICE, 0, 24)) == 0) { $image_info = getimagesize($heurist_path); if ($image_info[1] < 50) { //remove temp file unlink($heurist_path); return getError("Thumbnail generator service can't create the image for specified URL"); } } $fileID = upload_file("snapshot.jpg", "jpg", $heurist_path, null, $filesize, $sURL, $needConnect); if (is_numeric($fileID)) { $res = get_uploaded_file_info($fileID, $needConnect); } else { $res = getError("File upload was interrupted. " . $fileID); } /*****DEBUG****/ //error_log("22222 FILE ID=".$fileID); } else { $res = getError("Can't download image"); } return $res; }
/** * */ private function assign($table, $level, $frequency, $variable, $to, $from, $code) { $query = $this->db->prepare('INSERT INTO `frequency_table_variable`(table_id,level_id, frequency_id,variable_id, date_to,date_from, generic_table_code) VALUES(:table,:level, :frequency,:variable, :date_to,:date_from, :code)'); $query->bindParam(':table', $table, PDO::PARAM_INT); $query->bindParam(':level', $level, PDO::PARAM_INT); $query->bindParam(':frequency', $frequency, PDO::PARAM_INT); $query->bindParam(':variable', $variable, PDO::PARAM_INT); $query->bindParam(':date_to', $to, PDO::PARAM_STR); $query->bindParam(':date_from', $from, PDO::PARAM_STR); $query->bindParam(':code', $code, PDO::PARAM_STR); $query->execute(); getError($query); }
/** * */ private function getClientByEmail($email) { $stmt = $this->db->query("SELECT * FROM `clients` WHERE email = '{$email}' "); $stmt->setFetchMode(\PDO::FETCH_ASSOC); //If PDO error getError($stmt); while ($result = $stmt->fetch()) { $this->results[] = $result; } return (is_null($this->results) or empty($this->results)) ? array() : $this->results; }
<?php if (empty($_POST['name'])) { http_response_code(400); echo '{"message": "Unable to create a with the information provided.", "info": "Parameters were not passed","success": false}'; return; } $name = $_POST['name']; require dirname(__FILE__) . '/mysql-connect.php'; openConnection(); $safeName = mysqli_escape_string($connection, $name); $result = getByValueFrom('name', $safeName, 'tag'); if (mysqli_num_rows($result) == 0) { $query = "INSERT INTO `tag` (`name`) VALUES ('{$safeName}');"; if (!runQuery($query)) { http_response_code(400); echo '{"message": "A server error has occured", "info": "mysql error -' . getError() . '", "success": false}'; return; } $tagID = mysqli_insert_id($connection); echo "{\"id\": {$tagID}, \"name\": \"{$safeName}\"}"; } else { http_response_code(400); echo '{"message":"A tag with that name exists.", "info": "Tag exists in database","success": false}'; } closeConnection();
$salle = $_POST["salle"]; $usage = $_POST["usage"]; $adresseIP = $_POST["adresseIP"]; $adresseMAC = $_POST["adresseMAC"]; $nomhote = $_POST["nomhotecomputer"]; $fonctionarray = $_POST["fonction"]; $fonction = implode(";", $fonctionarray); $comment = addslashes($_POST["comment"]); if ($_POST["submit"] != "") { $epnr = $_POST["epn_r"]; header("Location:index.php?a=2&epnr=" . $epnr); } if ($act != "" and $act != 3) { // Traitement des champs a insérer if (!$nom || !$salle) { $mess = getError(4); } else { switch ($act) { case 1: // ajout d'un poste $idcomputer = addMateriel($nom, $os, $comment, $usage, $fonction, $salle, $adresseIP, $adresseMAC, $nomhote); if (FALSE == $idcomputer) { header("Location: ./index.php?a=2&mesno=0"); } else { $usage = getAllUsage(); foreach ($usage as $key => $value) { if ($_POST["{$key}"] == "on") { addMaterielUsage($idcomputer, $key); } } header("Location: ./index.php?a=2&mesno=14");
<fieldset> <legend>Connection</legend> <br /> <label><?php echo _('Login'); ?> :</label> <input type="text" name="uLogin" class="input-text" /><br /> <label><?php echo _('Password'); ?> :</label><input type="password" name="uPass" class="input-text" /><br /> <?php if (isset($bErrorConnection) && $bErrorConnection) { echo '<script language="JavaScript"> $(function(){ msgBoxError("' . getError() . '",10); }); </script>'; } ?> <input type="hidden" name="todo" value="connect" /><br /> </fieldset> <div style="text-align:right"> <button class="ui-state-default ui-corner-all" type="button" onClick="window.top.oDialogAdmin && window.top.oDialogAdmin.dialog('close');"><?php echo _('Cancel'); ?> </button> <button class="ui-state-default ui-corner-all" type="submit"><?php echo _('Connection'); ?>
<?php /* LISTE DES SESSIONS PROGRAMMES include/admin_atelier.php V0.1 */ $mesno = $_GET["mesno"]; if ($mesno != "") { echo getError($mesno); } //$c==variable pour le changement de vue d'atelier $c = $_GET['c']; $espaces = getAllepn(); //CHERCHER LES SESSIONS if ($_SESSION["status"] == 4) { $result = getFutsessions(); } if ($_SESSION["status"] == 3) { $anim = $_SESSION["iduser"]; if (isset($c)) { switch ($c) { case 1: $result = getFutsessionsbyanim($anim); break; case 2: $result = getFutsessions($_SESSION["idepn"]); break; case 3: $result = getFutsessions(0); break; }
function printFatalHtmlError($strMore = '', $iErrorType = 500) { setError(getError() . $strMore); header("HTTP/1.0 {$iErrorType} Server Error"); printFatalError(); }