当前位置: 首页>>代码示例>>PHP>>正文


PHP log_insert函数代码示例

本文整理汇总了PHP中log_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP log_insert函数的具体用法?PHP log_insert怎么用?PHP log_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了log_insert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 function store()
 {
     require_once mnminclude . 'log.php';
     global $db, $current_user, $globals;
     if (!$this->date) {
         $this->date = $globals['now'];
     }
     $comment_author = $this->author;
     $comment_link = $this->link;
     $comment_karma = $this->karma;
     $comment_date = $this->date;
     $comment_randkey = $this->randkey;
     $comment_content = $db->escape(clean_lines($this->content));
     if ($this->type == 'admin') {
         $comment_type = 'admin';
     } else {
         $comment_type = 'normal';
     }
     if ($this->id === 0) {
         $this->ip = $db->escape($globals['user_ip']);
         $db->query("INSERT INTO comments (comment_user_id, comment_link_id, comment_type, comment_karma, comment_ip, comment_date, comment_randkey, comment_content) VALUES ({$comment_author}, {$comment_link}, '{$comment_type}', {$comment_karma}, '{$this->ip}', FROM_UNIXTIME({$comment_date}), {$comment_randkey}, '{$comment_content}')");
         $this->id = $db->insert_id;
         // Insert comment_new event into logs
         log_insert('comment_new', $this->id, $current_user->user_id);
     } else {
         $db->query("UPDATE comments set comment_user_id={$comment_author}, comment_link_id={$comment_link}, comment_type='{$comment_type}', comment_karma={$comment_karma}, comment_ip = '{$this->ip}', comment_date=FROM_UNIXTIME({$comment_date}), comment_randkey={$comment_randkey}, comment_content='{$comment_content}' WHERE comment_id={$this->id}");
         // Insert comment_new event into logs
         log_conditional_insert('comment_edit', $this->id, $current_user->user_id, 30);
     }
     $this->update_order();
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comment.php

示例2: store

 function store($full = true)
 {
     require_once mnminclude . 'log.php';
     global $db, $current_user, $globals;
     $db->transaction();
     if (!$this->date) {
         $this->date = time();
     }
     $post_author = $this->author;
     $post_src = $this->src;
     $post_karma = $this->karma;
     $post_date = $this->date;
     $post_randkey = $this->randkey;
     $post_content = $db->escape($this->normalize_content());
     if ($this->id === 0) {
         $this->ip = $globals['user_ip_int'];
         $db->query("INSERT INTO posts (post_user_id, post_karma, post_ip_int, post_date, post_randkey, post_src, post_content) VALUES ({$post_author}, {$post_karma}, {$this->ip}, FROM_UNIXTIME({$post_date}), {$post_randkey}, '{$post_src}', '{$post_content}')");
         $this->id = $db->insert_id;
         $this->insert_vote($post_author);
         // Insert post_new event into logs
         if ($full) {
             log_insert('post_new', $this->id, $post_author);
         }
     } else {
         $db->query("UPDATE posts set post_user_id={$post_author}, post_karma={$post_karma}, post_ip_int = '{$this->ip}', post_date=FROM_UNIXTIME({$post_date}), post_randkey={$post_randkey}, post_content='{$post_content}' WHERE post_id={$this->id}");
         // Insert post_new event into logs
         if ($full) {
             log_conditional_insert('post_edit', $this->id, $post_author, 30);
         }
     }
     if ($full) {
         $this->update_conversation();
     }
     $db->commit();
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:35,代码来源:post.php

示例3: store

	function store($full = true) {
		require_once(mnminclude.'log.php');
		global $db, $current_user, $globals;

		if(!$this->date) $this->date=$globals['now'];
		$comment_author = $this->author;
		$comment_link = $this->link;
		$comment_karma = $this->karma;
		$comment_date = $this->date;
		$comment_randkey = $this->randkey;
		$comment_content = $db->escape($this->normalize_content());
		if ($this->type == 'admin') $comment_type = 'admin';
		else $comment_type = 'normal';
		$db->transaction();
		if($this->id===0) {
			$this->ip = $db->escape($globals['user_ip']);
			$db->query("INSERT INTO comments (comment_user_id, comment_link_id, comment_type, comment_karma, comment_ip, comment_date, comment_randkey, comment_content) VALUES ($comment_author, $comment_link, '$comment_type', $comment_karma, '$this->ip', FROM_UNIXTIME($comment_date), $comment_randkey, '$comment_content')");
			$this->id = $db->insert_id;

			// Insert comment_new event into logs
			if ($full) log_insert('comment_new', $this->id, $current_user->user_id);
		} else {
			$db->query("UPDATE comments set comment_user_id=$comment_author, comment_link_id=$comment_link, comment_type='$comment_type', comment_karma=$comment_karma, comment_ip = '$this->ip', comment_date=FROM_UNIXTIME($comment_date), comment_modified=now(), comment_randkey=$comment_randkey, comment_content='$comment_content' WHERE comment_id=$this->id");
			// Insert comment_new event into logs
			if ($full) log_conditional_insert('comment_edit', $this->id, $current_user->user_id, 60);
		}
		if ($full) {
			$this->update_order();
			$this->update_conversation();
		}
		$db->commit();
	}
开发者ID:rasomu,项目名称:chuza,代码行数:32,代码来源:comment.php

示例4: log_conditional_insert

function log_conditional_insert($type, $ref_id, $user_id = 0, $seconds = 0)
{
    global $db, $globals;
    if (!log_get_date($type, $ref_id, $user_id, $seconds)) {
        return log_insert($type, $ref_id, $user_id);
    }
    return false;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:8,代码来源:log.php

示例5: log_user

function log_user($user) {
  // We want to know who the hell is this
  $encoded_user = json_encode($user);
  cache_set('user:' . $user['id'], $encoded_user);
  
  // Log this usage
  log_insert('user_hit');
}
开发者ID:ryandao,项目名称:Facebook-Status-Time-Capsule,代码行数:8,代码来源:db.php

示例6: do_login

function do_login()
{
    global $current_user, $globals;
    $form_ip_check = check_form_auth_ip();
    $previous_login_failed = log_get_date('login_failed', $globals['form_user_ip_int'], 0, 300);
    echo '<form action="' . get_auth_link() . 'login.php" id="xxxthisform" method="post">' . "\n";
    if ($_POST["processlogin"] == 1) {
        // Check the IP, otherwise redirect
        if (!$form_ip_check) {
            header("Location: http://" . get_server_name() . $globals['base_url'] . "login.php");
            die;
        }
        $username = clean_input_string(trim($_POST['username']));
        $password = trim($_POST['password']);
        if ($_POST['persistent']) {
            $persistent = 3600000;
            // 1000 hours
        } else {
            $persistent = 0;
        }
        // Check form
        if (($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) && !ts_is_human()) {
            log_insert('login_failed', $globals['form_user_ip_int'], 0);
            recover_error(_('el código de seguridad no es correcto'));
        } elseif ($current_user->Authenticate($username, md5($password), $persistent) == false) {
            log_insert('login_failed', $globals['form_user_ip_int'], 0);
            recover_error(_('usuario o email inexistente, sin validar, o clave incorrecta'));
            $previous_login_failed++;
        } else {
            UserAuth::check_clon_from_cookies();
            if (!empty($_REQUEST['return'])) {
                header('Location: ' . $_REQUEST['return']);
            } else {
                header('Location: ./');
            }
            die;
        }
    }
    echo '<p><label for="name">' . _('usuario o email') . ':</label><br />' . "\n";
    echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="' . htmlentities($username) . '" /></p>' . "\n";
    echo '<p><label for="password">' . _('clave') . ':</label><br />' . "\n";
    echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>' . "\n";
    echo '<p><label for="remember">' . _('recuérdame') . ': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>' . "\n";
    // Print captcha
    if ($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) {
        ts_print_form();
    }
    get_form_auth_ip();
    echo '<p><input type="submit" value="login" tabindex="4" />' . "\n";
    echo '<input type="hidden" name="processlogin" value="1"/></p>' . "\n";
    echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n";
    echo '</form>' . "\n";
    echo '<div><strong><a href="login.php?op=recover">' . _('¿has olvidado la contraseña?') . '</a></strong></div>' . "\n";
    echo '<div style="margin-top: 30px">';
    print_oauth_icons($_REQUEST['return']);
    echo '</div>' . "\n";
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:57,代码来源:login.php

示例7: borrar_usuarios_no_activados_antiguos

function borrar_usuarios_no_activados_antiguos()
{
    global $dbc;
    // miro si se han borrado usuarios inactivos en las últimas 72 horas
    $borrados_inactivos = log_get("users_inactives_deleted", 0, 0, 72 * 60 * 60);
    if ($borrados_inactivos == 0) {
        // si no se ha realizado borrado en las últimas 72 horas lo hago ahora
        $sql_delete = "DELETE from `users` WHERE `approved` = 0 AND `date` < now() - INTERVAL 3 DAY";
        mysql_query($sql_delete, $dbc['link']) or die("Deletion Failed:" . mysql_error());
        log_insert("users_inactives_deleted", 0, 0);
    }
}
开发者ID:javimoya,项目名称:carpooling,代码行数:12,代码来源:dbc.inc.php

示例8: deauthorize_page

function deauthorize_page() {
  // Remove user from the cache
  global $data;  
  global $db;
  $q = $db->prepare('DELETE FROM cache WHERE name = ?');
  $name = 'user:' . $data['user_id'];
  $q->bind_param('s', $name);
  $q->execute();
  
  // Log users that delete the app :( (just log the ID)
  log_insert('user_removed_app', $data['user_id']);
}
开发者ID:ryandao,项目名称:Facebook-Status-Time-Capsule,代码行数:12,代码来源:deauthorize.php

示例9: popularity_page

function popularity_page() {
  print theme_header(FALSE);
  print <<<EOS
<h1>How do we calculate popularity?</h1>

<p>In Status Time Capsule, your popularity depends on:</p>

<ul>
  <li>average number of comments per status,</li>
  <li>average number of likes per status, and</li>
  <li>variance of these numbers among your statuses.</li>
</ul>

<p>Therefore, someone that consistently attracts comments and likes to all of his/her statuses may be ranked as more popular, compared to someone that has occasional popular statuses (with lots of likes and comments).</p>

<p>Technically, we calculate the lower bound of Wilson score confidence interval for a Bernoulli parameter for each user of our app. Then, we rank these lower bound values and derive the top most popular users as well as the percentage of people ranked below yours. For more explanation about the algorithm, see <a href="http://www.evanmiller.org/how-not-to-sort-by-average-rating.html">the article by Evan Miller</a>.</p>

EOS;
  print theme_links();
  print theme_footer();
  // Ugly error suppression
  @log_insert('popularity_hit');
}
开发者ID:ryandao,项目名称:Facebook-Status-Time-Capsule,代码行数:23,代码来源:popularity.php

示例10: sprintf

     $link->negatives = $votes_neg;
     $link->store_basic();
 } else {
     $karma_mess = '';
 }
 print "<tr><td class='tnumber{$imod}'>{$link->id}</td><td class='tnumber{$imod}'>" . $link->votes . "</td><td class='tnumber{$imod}'>" . $link->negatives . "</td><td class='tnumber{$imod}'>" . sprintf("%0.2f", $new_coef) . "</td><td class='tnumber{$imod}'>" . intval($link->karma) . "</td>";
 echo "<td class='tdata{$imod}'><a href='" . $link->get_permalink() . "'>{$link->title}</a>\n";
 echo "{$karma_mess}</td>\n";
 if ($link->votes >= $min_votes && $dblink->karma >= $min_karma && $published < $max_to_publish) {
     $published++;
     $link->karma = $dblink->karma;
     $link->status = 'published';
     $link->published_date = time();
     $link->store_basic();
     // Add the publish event/log
     log_insert('link_publish', $link->id, $link->author);
     $changes = 3;
     // to show a "published" later
 }
 echo "<td class='tnumber{$imod}'>";
 switch ($changes) {
     case 1:
         echo '<img src="../img/common/sneak-problem01.png" width="20" height="16" alt="' . _('descenso') . '"/>';
         break;
     case 2:
         echo '<img src="../img/common/sneak-vote01.png" width="20" height="16" alt="' . _('ascenso') . '"/>';
         break;
     case 3:
         echo '<img src="../img/common/sneak-published01.png" width="20" height="16" alt="' . _('publicada') . '"/>';
         break;
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:promote6.php

示例11: do_register2

function do_register2() {
	global $db, $current_user, $globals;
	if ( !ts_is_human()) {
		register_error(_('el código de seguridad no es correcto'));
		return;
	}

	if (!check_user_fields())  return;

	$username=clean_input_string(trim($_POST['username'])); // sanity check
	$dbusername=$db->escape($username); // sanity check
	$password=md5(trim($_POST['password']));
	$email=clean_input_string(trim($_POST['email'])); // sanity check
	$dbemail=$db->escape($email); // sanity check
	$user_ip = $globals['form_user_ip'];
    $standard = (int)$_POST['standard'];
    
	if (!user_exists($username)) {
		if ($db->query("INSERT INTO users (user_login, user_login_register, user_email, user_email_register, user_pass, user_date, user_ip, user_standard) VALUES ('$dbusername', '$dbusername', '$dbemail', '$dbemail', '$password', now(), '$user_ip', '$standard')")) {
			echo '<fieldset>'."\n";
			echo '<legend><span class="sign">'._("registro de usuario").'</span></legend>'."\n";
			$user=new User();
			$user->username=$username;
			if(!$user->read()) {
				register_error(_('error insertando usuario en la base de datos'));
			} else {
				require_once(mnminclude.'mail.php');
				$sent = send_recover_mail($user);
				$globals['user_ip'] = $user_ip; //we force to insert de log with the same IP as the form
				log_insert('user_new', $user->id, $user->id);
			}
			echo '</fieldset>'."\n";
		} else {
			register_error(_("error insertando usuario en la base de datos"));
		}
	} else {
		register_error(_("el usuario ya existe"));
	}
}
开发者ID:rasomu,项目名称:chuza,代码行数:39,代码来源:register.php

示例12: lang_content_destroy

function lang_content_destroy($p_db, $p_table_name, $p_msg_id, $p_country_id)
{
    $success = true;
    $is_exist = false;
    if (lang_content_exist($p_db, $p_table_name, $p_msg_id, $p_country_id)) {
        $is_exist = true;
    }
    if ($is_exist) {
        $qry_del = "DELETE FROM `{$p_table_name}`\r\n\t\tWHERE `msg_id`='{$p_msg_id}'\r\n\t\tLIMIT 1";
        $res_del = mysql_query($qry_del, $p_db);
        if (!$res_del) {
            log_insert($p_db, "Error when deleting multilang table:" . mysql_error($p_db));
            $success = false;
        }
    }
    return $success;
}
开发者ID:bayucandra,项目名称:qiaff,代码行数:17,代码来源:general.php

示例13: publish

function publish(&$link)
{
    global $globals, $db;
    global $users_karma_avg;
    // Calculate votes average
    // it's used to calculate and check future averages
    $votes_avg = (double) $db->get_var("select SQL_NO_CACHE avg(vote_value) from votes, users where vote_type='links' AND vote_link_id={$link->id} and vote_user_id > 0 and vote_value > 0 and vote_user_id = user_id and user_level !='disabled'");
    if ($votes_avg < $users_karma_avg) {
        $link->votes_avg = max($votes_avg, $users_karma_avg * 0.97);
    } else {
        $link->votes_avg = $votes_avg;
    }
    $link->status = 'published';
    $link->date = $link->published_date = time();
    $link->store_basic();
    // Increase user's karma
    $user = new User();
    $user->id = $link->author;
    if ($user->read()) {
        $user->karma = min(20, $user->karma + 1);
        $user->store();
        $annotation = new Annotation("karma-{$user->id}");
        $annotation->append(_('Noticia publicada') . ": +1, karma: {$user->karma}\n");
    }
    // Add the publish event/log
    log_insert('link_publish', $link->id, $link->author);
    $short_url = fon_gs($link->get_permalink());
    if ($globals['twitter_user'] && $globals['twitter_password']) {
        twitter_post($link, $short_url);
    }
    if ($globals['jaiku_user'] && $globals['jaiku_key']) {
        jaiku_post($link, $short_url);
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:34,代码来源:promote7.php

示例14: mysql_query

if ($lang != $prev_lang) {
    $query = "update subs set lang_id={$lang} where subID={$id} and fversion={$rversion} and lang_id={$prev_lang}";
    mysql_query($query);
    $query = "update flangs set lang_id={$lang} where subID={$id} and fversion={$rversion} and lang_id={$prev_lang}";
    mysql_query($query);
}
if (!isset($fversion)) {
    if ($is_episode) {
        $showname = bd_getShowTitle($showID);
        if (strlen($season) < 2) {
            $season = '0' . $season;
        }
        if (strlen($epnumber) < 2) {
            $epnumber = '0' . $epnumber;
        }
        $title = $showname . ' - ' . $season . 'x' . $epnumber . ' - ' . $eptitle;
        $title = addslashes($title);
        $query = "update files set is_episode=1,title='{$title}',season={$season},season_number={$epnumber} where subID={$id}";
        mysql_query($query);
    } else {
        $title = $movietitle . " ({$year})";
        $tile = addslashes($title);
        $query = "update files set is_episode=0,title='{$title}' where subID={$id}";
        mysql_query($query);
    }
}
$title = bd_getTitle($id);
log_insert(LOG_updateprop, '', $userID, $id, bd_userIsModerador());
$url = bd_getUrl($id);
location("{$url}");
bbdd_close();
开发者ID:Raak15,项目名称:subtitols,代码行数:31,代码来源:editprop_do.php

示例15: do_save

function do_save() {
	global $linkres, $dblang, $current_user;

	$linkres->read_content_type_buttons($_POST['type']);

	$linkres->category=intval($_POST['category']);
	if ($current_user->admin) {
		if (!empty($_POST['url'])) {
			$linkres->url = clean_input_url($_POST['url']);
		}
		if ($_POST['thumb_delete']) {
			$linkres->delete_thumb();
		}
		if ($_POST['thumb_get']) {
			$linkres->get_thumb();
		}
	}
	$linkres->title = clean_text($_POST['title'], 40);
	$linkres->content = clean_text_with_tags($_POST['bodytext']);
	$linkres->tags = tags_normalize_string($_POST['tags']);
	// change the status
	if ($_POST['status'] != $linkres->status
		&& ($_POST['status'] == 'autodiscard' || $current_user->admin)
		&& preg_match('/^[a-z]{4,}$/', $_POST['status'])
		&& ( ! $linkres->is_discarded() || $current_user->admin)) {
		if (preg_match('/discard|abuse|duplicated|autodiscard/', $_POST['status'])) {
			// Insert a log entry if the link has been manually discarded
			$insert_discard_log = true;
		}
		$linkres->status = $_POST['status'];
	}

  // EVENTS
  $d = $_POST["datepicker1"];
  $linkres->start_date = substr($d,3,2).'-'.substr($d, 0, 2).'-'.substr($d,6,4);

  $d = $_POST["datepicker2"];
  $linkres->end_date = substr($d,3,2).'-'.substr($d, 0, 2).'-'.substr($d,6,4);


	if (!link_edit_errors($linkres)) {
		if (empty($linkres->uri)) $linkres->get_uri();
		$linkres->store();
		tags_insert_string($linkres->id, $dblang, $linkres->tags, $linkres->date);

		// Insert edit log/event if the link it's newer than 15 days
		if ($globals['now'] - $linkres->date < 86400*15) {
			require_once(mnminclude.'log.php');
			if ($insert_discard_log) {
				// Insert always a link and discard event if the status has been changed to discard
				log_insert('link_discard', $linkres->id, $current_user->user_id);
				if ($linkres->author == $current_user->user_id) { // Don't save edit log if it's discarded by an admin
					log_insert('link_edit', $linkres->id, $current_user->user_id);
				}
			} elseif ($linkres->votes > 0) {
				log_conditional_insert('link_edit', $linkres->id, $current_user->user_id, 60);
			}
		}

		echo '<div class="form-error-submit">&nbsp;&nbsp;'._("noticia actualizada").'</div>'."\n";
	}

	$linkres->read();

	echo '<div class="formnotice">'."\n";
	$linkres->print_summary('preview');
	echo '</div>'."\n";

	echo '<form class="note" method="GET" action="story.php" >';
	echo '<input type="hidden" name="id" value="'.$linkres->id.'" />'."\n";
	echo '<input class="button" type="button" onclick="window.history.go(-1)" value="&#171; '._('modificar').'">&nbsp;&nbsp;'."\n";;
	echo '<input class="button" type="submit" value="'._('ir a la noticia').'" />'."\n";
	echo '</form>'. "\n";
}
开发者ID:rasomu,项目名称:chuza,代码行数:74,代码来源:editlink.php


注:本文中的log_insert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。