本文整理汇总了PHP中showerror函数的典型用法代码示例。如果您正苦于以下问题:PHP showerror函数的具体用法?PHP showerror怎么用?PHP showerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showerror函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ips
/**
* widget function
* works for select menus and some input fields
* @param string $title
* @param string $function
* @param string $name
* @param string $value
* @param string $attr
* @param string $type
* @param string $subtitle
* @param string $req
* @param string $tag
* @param string $tag_attr
* @param string $extra
* @param string $afterwards
* @return string
* @author edited by Peng Wang <peng@pengxwang.com>
*/
function ips($title, $function, $name, $value = '', $attr = '', $type = '', $subtitle = '', $req = '', $tag = '', $tag_attr = '', $extra = '', $afterwards = '')
{
$OBJ =& get_instance();
global $error_msg, $go;
// set a default
// we might want div later
if (!$tag) {
$tag = 'label';
}
$tag_attr ? $tag_attr = "{$tag_attr}" : ($tag_attr = '');
$OBJ->access->prefs['user_help'] == 1 ? $help = showHelp($title) : ($help = '');
$afterwards ? $afterwards = $afterwards : ($afterwards = '');
if (isset($error_msg[$name])) {
$msg = span($error_msg[$name], "class='error'");
} else {
$msg = null;
}
$subtitle ? $subtitle = span($subtitle, "class='small-txt'") : ($subtitle = '');
$title ? $title = label($title . ' ' . $subtitle . ' ' . $help . $msg) : ($title = '');
$req ? $req = showerror($msg) : ($req = '');
$extra ? $add = $extra : ($add = '');
$value = showvalue($name, $value);
if ($function === 'input') {
$function = input($name, $type, attr($attr), $value);
} else {
$function ? $function = $function($value, $name, attr($attr), $add) : ($function = null);
}
return $title . "\n" . $function;
}
示例2: selectDistinct
function selectDistinct($connection, $tableName, $attributeName, $pulldownName, $defaultValue)
{
$defaultWithinResultSet = FALSE;
// Query to find distinct values of $attributeName in $tableName
$distinctQuery = "SELECT DISTINCT {$attributeName} FROM\n {$tableName}";
// Run the distinctQuery on the databaseName
if (!($resultId = @mysql_query($distinctQuery, $connection))) {
showerror();
}
// Start the select widget
print "\n<select name=\"{$pulldownName}\">";
// Retrieve each row from the query
while ($row = @mysql_fetch_array($resultId)) {
// Get the value for the attribute to be displayed
$result = $row[$attributeName];
// Check if a defaultValue is set and, if so, is it the
// current database value?
if (isset($defaultvalue) && $result == $defaultValue) {
// Yes, show as selected
print "\n\t<option selected value=\"{$result}\">{$result}";
} else {
// No, just show as an option
print "\n\t<option value=\"{$result}\">{$result}";
}
print "</option>";
}
print "\n</select>";
}
示例3: sendmail
public function sendmail($to, $subject, $message)
{
global $wsn;
global $debug;
try {
global $smtpCfg;
$smtpHost = $smtpCfg['servers'];
$smtpFrom = $smtpCfg['from'];
$smtpUsername = $smtpCfg['username'];
$smtpPassword = $smtpCfg['password'];
} catch (Exception $e) {
echo "Email not properly configured. Contact the site owner to report this problem. <br />";
showerror();
return false;
}
// mail($to,$subject,$message);
$mail = new PHPMailer();
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = $smtpHost;
// Specify main and backup SMTP servers
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = $smtpUsername;
// SMTP username
$mail->Password = $smtpPassword;
// SMTP password
$mail->SMTPSecure = 'tls';
// Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
// TCP port to connect to
$mail->From = $smtpFrom;
$mail->FromName = $wsn;
$mail->addAddress($to);
// Add a recipient
/*
$mail->addAddress('ellen@example.com');
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com'); // Optional recipients.
$mail->addBCC('bcc@example.com');
*/
$mail->WordWrap = 80;
// Set word wrap to 50 characters
$mail->isHTML(true);
// Set email format to HTML
$mail->Subject = "{$wsn} Account Activation";
$mail->Body = $message;
$mail->AltBody = strip_tags($message);
// Plain text alternative
if (!$mail->send()) {
echo 'Email could not be sent.';
if ($debug) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
showerror();
return false;
}
return true;
}
示例4: displayWinesList
function displayWinesList($connection, $query, $regionName)
{
// Run the query on the server
if (!($result = @mysql_query($query, $connection))) {
showerror();
}
// Find out how many rows are available
$rowsFound = @mysql_num_rows($result);
// If the query has results ...
if ($rowsFound > 0) {
// ... print out a header
print "Wines of {$regionName}<br>";
// and start a <table>.
print "\n<table>\n<tr>" . "\n\t<th>Wine ID</th>" . "\n\t<th>Wine Name</th>" . "\n\t<th>Year</th>" . "\n\t<th>Winery</th>" . "\n\t<th>Description</th>\n</tr>";
// Fetch each of the query rows
while ($row = @mysql_fetch_array($result)) {
// Print one row of results
print "\n<tr>\n\t<td>{$row["wine_id"]}</td>" . "\n\t<td>{$row["wine_name"]}</td>" . "\n\t<td>{$row["year"]}</td>" . "\n\t<td>{$row["winery_name"]}</td>" . "\n\t<td>{$row["description"]}</td>\n</tr>";
}
// end while loop body
// Finish the <table>
print "\n</table>";
}
// end if $rowsFound body
// Report how many rows were found
print "{$rowsFound} records found matching your criteria<br>";
}
示例5: delete_avatar
function delete_avatar()
{
global $ttf;
$sql = "SELECT avatar_type FROM ttf_user WHERE user_id='{$ttf["uid"]}'";
if (!($result = mysql_query($sql))) {
showerror();
}
list($ext) = mysql_fetch_row($result);
// if the user has an avatar
if (!empty($ext)) {
// delete the avatar
if (!unlink("avatars/" . $ttf["uid"] . "." . $ext)) {
// it wasn't deleted
return FALSE;
} else {
// if successful, remove it from the user row
$sql = "UPDATE ttf_user SET avatar_type=NULL " . "WHERE user_id='{$ttf["uid"]}' ";
if (!($result = mysql_query($sql))) {
// we couldn't reflect the deletion in the db
showerror();
} else {
// everything worked
return TRUE;
}
}
} else {
// there was no avatar to delete,
// so we are still happy people
return TRUE;
}
}
示例6: authenticateUserNav
function authenticateUserNav($connection, $username, $password)
{
include '../paths.php';
require CONFIG . 'config.php';
require INCLUDES . 'url_variables.inc.php';
require INCLUDES . 'db_tables.inc.php';
// Test the username and password parameters
if (!isset($username) || !isset($password)) {
return false;
}
if (NHC) {
// Place NHC SQL calls below
} else {
$query = "SELECT password FROM {$users_db_table} WHERE user_name = '{$username}' AND password = '{$password}'";
}
// Execute the query
if (!($result = @mysql_query($query, $connection))) {
showerror();
}
// Is the returned result exactly one row? If so, then we have found the user
if (mysql_num_rows($result) != 1) {
return false;
} else {
return true;
}
}
示例7: changepass
public function changepass($newpass, $username)
{
global $mysqli;
$username = $mysqli->real_escape_string($username);
$hashpass = $this->hash($newpass);
$qr = "UPDATE auth SET password='{$hashpass}' WHERE username='{$username}';";
$e = $mysqli->query($qr) or showerror();
return true;
}
示例8: user_link_table_length
function user_link_table_length($current_user)
{
global $mysqli;
$current_user = $mysqli->real_escape_string($current_user);
$result = $mysqli->query("SELECT COUNT(`rurl`) FROM `redirinfo` WHERE `user` = '{$current_user}';") or showerror();
$count = $result->fetch_assoc();
$count = (double) $count["COUNT(`rurl`)"];
$pages = $count / 30;
return ceil($pages);
}
示例9: __construct
/**
* @brief Constructor
*/
function __construct()
{
includeeasyhelper('logger');
includeeasyhelper('showerror');
includeeasylibrary('easyinireaderwriter');
log_message(LOGGER_DEBUG, 'called function: ' . $this->getlibraryname() . '.' . __FUNCTION__ . ' begin');
//log_message ( LOGGER_SYSTEM, $this->getlibraryname () . ' library is inited. version:' . $this->getversion () );
adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'logger', '1.0.0.2', COMPONENT_HELPER);
adddependency($this->getlibraryname(), $this->getversion(), COMPONENT_LIBRARY, 'easyinireaderwriter', '1.0.0.5', COMPONENT_LIBRARY);
$this->acturl = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$this->segments = array();
$this->controller = '';
$this->functionname = '';
$tacturl = $this->acturl;
$tbaseurl = substr(geteasy()->getbaseurl(), strpos(geteasy()->getbaseurl(), '://') + 3);
if (substr($tacturl, 0, strlen($tbaseurl)) == $tbaseurl) {
$tacturl = substr($tacturl, strlen($tbaseurl));
// Find parameters
$poz = strpos($tacturl, '?');
if ($poz !== FALSE) {
$arr = explode('&', substr($tacturl, $poz + 1));
foreach ($arr as $item) {
$par = explode('=', $item);
$this->parameters[] = array('name' => isset($par[0]) ? urldecode($par[0]) : '', 'value' => isset($par[1]) ? urldecode($par[1]) : '');
}
log_message(LOGGER_INFO, 'found parameters=' . print_r($this->parameters, true));
$tacturl = substr($tacturl, 0, strpos($tacturl, '?'));
} else {
$this->parameters = array();
}
if (!$tacturl || strtoupper($tacturl) == 'INDEX.PHP') {
// Not found method
getinivalue('config', 'config.ini', 'routes', 'default', 'default/index');
// Create if not exists
$tacturl = 'default';
} else {
// remove index.php
$tacturl = str_replace('index.php/', '', $tacturl);
$tacturl = str_replace('index.php', '', $tacturl);
}
if (!$this->parsemethod($tacturl)) {
/*Show error*/
$arr = explode('/', $tacturl);
log_message(LOGGER_SYSTEM, print_r($arr[0], true) . ' method not found!');
showerror('Hiba', 'A ' . $arr[0] . ' metódus nem található', '');
exit;
}
} else {
/*Show error*/
log_message(LOGGER_SYSTEM, print_r($tbaseurl, true) . ' is not set in config file\'s baseurl entry!');
showerror('Hiba', 'A megadott URL nem felel meg a config fájlban beállított baseurl értékének.', '');
exit;
}
log_message(LOGGER_DEBUG, 'called function: ' . $this->getlibraryname() . '.' . __FUNCTION__ . ' end');
}
示例10: showgifts
function showgifts($connection, $delete, $user)
{
// If we're showing the available gifts, then set up
// a query to show all unreserved gifts (where people IS NULL)
if ($delete == false) {
$query = "SELECT * \n FROM presents\n WHERE people_id IS NULL\n ORDER BY present";
} else {
// Otherwise, set up a query to show all gifts reserved by
// this user
$query = "SELECT * \n FROM presents\n WHERE people_id = \"{$user}\"\n ORDER BY present";
}
// Run the query
if (!($result = @mysql_query($query, $connection))) {
showerror();
}
// Did we get back any rows?
if (@mysql_num_rows($result) != 0) {
// Yes, so show the gifts as a table
echo "\n<table border=1 width=100%>";
// Create some headings for the table
echo "\n<tr>" . "\n\t<th>Quantity</th>" . "\n\t<th>Gift</th>" . "\n\t<th>Colour</th>" . "\n\t<th>Available From</th>" . "\n\t<th>Price</th>" . "\n\t<th>Action</th>" . "\n</tr>";
// Fetch each database table row of the results
while ($row = @mysql_fetch_array($result)) {
// Display the gift data as a table row
echo "\n<tr>" . "\n\t<td>{$row["quantity"]}</td>" . "\n\t<td>{$row["present"]}</td>" . "\n\t<td>{$row["colour"]}</td>" . "\n\t<td>{$row["shop"]}</td>" . "\n\t<td>{$row["price"]}</td>";
// Should we offer the chance to remove the gift?
if ($delete == true) {
// Yes. So set up an embedded link that the user can click
// to remove the gift to their shopping list by running
// action.php with action=delete
echo "\n\t<td><a href=\"action.php?action=delete&" . "present_id={$row["present_id"]}\">Delete from Shopping list</a>";
} else {
// No. So set up an embedded link that the user can click
// to add the gift to their shopping list by running
// action.php with action=insert
echo "\n\t<td><a href=\"action.php?action=insert&" . "present_id={$row["present_id"]}\">Add to Shopping List</a>";
}
}
echo "\n</table>";
} else {
// No data was returned from the query.
// Show an appropriate message
if ($delete == false) {
echo "\n<h3><font color=\"red\">No gifts left!</font></h3>";
} else {
echo "\n<h3><font color=\"red\">Your Basket is Empty!</font></h3>";
}
}
}
示例11: smallbiz_tax_form
function smallbiz_tax_form($id, $street, $po_box, $city, $state, $zipcode, $total_income, $small_biz, $num_of_employees, $refund, $signature, $date)
{
if ($GLOBALS['connected'] == False) {
connect_to_db();
}
$tax_rate = get_company_tax_rate($total_income);
$tax_rate = $tax_rate / 100;
$amount_due = $tax_rate * $total_income;
$query = "INSERT INTO individual_forms VALUES ('{$id}', '{$street}', '{$po_box}', '{$city}', '{$state}', '{$zipcode}', '{$total_income}', '{$small_biz}', '{$num_of_employees}', '{$refund}', '{$signature}', '{$date}')";
if (!($result = @mysql_query($query, $GLOBALS['$connection']))) {
showerror();
}
header("Location: http://project.patthickey.com");
die;
}
示例12: __construct
function __construct()
{
global $db_host, $db_username, $db_password, $db_name, $flickr_key, $flickr_secret;
$this->mysqli = new mymysqli($db_host, $db_username, $db_password, $db_name);
// Decide which user we're viewing. ?displayuser= will override everything else. Assume userid = 1 if nothing is specified.
session_start();
if (preg_match('/\\/badge.jpg$/', $_REQUEST['user'])) {
$split = preg_split('/\\//', $_REQUEST['user']);
$_REQUEST['user'] = $split[0];
require_once 'badge.php';
exit;
}
if (preg_match('/index.php$/', $_SERVER['SCRIPT_FILENAME']) and $_REQUEST['user'] == '') {
$_SESSION['user'] = "Kyle";
$this->username = "Kyle";
} elseif ($_REQUEST['user'] == '' and $_SESSION['user'] != '') {
$this->username = $_SESSION['user'];
} elseif ($_SESSION['user'] != '') {
$_SESSION['user'] = $_REQUEST['user'];
$this->username = $_REQUEST['user'];
} else {
$this->username = "Kyle";
}
// Get information about the displayed user.
$sql = "SELECT id, username, password, startlat, startlong, title, foursquare, last_check, flickr_user, flickr_token, keyword FROM users WHERE LOWER(username) = ?";
$stmt = $this->mysqli->prepare($sql);
$stmt->bind_param('s', strtolower($this->username));
$stmt->execute();
$stmt->bind_result($this->displayuser, $this->username, $this->password, $this->startLat, $this->startLong, $this->title, $this->foursquare, $this->last_check, $this->flickr_user, $this->flickr_token, $this->keyword);
$stmt->fetch();
if (!$this->displayuser) {
showerror("User was not found.");
}
// Check to see if the user is authorized to make changes
$this->authenticated = 0;
if (isset($_COOKIE['auth'])) {
$this->authuserid = $_COOKIE['auth']['userid'];
$hash = $_COOKIE['auth']['hash'];
if ($this->authuserid == $this->displayuser) {
if ($hash == md5($this->password . $this->authuserid . $_SERVER['HTTP_USER_AGENT'])) {
$this->authenticated = 1;
}
}
}
}
示例13: displayList
function displayList($connection, $query, $wine_name)
{
if (!($result = @mysql_query($query, $connection))) {
showerror();
}
$rowsFound = @mysql_num_rows($result);
if ($rowsFound > 0) {
print "Wines of {$regionName}<br>";
print "\n<table>\n<tr>\n\t" . "<th>Wine Name</th>\n\t" . "<th>Variety</th>\n\t" . "<th>Year</th>\n\t" . "<th>Winery</th>\n\t" . "<th>Region</th>\n\t" . "<th>Cost</th>\n\t" . "<th>Quantity</th>\n\t" . "\n\t\t\t<th>Stock Sold</th>\n\t" . "\n\t<th>Sales Revenue</th>\n\t";
while ($row = @mysql_fetch_array($result)) {
echo "\n<tr>\n\t<td>{$row["wine_name"]}</td>" . "\n\t<td>{$row["variety"]}</td>" . "\n\t<td>{$row["year"]}</td>" . "\n\t<td>{$row["winery_name"]}</td>" . "\n\t<td>{$row["region_name"]}</td>" . "\n\t<td>{$row["cost"]}</td>" . "\n\t<td><div align = 'center'>{$row["on_hand"]}</div></td>" . "\n\t<td><div align = 'center'>{$row["sum(qty)"]}</div></td>" . "\n\t<td><div align = 'center'>{$row["sum(price)"]}</div></td>\n";
}
echo "\n</table>";
print "{$rowsFound}";
} else {
echo "\n\n Your search criteria did not match any data in the database";
}
}
示例14: authenticateUserNav
function authenticateUserNav($connection, $username, $password)
{
// Test the username and password parameters
if (!isset($username) || !isset($password)) {
return false;
}
// Formulate the SQL find the user
$query = "SELECT password FROM users WHERE user_name = '{$username}'\r\n AND password = '{$password}'";
// Execute the query
if (!($result = @mysql_query($query, $connection))) {
showerror();
}
// Is the returned result exactly one row? If so, then we have found the user
if (mysql_num_rows($result) != 1) {
return false;
} else {
return true;
}
}
示例15: authenticateUser
function authenticateUser($connection, $username, $password)
{
$username = strtolower($username);
include '../paths.php';
require CONFIG . 'config.php';
require INCLUDES . 'url_variables.inc.php';
require INCLUDES . 'db_tables.inc.php';
// Test the username and password parameters
if (!isset($username) || !isset($password)) {
return false;
}
// Formulate the SQL find the user
$password = md5($password);
$query = "SELECT password FROM {$users_db_table} WHERE user_name = '{$username}' AND password = '{$password}'";
mysql_real_escape_string($query);
$result = mysql_query($query, $connection);
/*
if(!$result || (mysql_numrows($result) < 1)){
return false; //Indicates username failure
}
// Retrieve password from result
$dbarray = mysql_fetch_array($result);
// Validate that password is correct
if($password == $dbarray['password']){
return true; //Success! Username and password confirmed
}
else{
return false; //Indicates password failure
}
*/
// Execute the query
if (!($result = @mysql_query($query, $connection))) {
showerror();
}
// Is the returned result exactly one row? If so, then we have found the user
if (mysql_num_rows($result) != 1) {
return false;
} else {
return true;
}
}