本文整理汇总了PHP中log_to_file函数的典型用法代码示例。如果您正苦于以下问题:PHP log_to_file函数的具体用法?PHP log_to_file怎么用?PHP log_to_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_to_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printmessages
function printmessages()
{
//Print error messages
initialise_messages();
$messages = $_SESSION['messages'];
// move from session to local
$log_to_file = false;
// true will start writing to a file
if (!empty($messages)) {
//if messages exist
//first part of message
if (!empty($messages['success'])) {
//if success messages exist.
foreach ($messages['success'] as $value) {
if ($log_to_file) {
log_to_file("Success", $value);
}
echo '<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<strong>Success!</strong> ' . $value . '</div>';
}
}
if (!empty($messages['alerts'])) {
//if alert messages exist.
foreach ($messages['alert'] as $value) {
if ($log_to_file) {
log_to_file("Alert", $value);
}
echo '<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<strong>Alert!</strong> ' . $value . '</div>';
}
}
if (!empty($messages['errors'])) {
//if error messages exist.
foreach ($messages['errors'] as $value) {
if ($log_to_file) {
log_to_file("Error", $value);
}
echo '<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<strong>Warning!</strong> ' . $value . '</div>';
}
}
//end of message
clear_messages();
//clear message and start again.
}
}
示例2: ResultadoDetalleExtendido
function ResultadoDetalleExtendido($Resultado)
{
if (!$this->user || !$this->password) {
$ret = generate_error("Autenticacion", "", "ResultadoDetalleExtendido");
} else {
$payload = file_get_contents("php://input");
log_to_file("wsSeguimiento XMLrequest: " . $payload);
log_to_file("wsSeguimiento request: " . serialize($Resultado));
$ret = get_ResultadoDetalleExtendido($Resultado->ResultadoExtendido, $this->user, $this->password);
}
log_to_file("wsSeguimiento response: " . serialize($ret));
return $ret;
}
示例3: saveimage
function saveimage()
{
log_to_file('snyggve', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'File saved in snyggve by ' . $_SESSION['login']['id'] . ' and file ' . $_FILES['image']['tmp_name'], '');
if (!is_numeric(str_replace('_', '', $_POST['image_id']))) {
die('Error (Visst är det skönt med felmeddelanden utan förklaring?) #' . __LINE__);
}
$query = 'INSERT INTO snyggve(title, owner, timestamp) VALUES("' . htmlspecialchars($_POST['title']) . '", ' . $_SESSION['login']['id'] . ', ' . time() . ')';
mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
$id = mysql_insert_id();
system('cp ' . SNYGGVE_TEMP_PATH . 'thumb/' . $_POST['image_id'] . '.jpg ' . SNYGGVE_PERM_PATH . 'thumb/' . $id . '.jpg');
system('cp ' . SNYGGVE_TEMP_PATH . 'full/' . $_POST['image_id'] . '.jpg ' . SNYGGVE_PERM_PATH . 'full/' . $id . '.jpg');
return $id;
}
示例4: load_config
function load_config()
{
$filename = "/var/xenoblade/config.txt";
$mysql_user = "";
$mysql_host = "";
$mysql_pass = "";
$mysql_database = "";
$settings = array();
if (fopen($filename, "r") == false) {
$log_message = "CRITICAL: Unable to load config file! Webpages will not load at all without it.";
log_to_file($log_message);
}
$handle = fopen($filename, "r") or die("Error loading config file! Please contact a system administrator to get this fixed! Webservices are non-functional without it.");
while (($line = fgets($handle)) !== false) {
// Fetch config information line-by-line
if (strcmp(stristr($line, "mysql_user:"), $line) == 0) {
$mysql_user = trim(str_ireplace("mysql_user:", "", $line));
}
if (strcmp(stristr($line, "mysql_host:"), $line) == 0) {
$mysql_host = trim(str_ireplace("mysql_host:", "", $line));
}
if (strcmp(stristr($line, "mysql_pass:"), $line) == 0) {
$mysql_pass = trim(str_ireplace("mysql_pass:", "", $line));
}
if (strcmp(stristr($line, "mysql_database:"), $line) == 0) {
$mysql_database = trim(str_ireplace("mysql_database:", "", $line));
}
}
fclose($handle);
$settings[0] = $mysql_user;
$settings[1] = $mysql_host;
$settings[2] = $mysql_pass;
$settings[3] = $mysql_database;
// Check to see if any of the settings are empty. If they are,
// that means that there is a typo in one of the settings
// ie "myr_rpc_uer: " instead of "myr_rpc_user: "
for ($i = 0; $i < count($settings); $i++) {
if (empty($settings[$i])) {
$log_message = "CRITICAL: Unable to load config file due to a damaged setting! Please go through the config file to correct the error. Webpages will not load at all without the config file.";
log_to_file($log_message);
die("Error loading config file! Please contact a system administrator to get this fixed! Webservices are non-functional without it.");
}
}
return $settings;
}
示例5: admin_action_count
function admin_action_count($admin_id, $event)
{
switch ($event) {
case 'post_removed':
$query_insert = 'INSERT INTO admin_counts (user_id, posts_removed) VALUES ("' . $admin_id . '", 1)';
$query_update = 'UPDATE admin_counts SET posts_removed = posts_removed + 1 WHERE user_id="' . $admin_id . '"';
break;
case 'avatar_denied':
$query_insert = 'INSERT INTO admin_counts (user_id, avatars_denied) VALUES ("' . $admin_id . '", 1)';
$query_update = 'UPDATE admin_counts SET avatars_denied = avatars_denied + 1 WHERE user_id="' . $admin_id . '"';
break;
case 'avatar_approved':
$query_insert = 'INSERT INTO admin_counts (user_id, avatars_approved) VALUES ("' . $admin_id . '", 1)';
$query_update = 'UPDATE admin_counts SET avatars_approved = avatars_approved + 1 WHERE user_id="' . $admin_id . '"';
break;
}
log_to_file('admin', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'admin_action_count ' . $event, $query_insert);
mysql_query($query_insert) or mysql_query($query_update) or die(report_sql_error($query_update, __FILE__, __LINE__));
}
示例6: send_mail
function send_mail()
{
$email_text = '';
// Useful data from $_SERVER
$email_text .= 'Client IP: ' . $_SERVER[REMOTE_ADDR] . '<br/>';
$email_text .= 'Client User Agent: ' . $_SERVER[HTTP_USER_AGENT] . '<br/>';
//$email_text .= 'Client IP: '. $_SERVER[CONTENT_TYPE] => application/x-www-form-urlencoded .'<br/>';
$email_text .= 'Referer: ' . $_SERVER[HTTP_REFERER] . '<br/>';
$email_text .= 'Languages Accepted: ' . $_SERVER[HTTP_ACCEPT_LANGUAGE] . '<br/>';
$email_text .= '<br/>';
$email_text .= 'Contact Name: ' . $_POST['name'] . '<br/>';
$email_text .= 'Contact Email: ' . $_POST['email'] . '<br/>';
$email_text .= 'Subject: ' . $_POST['subject'] . '<br/>';
$email_text .= 'Message: ' . $_POST['message'];
$body = "<h2>Contacto desde BarcaraCardozo.com</h2>";
$body .= $email_text;
$headers = "From: " . $_POST['email'] . " <" . $_POST['email'] . ">\r\n";
//optional headerfields
$headers .= "Return-Path:<" . $_POST['email'] . ">\r\n";
// avoid ending in spam folder http://php.net/manual/en/function.mail.php
// To send HTML mail, the Content-type header must be set
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
ini_set('sendmail_from', $_POST['email']);
// TODO: los errores logueados a disco
// Por si no tengo servidor de email
try {
// bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
if (!mail('info@barcaracardozo.com', 'Contacto desde BarcaraCardozo.com', $body, $headers)) {
log_to_file('logs/' . date("YmdHis") . '.log', 'No se pudo enviar el correo: ' . $email_text);
return false;
} else {
return true;
}
} catch (Exception $e) {
// Por problemas técnicos no se pudo enviar notificacion
log_to_file('logs/' . date("YmdHis") . '.log', 'No se pudo enviar el correo: ' . $email_text . ' (' . $e->getMessage() . ')');
return false;
}
}
示例7: distribute_server_get
function distribute_server_get($options)
{
/* Use this function to retrieve a list of servers to distribute items to
or to retrieve a server that hosts an item
options explenation
-------------------------------------------------------
types array of required types
status required status (not implemented, defaults to 'active')
item_handle only servers holding a copy of this item
item_type item type
return array
key value
-------------------------------------------------------
server_id server id
address valid internet host name
*/
global $entertain_types;
if (isset($options['item_handle'])) {
//find servers hosting this item
$query = 'SELECT ds.server_id server_id, ds.address address FROM distributed_items di, distribute_servers ds, entertain_items items' . ' WHERE di.server_id = ds.server_id ' . ' AND items.id = di.item_id ' . ' AND items.handle = "' . $options['item_handle'] . '"' . ' AND di.type = "' . $options['type'] . '"' . ' AND di.status = "ok"' . ' AND ds.status = "active"' . ' ORDER BY RAND() LIMIT 1';
log_to_file('distribute', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'fetching server', $query);
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
if ($data = mysql_fetch_assoc($result)) {
$server['server_id'] = $data['server_id'];
$server['address'] = $data['address'];
}
log_to_file('distribute', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'server fetched', print_r($server, true));
return $server;
} elseif (isset($options['types'])) {
$query = 'SELECT ds.server_id as server_id, ds.address as address' . ' FROM distribute_servers ds, distribute_servers_types dst' . ' WHERE ds.server_id = dst.server_id AND ds.status = "active"' . ' AND type IN ("' . implode('", "', $options['types']) . '")';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
log_to_file('distribute', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'servers fetched', $query);
while ($data = mysql_fetch_assoc($result)) {
$servers[] = $data;
}
return $servers;
}
}
示例8: cache_update_forum_reported
function cache_update_forum_reported()
{
log_to_file('deprecated', LOGLEVEL_INFO, __FILE__, __LINE__, 'cache_update_forum_reported()');
}
示例9: while
// We wait for all the fork child to finish
while ($fork_num > 0) {
$status = null;
pcntl_waitpid(-1, $status);
$fork_num--;
}
//end
}
//end if
break;
}
//end switch & thread
//}//end foreach
}
//end while
log_to_file('======================= Finished Regenerating Metadata ' . date('d-m-Y h:i:s') . ' =======================', LOG_FILE);
if (file_exists(SYNCH_FILE)) {
unlink(SYNCH_FILE);
}
//end if
exit(0);
/**
* Prints the specified prompt message and returns the line from stdin
*
* @param string $prompt the message to display to the user
*
* @return string
* @access public
*/
function get_line($prompt = '')
{
示例10: tips_send
function tips_send($options)
{
/*
options kommentar
reciever e-mail
sender_id user_id
sender_name full name (a regular string)
subject email subject string
message html message string
*/
// check if reciever has recieved before, how many times and if reciever accepts tip e-mail
if (check_email($options['reciever'])) {
return 'not a valid e-mail address';
}
$query = 'SELECT * FROM tips_recievers WHERE reciever="' . $options['reciever'] . '"';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
if ($data = mysql_fetch_assoc($result)) {
$has_recieved = true;
$status = $data['status'];
$hash = $data['hash'];
} else {
$has_recieved = false;
$status = 'first_time';
}
if ($has_recieved) {
if ($status == 'accepts') {
// if reciever has recieved before and accepts, send e-mail with standard pre-message - "accepted"
} else {
// if reciever has recieved before but not (yet) accepted, do nothing and return error
return 'denies';
}
} else {
// if reciever has not recived before, send e-mail with standard pre-message - "first time" and save to database
$hash = md5(rand());
$query = 'INSERT INTO tips_recievers (reciever, hash) VALUES ("' . $options['reciever'] . '", "' . $hash . '")';
mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
}
if (isset($options['sender_id'])) {
$query = 'SELECT username FROM login WHERE id="' . $options['sender_id'] . '"';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
if ($data = mysql_fetch_assoc($result)) {
$sender = $data['username'];
if ($sender == 'Borttagen') {
return 'false_sender';
}
} else {
return 'false_sender';
}
} else {
$sender = $options['sender_name'];
}
if ($status == 'first_time') {
$message = 'Hej, någon som säger sig heta ' . $sender . ' vill tipsa dig om en kul grej på Hamsterpaj!' . "\n" . 'Eftersom vi hatar spam har vi spärrat din mailadress från fler tips, du kommer inte få fler tips eller utmaningar från hamsterpajare om du inte tackar ja till det.' . "\n" . "\n" . $options['message'] . "\n" . "\n" . 'För att kolla in tipset och tacka ja till fler tips och utmaningar, använd den här länken: ' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=accept&link=' . $options['link'] . '&hash=' . $hash . "\n" . "\n" . 'För att kolla in tipset, men inte tacka ja till fler tips och utmaningar, använd den här länken:' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=view&link=' . $options['link'] . '&hash=' . $hash . "\n";
} elseif ($status == 'accepts') {
$message = 'Hej igen, nu vill någon som säger sig heta ' . $sender . ' tipsa dig om en grej på Hamsterpaj!' . "\n" . "\n" . $options['message'] . "\n" . "\n" . 'Kolla in tipset här:' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=view&link=' . $options['link'] . '&hash=' . $hash . "\n" . 'Du får det här tipset eftersom du tidigare tackat ja till att ta emot tips och utmaningar från användare på Hamsterpaj.' . "\n" . "\n" . 'Om du vill spärra din e-postadress från fler tips och utmaningar, använd den här länken:' . "\n" . 'http://www.hamsterpaj.net/tips.php?action=deny&link=' . $options['link'] . '&hash=' . $hash . "\n";
}
$headers = 'From: tips@hamsterpaj.net' . "\r\n";
mail($options['reciever'], $options['subject'], $message, $headers);
log_to_file('tips', LOGLEVEL_DEBUG, __FILE__, __LINE__, $reciever . ' recieved message: (subject: ' . $options['subject'] . ') ' . $message);
return 'ok';
}
示例11: quality_get_array
/**
returns an array of results
$return['
*/
function quality_get_array($text)
{
// these are the weights for all factors affecting the final score
$options['weight']['capital_post'] = 0.3;
$options['weight']['capital_sentence'] = 0.8;
$options['weight']['short_sentence'] = 1;
$options['weight']['comma'] = 1;
$options['weight']['spelling'] = 0.6;
$options['weight']['rubbish'] = 1;
$options['weight']['repetition'] = 1;
$options['weight']['long_sentence'] = 0.5;
$options['weight']['long_sentence_no_comma'] = 1;
$options['weight']['length'] = 3;
// settings
// sentence length boundaries
$options['words_in_short_sentence'] = 4;
$options['words_in_long_sentence'] = 45;
// post length boundaries in words
$options['post_length']['limit_a'] = 3;
//from -1 to 0
$options['post_length']['limit_b'] = 30;
// 0
$options['post_length']['limit_c'] = 100;
//from 0 to 1
$options['post_length']['limit_d'] = 400;
// 1
$options['post_length']['limit_e'] = 1000;
//from 1 to -1
$options['post_length']['limit_f'] = 1500;
// rubbish words and expressions
$options['rubbish'] = array('o', 'lol', 'lr', 'Elr');
// word lengths
$options['words']['limit_long'] = 11;
//remove all html tags
log_to_file('henrik', LOGLEVEL_DEBUG, __FILE__, __LINE__, $text);
$text = strip_tags($text);
// remove qouted text
$text = preg_replace('/\\[citat:[\\w-åäö]+=\\d+\\](.*)\\[\\/citat\\]/m', '', $text);
// remove answer tags
$text = preg_replace('/\\[svar:[\\w-åäö]+=\\d+\\]/', '', $text);
$text = preg_replace('/\\[\\/svar\\]/', '', $text);
// replace dots in host names
$text = preg_replace('/((\\w+)\\.)+(com|net|nu|se|org|eu)/', 'hostname', $text);
// remove propritary tags
$text = preg_replace('/\\[.*\\]/', '', $text);
// count words and words length
$words = preg_split('/[\\s,\\.\\?!:;]+/', trim($text));
// $result['words']['words'] = $words;
$result['words']['count'] = count($words);
$result['words']['long'] = 0;
foreach ($words as $word) {
if (count($word) > $options['words']['limit_long']) {
$result['words']['long']++;
}
}
$result['words']['long_fraction'] = $result['words']['long'] / $result['words']['count'];
//Hitta upprepningar av ord
$uniq = array_unique($words);
$result['words']['repetition'] = count($words) - count($uniq);
// sentence length
// the avarage length of sentences and count of short and long sentences
$result['sentence']['count'] = 0;
$result['sentence']['short'] = 0;
$result['sentence']['long'] = 0;
// split text into sentences
$sentences = preg_split('/[\\.!\\?\\n]+/', trim($text));
$result['commas']['long_sentence_no_comma'] = 0;
foreach ($sentences as $sentence) {
$sentence = trim($sentence);
if (strlen($sentence) > 8) {
// count the words in each sentence
$words = preg_split('/[ ,\\.!\\?\\t#\\*_\\n:;]+/', trim($sentence));
$result['sentence']['wordcount'] += count($words);
if (count($words) < $options['words_in_short_sentence'] && count(trim($sentence)) > 0) {
$result['sentence']['short']++;
$result['sentence']['short_sentences'][] = $sentence;
}
if (count($words) > $options['words_in_long_sentence']) {
$result['sentence']['long']++;
$commas = preg_match_all('/([\\wåäö], [\\wåäö])/', $text, $matches);
if ($commas < 1) {
$result['commas']['long_sentence_no_comma']++;
}
$result['sentence']['long_sentences'][] = $sentence;
}
if (preg_match('/^\\s*[A-ZÅÄÖ]/', $sentence, $matches)) {
$result['sentence']['starters'][] = $matches[0];
$result['capital']['sentence']++;
}
$result['sentence']['sentences'][] = $sentence;
}
}
$result['sentence']['count'] = count($result['sentence']['sentences']);
$result['sentence']['avarage'] = $result['words']['count'] / $result['sentence']['count'];
// points for short and long sentences
$result['score']['short_sentence'] = -$options['weight']['short_sentence'] * ($result['sentence']['short'] / $result['sentence']['count']);
//.........这里部分代码省略.........
示例12: discussions_create_handle
function discussions_create_handle($title)
{
$handle = url_secure_string($title);
for ($i = 0; $i < 50; $i++) {
$new_handle = $i == 0 ? $handle : $handle . '_' . $i;
$query = 'SELECT id FROM discussions WHERE handle LIKE "' . $new_handle . '" LIMIT 1';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
if (mysql_num_rows($result) == 0) {
return $new_handle;
}
}
/* If no free handle could be found */
log_to_file('forum', LOGLEVEL_ERROR, __FILE__, __LINE__, 'Could not find any free discussion handles, giving up', serialize(array($title)));
return md5(rand(0, 99999999999));
}
示例13: updateMetas
function updateMetas($metas)
{
global $site;
$dbh = $site->getDatabase();
$ret = false;
if ($metas && is_array($metas)) {
try {
$dbh->query('START TRANSACTION');
$sql = "INSERT INTO {$this->meta_table} (id, {$this->meta_id}, value, name) VALUES (0, :meta_id, :value, :name) ON DUPLICATE KEY UPDATE value = :value";
$stmt = $dbh->prepare($sql);
foreach ($metas as $name => $value) {
if (is_array($value) || is_object($value)) {
$value = serialize($value);
}
$stmt->bindValue(':meta_id', $this->id);
$stmt->bindValue(':value', $value);
$stmt->bindValue(':name', $name);
$stmt->execute();
}
$dbh->query('COMMIT');
$ret = true;
} catch (PDOException $e) {
log_to_file("Database error: {$e->getCode()} (Line {$e->getLine()}) in {$this->singular_class_name}::" . __FUNCTION__ . ": {$e->getMessage()}.", 'crood');
}
}
return $ret;
}
示例14: films_film_save
/**
* Saves a film from POST form to database
* options
new a new film
update update an existing film
* @return handle, the films handle
*/
function films_film_save($options)
{
if ($_POST['film_type'] == 'bilder') {
unset($_SESSION['new_film_temp']);
}
global $film_categories;
// Make handle from title
$handle = isset($_POST['handle']) ? $_POST['handle'] : url_secure_string($_POST['title']);
$release = isset($_POST['release_now']) ? time() : strtotime($_POST['release']);
$film_type = $_POST['film_type'];
if (isset($options['new'])) {
$query = 'INSERT INTO film (handle, title, film_type, category_id, `release`, extension, use_special_code, html, trailer_id)';
$query .= ' VALUES ("' . $handle . '", "' . $_POST['title'] . '", "' . $film_type . '", "' . $_POST['film_category'] . '", "' . $release . '", "' . (isset($_SESSION['new_film_temp']['extension']) ? $_SESSION['new_film_temp']['extension'] : '') . '", "' . (isset($_POST['use_special_code']) ? '1' : '0') . '", "' . addslashes(html_entity_decode($_POST['special_code'])) . '", "' . $_POST['trailer_id'] . '")';
$schedule['type'] = 'new_' . $film_type;
$_POST['url'] = '/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $handle . '.html';
$schedule['data'] = serialize($_POST);
$schedule['release'] = $release;
schedule_event_add($schedule);
} elseif (isset($options['update'])) {
$query = 'UPDATE film SET title = "' . $_POST['title'] . '"';
$query .= ', film_type = "' . $film_type . '"';
$query .= ', `release` = "' . $release . '"';
$query .= ', trailer_id = "' . $_POST['trailer_id'] . '"';
$query .= ', category_id = "' . $_POST['film_category'] . '"';
$query .= isset($_SESSION['new_film_temp']['extension']) ? ', extension = "' . $_SESSION['new_film_temp']['extension'] . '"' : '';
$query .= ', use_special_code = "' . (isset($_POST['use_special_code']) ? '1' : '0') . '"';
$query .= isset($_POST['use_special_code']) ? ', html="' . addslashes(html_entity_decode($_POST['special_code'])) . '"' : '';
$query .= ' WHERE handle = "' . $handle . '"';
}
// echo '<p>' . $query . '</p>';
log_to_file('films', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'query: ' . $query);
mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
$query = 'SELECT id, handle FROM film WHERE handle = "' . $handle . '"';
$result = mysql_query($query) or die(report_sql_error($query));
if ($data = mysql_fetch_assoc($result)) {
$film_id = $data['id'];
$film_handle = $data['handle'];
}
unset($save);
$save['item_id'] = $game_id;
$save['object_type'] = 'film';
$save['add'] = true;
foreach (explode(',', $_POST['tags']) as $keyword) {
$keyword = trim($keyword);
$save['tag_label'][] = $keyword;
}
tag_set_wrap($save);
/* Resize, convert and save the uploaded thumbnail */
if (strlen($_FILES['thumbnail']['tmp_name']) > 1) {
system('convert ' . $_FILES['thumbnail']['tmp_name'] . ' -resize 120!x90! ' . IMAGE_PATH . 'film/' . $film_handle . '.png');
}
if ($film_type == 'bilder') {
system('convert ' . $_FILES['thumbnail']['tmp_name'] . ' -resize 460x345 ' . IMAGE_PATH . 'fun_images/' . $film_handle . '.jpg');
}
// echo '<p>Nu är filmen sparad och filmens handle är: ' . $film_handle . '</p>' . "\n";
// echo '<p>Direktlänken blir då <a href="http://www.hamsterpaj.net/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $film_handle . '.html">' .
// 'http://www.hamsterpaj.net/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $film_handle . '.html</a' . "\n";
$film['handle'] = $handle;
$film['extension'] = $_SESSION['new_film_temp']['extension'];
$film['url'] = 'http://www.hamsterpaj.net/' . $film_type . '/' . $film_categories[$_POST['film_category']]['handle'] . '/' . $film_handle . '.html';
return $film;
}
示例15: log_to_file
// {
// If there are previous votes including one from current user
$queryupdate = 'UPDATE item_ranks SET' . ' average = "' . $average . '", ' . ' count = "' . $count . '"' . ' WHERE item_id="' . $_GET['item_id'] . '"' . ' AND item_type="' . $_GET['item_type'] . '"';
/*
}
else
{
// If there are previous votes but none from this user
$queryupdate = 'UPDATE item_ranks SET' .
' count = count + 1,' .
' average = average + ("' . $_GET['rank'] . '" / (count + 1))' .
' WHERE item_id="' . $_GET['item_id'] . '"' .
' AND item_type="' . $_GET['item_type'] . '"';
}
*/
log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'rank new item', $queryinsert);
log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'update item rank', $queryupdate);
mysql_query($queryinsert) or mysql_query($queryupdate) or die(report_sql_error($queryupdate, __FILE__, __LINE__));
if (!isset($old_rank)) {
$query = 'INSERT INTO user_ranks (item_id, item_type, rank, user_id) VALUES ("' . $_GET['item_id'] . '", "' . $_GET['item_type'] . '", "' . $_GET['rank'] . '", "' . $_SESSION['login']['id'] . '")';
} else {
$query = 'UPDATE user_ranks SET' . ' rank="' . $_GET['rank'] . '"' . ' WHERE user_id="' . $_SESSION['login']['id'] . '"' . ' AND item_id="' . $_GET['item_id'] . '"' . ' AND item_type="' . $_GET['item_type'] . '"';
}
log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'set user rank', $query);
mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
log_to_file('rank', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'rank_set, ' . $_GET['rank'] . ' stars for ' . $_GET['item_type'] . ' ' . $_GET['item_id'] . ' from user ' . $_SESSION['login']['id']);
} else {
/* Varning, haxors försöker skicka icke godkända poängsummor, aktivera laserskölden! */
die('Oh no, somebody set up us the bomb! Men med dina leeta mirkk-haxx0r-elite-skillz så sätter du väl bara upp en cURL som floodar kontodatabasen och fläskar in röster?');
}
}