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


PHP get_ipaddress函数代码示例

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


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

示例1: new_task

 function new_task($list_id, $task_id, $data)
 {
     //notification is not selected or no one is assigned
     if ($_POST['task_assign'] == '-1') {
         return;
     }
     $project_id = 0;
     if (isset($_POST['project_id'])) {
         $project_id = intval($_POST['project_id']);
     }
     $user = get_user_by('id', intval($_POST['task_assign']));
     $to = sprintf('%s <%s>', $user->display_name, $user->user_email);
     $template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => get_post_field('post_title', $project_id), '%PROJECT_URL%' => cpm_url_project_details($project_id), '%AUTHOR%' => $user->display_name, '%AUTHOR_EMAIL%' => $user->user_email, '%TASKLIST_URL%' => cpm_url_single_tasklist($project_id, $list_id), '%TASK_URL%' => cpm_url_single_task($project_id, $list_id, $task_id), '%TASK%' => $data['post_content'], '%IP%' => get_ipaddress());
     $subject = cpm_get_option('new_task_sub');
     $message = cpm_get_option('new_task_body');
     // subject
     foreach ($template_vars as $key => $value) {
         $subject = str_replace($key, $value, $subject);
     }
     // message
     foreach ($template_vars as $key => $value) {
         $message = str_replace($key, $value, $message);
     }
     $this->send($to, $subject, $message);
 }
开发者ID:kasuparu,项目名称:wp-timecraft,代码行数:25,代码来源:notification.php

示例2: vote_poll

function vote_poll()
{
    global $wpdb, $user_identity, $user_ID;
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'polls') {
        // Load Headers
        polls_textdomain();
        header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
        // Get Poll ID
        $poll_id = isset($_REQUEST['poll_id']) ? intval($_REQUEST['poll_id']) : 0;
        // Ensure Poll ID Is Valid
        if ($poll_id == 0) {
            _e('Invalid Poll ID', 'wp-polls');
            exit;
        }
        // Verify Referer
        if (!check_ajax_referer('poll_' . $poll_id . '-nonce', 'poll_' . $poll_id . '_nonce', false)) {
            _e('Failed To Verify Referrer', 'wp-polls');
            exit;
        }
        // Which View
        switch ($_REQUEST['view']) {
            // Poll Vote
            case 'process':
                $poll_aid = $_POST["poll_{$poll_id}"];
                $poll_aid_array = array_unique(array_map('intval', explode(',', $poll_aid)));
                if ($poll_id > 0 && !empty($poll_aid_array) && check_allowtovote()) {
                    $check_voted = check_voted($poll_id);
                    if ($check_voted == 0) {
                        if (!empty($user_identity)) {
                            $pollip_user = htmlspecialchars(addslashes($user_identity));
                        } elseif (!empty($_COOKIE['comment_author_' . COOKIEHASH])) {
                            $pollip_user = htmlspecialchars(addslashes($_COOKIE['comment_author_' . COOKIEHASH]));
                        } else {
                            $pollip_user = __('Guest', 'wp-polls');
                        }
                        $pollip_userid = intval($user_ID);
                        $pollip_ip = get_ipaddress();
                        $pollip_host = esc_attr(@gethostbyaddr($pollip_ip));
                        $pollip_timestamp = current_time('timestamp');
                        // Only Create Cookie If User Choose Logging Method 1 Or 2
                        $poll_logging_method = intval(get_option('poll_logging_method'));
                        if ($poll_logging_method == 1 || $poll_logging_method == 3) {
                            $cookie_expiry = intval(get_option('poll_cookielog_expiry'));
                            if ($cookie_expiry == 0) {
                                $cookie_expiry = 30000000;
                            }
                            $vote_cookie = setcookie('voted_' . $poll_id, $poll_aid, $pollip_timestamp + $cookie_expiry, COOKIEPATH);
                        }
                        $i = 0;
                        foreach ($poll_aid_array as $polla_aid) {
                            $update_polla_votes = $wpdb->query("UPDATE {$wpdb->pollsa} SET polla_votes = (polla_votes+1) WHERE polla_qid = {$poll_id} AND polla_aid = {$polla_aid}");
                            if (!$update_polla_votes) {
                                unset($poll_aid_array[$i]);
                            }
                            $i++;
                        }
                        $vote_q = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_totalvotes = (pollq_totalvotes+" . sizeof($poll_aid_array) . "), pollq_totalvoters = (pollq_totalvoters+1) WHERE pollq_id = {$poll_id} AND pollq_active = 1");
                        if ($vote_q) {
                            foreach ($poll_aid_array as $polla_aid) {
                                $wpdb->query("INSERT INTO {$wpdb->pollsip} VALUES (0, {$poll_id}, {$polla_aid}, '{$pollip_ip}', '{$pollip_host}', '{$pollip_timestamp}', '{$pollip_user}', {$pollip_userid})");
                            }
                            echo display_pollresult($poll_id, $poll_aid_array, false);
                        } else {
                            printf(__('Unable To Update Poll Total Votes And Poll Total Voters. Poll ID #%s', 'wp-polls'), $poll_id);
                        }
                        // End if($vote_a)
                    } else {
                        printf(__('You Had Already Voted For This Poll. Poll ID #%s', 'wp-polls'), $poll_id);
                    }
                    // End if($check_voted)
                } else {
                    printf(__('Invalid Poll ID. Poll ID #%s', 'wp-polls'), $poll_id);
                }
                // End if($poll_id > 0 && !empty($poll_aid_array) && check_allowtovote())
                break;
                // Poll Result
            // Poll Result
            case 'result':
                echo display_pollresult($poll_id, 0, false);
                break;
                // Poll Booth Aka Poll Voting Form
            // Poll Booth Aka Poll Voting Form
            case 'booth':
                echo display_pollvote($poll_id, false);
                break;
        }
        // End switch($_REQUEST['view'])
    }
    // End if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'polls')
    exit;
}
开发者ID:vsalx,项目名称:rattieinfo,代码行数:91,代码来源:wp-polls.php

示例3: ob_start

<?php

include 'functions.php';
ob_start();
echo "<html>\n";
// grab the connecting ip address. //
$connecting_ip = get_ipaddress();
if (empty($connecting_ip)) {
    return FALSE;
}
// determine if connecting ip address is allowed to connect to PHP Timeclock //
if ($restrict_ips == "yes") {
    for ($x = 0; $x < count($allowed_networks); $x++) {
        $is_allowed = ip_range($allowed_networks[$x], $connecting_ip);
        if (!empty($is_allowed)) {
            $allowed = TRUE;
        }
    }
    if (!isset($allowed)) {
        echo "You are not authorized to view this page.";
        exit;
    }
}
// connect to db anc check for correct db version //
@($db = mysql_pconnect($db_hostname, $db_username, $db_password));
if (!$db) {
    echo "Error: Could not connect to the database. Please try again later.";
    exit;
}
mysql_select_db($db_name);
$table = "dbversion";
开发者ID:rgronstedt,项目名称:PHP-Time-Clock,代码行数:31,代码来源:header.php

示例4: process_ratings

function process_ratings()
{
    global $wpdb, $user_identity, $user_ID;
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'postratings') {
        $rate = intval($_REQUEST['rate']);
        $post_id = intval($_REQUEST['pid']);
        // Verify Referer
        if (!check_ajax_referer('postratings_' . $post_id . '-nonce', 'postratings_' . $post_id . '_nonce', false)) {
            _e('Failed To Verify Referrer', 'wp-postratings');
            exit;
        }
        if ($rate > 0 && $post_id > 0 && check_allowtorate()) {
            // Check For Bot
            $bots_useragent = array('googlebot', 'google', 'msnbot', 'ia_archiver', 'lycos', 'jeeves', 'scooter', 'fast-webcrawler', 'slurp@inktomi', 'turnitinbot', 'technorati', 'yahoo', 'findexa', 'findlinks', 'gaisbo', 'zyborg', 'surveybot', 'bloglines', 'blogsearch', 'ubsub', 'syndic8', 'userland', 'gigabot', 'become.com');
            $useragent = $_SERVER['HTTP_USER_AGENT'];
            foreach ($bots_useragent as $bot) {
                if (stristr($useragent, $bot) !== false) {
                    return;
                }
            }
            header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
            postratings_textdomain();
            $rated = check_rated($post_id);
            // Check Whether Post Has Been Rated By User
            if (!$rated) {
                // Check Whether Is There A Valid Post
                $post = get_post($post_id);
                // If Valid Post Then We Rate It
                if ($post && !wp_is_post_revision($post)) {
                    $ratings_max = intval(get_option('postratings_max'));
                    $ratings_custom = intval(get_option('postratings_customrating'));
                    $ratings_value = get_option('postratings_ratingsvalue');
                    $post_title = addslashes($post->post_title);
                    $post_ratings = get_post_custom($post_id);
                    $post_ratings_users = !empty($post_ratings['ratings_users']) ? intval($post_ratings['ratings_users'][0]) : 0;
                    $post_ratings_score = !empty($post_ratings['ratings_score']) ? intval($post_ratings['ratings_score'][0]) : 0;
                    // Check For Ratings Lesser Than 1 And Greater Than $ratings_max
                    if ($rate < 1 || $rate > $ratings_max) {
                        $rate = 0;
                    }
                    $post_ratings_users = $post_ratings_users + 1;
                    $post_ratings_score = $post_ratings_score + intval($ratings_value[$rate - 1]);
                    $post_ratings_average = round($post_ratings_score / $post_ratings_users, 2);
                    update_post_meta($post_id, 'ratings_users', $post_ratings_users);
                    update_post_meta($post_id, 'ratings_score', $post_ratings_score);
                    update_post_meta($post_id, 'ratings_average', $post_ratings_average);
                    // Add Log
                    if (!empty($user_identity)) {
                        $rate_user = addslashes($user_identity);
                    } elseif (!empty($_COOKIE['comment_author_' . COOKIEHASH])) {
                        $rate_user = addslashes($_COOKIE['comment_author_' . COOKIEHASH]);
                    } else {
                        $rate_user = __('Guest', 'wp-postratings');
                    }
                    $rate_user = apply_filters('wp_postratings_process_ratings_user', $rate_user);
                    $rate_userid = apply_filters('wp_postratings_process_ratings_userid', intval($user_ID));
                    // Only Create Cookie If User Choose Logging Method 1 Or 3
                    $postratings_logging_method = intval(get_option('postratings_logging_method'));
                    if ($postratings_logging_method == 1 || $postratings_logging_method == 3) {
                        $rate_cookie = setcookie("rated_" . $post_id, $ratings_value[$rate - 1], time() + 30000000, apply_filters('wp_postratings_cookiepath', SITECOOKIEPATH));
                    }
                    // Log Ratings No Matter What
                    $rate_log = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->ratings} VALUES (%d, %d, %s, %d, %d, %s, %s, %s, %d )", 0, $post_id, $post_title, $ratings_value[$rate - 1], current_time('timestamp'), get_ipaddress(), @gethostbyaddr(get_ipaddress()), $rate_user, $rate_userid));
                    // Allow Other Plugins To Hook When A Post Is Rated
                    do_action('rate_post', $rate_userid, $post_id, $ratings_value[$rate - 1]);
                    // Output AJAX Result
                    echo the_ratings_results($post_id, $post_ratings_users, $post_ratings_score, $post_ratings_average);
                    exit;
                } else {
                    printf(__('Invalid Post ID. Post ID #%s.', 'wp-postratings'), $post_id);
                    exit;
                }
                // End if($post)
            } else {
                printf(__('You Had Already Rated This Post. Post ID #%s.', 'wp-postratings'), $post_id);
                exit;
            }
            // End if(!$rated)
        }
        // End if($rate && $post_id && check_allowtorate())
    }
    // End if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'postratings')
}
开发者ID:rkb09,项目名称:wp-postratings,代码行数:83,代码来源:wp-postratings.php

示例5: elseif

        $platform = 'ipad';
    } elseif (strpos($agent, 'iphone')) {
        $platform = 'iphone';
    } elseif (strpos($agent, 'android')) {
        $platform = 'android';
    } elseif (strpos($agent, 'unix')) {
        $platform = 'unix';
    } elseif (strpos($agent, 'linux')) {
        $platform = 'linux';
    } else {
        $platform = 'other';
    }
    return $platform;
}
// params
$ip = get_ipaddress();
$platform = getDeviceOS();
$type = $_POST['type'];
$url = $_POST['url'];
date_default_timezone_set(PRC);
$odate = date("Y-m-d H:i", time());
if ($conn) {
    // insert to database
    $query = "INSERT INTO tracking (ip, platform, type, url, odate) VALUES('{$ip}', '{$platform}', '{$type}','{$url}','{$odate}')";
    mysqli_query($conn, $query) or die("Error in query: {$query}. " . mysql_error());
} else {
    echo 'database is disconnect!';
}
mysqli_close($conn);
?>

开发者ID:coton,项目名称:luolai-h5-20151205,代码行数:31,代码来源:tracking.php

示例6: wprp_handle_reports

function wprp_handle_reports()
{
    global $wpdb, $wprp_message;
    // get Post PARAM
    $post_id = (int) $_POST['postID'];
    $report_as = $_POST['report_as'];
    $description = $_POST['description'];
    $ipaddress = get_ipaddress();
    $nonce = $_POST['wpnonce'];
    // Get the Post
    $post = get_post($post_id);
    // Check for POST
    if (!$post_id || !$post) {
        echo "<strong>Invalid Post</strong>";
        return;
    }
    // Security CHECK
    if (!wp_verify_nonce($nonce, $post_id)) {
        echo "<strong>Security Check Failed, Please Submit again...</strong>";
        return;
    }
    include_once 'ReportPost.class.php';
    $rp = new ReportPost($wpdb);
    if ($rp->add($post_id, $report_as, $description)) {
        $reported = true;
    } else {
        echo "! Sorry, Unable to Process your Request. Please contact Site Administrator via Email to Report this Issue";
    }
    /*
    	// tpValirable
    	$reported=false;
    	
    	// Check for Existing Post Report
    	$post_count=$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->reportpost WHERE post_id=%s",$post_id));
    	
    	if(is_numeric($post_count) && $post_count>0)
    	{
    		// Update the Description
    		$result=$wpdb->query( $wpdb->prepare("UPDATE $wpdb->reportpost SET description=CONCAT(description,%s) WHERE post_id=%s"," <br />[".$ipaddress."] : ".$report_as." | ".$description,$post_id));
    		
    		$reported=true;
    	}else{
    		// Do Report!
    		$result=$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->reportpost(post_id,post_title,user_ip,description,stamp) VALUES(%s,%s,%s,%s,%s)",$post_id, $post->post_title, $ipaddress,"[".$ipaddress."] : ".$report_as." | ".$description,time()));
    		$reported=true;
    		
    		// Send Mail
    		$send_email=get_option("rp_send_email");
    		if($send_email==1)
    		{
    			// SEND EMAIL
    			$mail_to=get_option("rp_email_address");
    			$mail_subject="[REPORT] : ".$post->post_title;
    			$mail_body="Following Post has been Reported through ".get_option("blogname")."\n-----\n";
    			$mail_body.="POST ID: ".$post_id."\n";
    			$mail_body.="POST TITLE: ".$post->post_title."\n";
    			$mail_body.="Reported As: ".$report_as."\n";
    			$mail_body.="Description: \n".$description."\n";
    			$mail_body.="\n-----\nThank You";
    			
    			$mail_header="From: Admin <".get_option("admin_email").">";
    			
    			// Send mail // @ Prvent from Showing Any Error Message JUST in CASE
    			@mail($mail_to,$mail_subject,$mail_body,$mail_header);
    		}
    		
    	}*/
    if ($reported) {
        // get thanks Option
        $thanksMsg = get_option('rp_thanks_msg');
        if (empty($thanksMsg)) {
            $thanksMsg = "<strong>Thanks for Reporting [TITLE]</strong>";
        }
        $thanksMsg = str_replace("[TITLE]", $post->post_title, $thanksMsg);
        echo $thanksMsg;
        echo "<br />Reported as : " . $report_as;
        if (!empty($description)) {
            echo "<br />Comments : " . $description;
        }
    }
}
开发者ID:CodersPress,项目名称:pp-reportpost,代码行数:81,代码来源:ajax.php

示例7: vote_poll

function vote_poll()
{
    global $wpdb, $user_identity, $user_ID;
    if (!empty($_POST['vote'])) {
        polls_textdomain();
        header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
        $poll_id = intval($_POST['poll_id']);
        $poll_aid = $_POST["poll_{$poll_id}"];
        $poll_aid_array = explode(',', $poll_aid);
        if ($poll_id > 0 && !empty($poll_aid_array) && check_allowtovote()) {
            $check_voted = check_voted($poll_id);
            if ($check_voted == 0) {
                if (!empty($user_identity)) {
                    $pollip_user = addslashes($user_identity);
                } elseif (!empty($_COOKIE['comment_author_' . COOKIEHASH])) {
                    $pollip_user = addslashes($_COOKIE['comment_author_' . COOKIEHASH]);
                } else {
                    $pollip_user = __('Guest', 'wp-polls');
                }
                $pollip_userid = intval($user_ID);
                $pollip_ip = get_ipaddress();
                $pollip_host = @gethostbyaddr($pollip_ip);
                $pollip_timestamp = current_time('timestamp');
                // Only Create Cookie If User Choose Logging Method 1 Or 2
                $poll_logging_method = intval(get_option('poll_logging_method'));
                if ($poll_logging_method == 1 || $poll_logging_method == 3) {
                    $cookie_expiry = intval(get_option('poll_cookielog_expiry'));
                    if ($cookie_expiry == 0) {
                        $cookie_expiry = 30000000;
                    }
                    $vote_cookie = setcookie('voted_' . $poll_id, $poll_aid, $pollip_timestamp + $cookie_expiry, COOKIEPATH);
                }
                $i = 0;
                foreach ($poll_aid_array as $polla_aid) {
                    $update_polla_votes = $wpdb->query("UPDATE {$wpdb->pollsa} SET polla_votes = (polla_votes+1) WHERE polla_qid = {$poll_id} AND polla_aid = {$polla_aid}");
                    if (!$update_polla_votes) {
                        unset($poll_aid_array[$i]);
                    }
                    $i++;
                }
                $vote_q = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_totalvotes = (pollq_totalvotes+" . sizeof($poll_aid_array) . "), pollq_totalvoters = (pollq_totalvoters+1) WHERE pollq_id = {$poll_id} AND pollq_active = 1");
                if ($vote_q) {
                    foreach ($poll_aid_array as $polla_aid) {
                        $wpdb->query("INSERT INTO {$wpdb->pollsip} VALUES (0, {$poll_id}, {$polla_aid}, '{$pollip_ip}', '{$pollip_host}', '{$pollip_timestamp}', '{$pollip_user}', {$pollip_userid})");
                    }
                    echo display_pollresult($poll_id, $poll_aid_array, false);
                    exit;
                } else {
                    printf(__('Unable To Update Poll Total Votes And Poll Total Voters. Poll ID #%s', 'wp-polls'), $poll_id);
                    exit;
                }
                // End if($vote_a)
            } else {
                printf(__('You Had Already Voted For This Poll. Poll ID #%s', 'wp-polls'), $poll_id);
                exit;
            }
            // End if($check_voted)
        } else {
            printf(__('Invalid Poll ID. Poll ID #%s', 'wp-polls'), $poll_id);
            exit;
        }
        // End if($poll_id > 0 && $poll_aid > 0)
    } elseif (intval($_GET['pollresult']) > 0) {
        header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
        $poll_id = intval($_GET['pollresult']);
        echo display_pollresult($poll_id, 0, false);
        exit;
    } elseif (intval($_GET['pollbooth']) > 0) {
        header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
        $poll_id = intval($_GET['pollbooth']);
        echo display_pollvote($poll_id, false);
        exit;
    }
    // End if(!empty($_POST['vote']))
}
开发者ID:jkreska,项目名称:test1,代码行数:75,代码来源:wp-polls.php

示例8: mysql_real_escape_string

    $q_notes = mysql_real_escape_string($notes);
    $h_notes = htmlentities($notes);
    $q_empfullname = mysql_real_escape_string($empfullname);
    // Validate and get inout display color.
    $query = "select color from " . $db_prefix . "punchlist where punchitems = '{$q_inout}'";
    $punchlist_result = mysql_query($query);
    $inout_color = mysql_result($punchlist_result, 0, 0);
    if (!$inout_color) {
        #print error_msg("In/Out Status is not in the database.");
        trigger_error('In/Out Status is not in the database.', E_USER_WARNING);
        exit;
    }
    $h_color = htmlentities($inout_color);
    // Record time.
    $tz_stamp = utm_timestamp();
    $ip = strtolower($ip_logging) == "yes" ? "'" . get_ipaddress() . "'" : 'NULL';
    $insert_query = <<<End_Of_SQL
insert into {$db_prefix}info (fullname, `inout`, timestamp, notes, ipaddress)
values ('{$q_empfullname}', '{$q_inout}', '{$tz_stamp}', '{$q_notes}', {$ip})
End_Of_SQL;
    $update_query = <<<End_Of_SQL
update {$db_prefix}employees
set tstamp = '{$tz_stamp}'
where empfullname = '{$q_empfullname}'
End_Of_SQL;
    if (mysql_query($insert_query)) {
        mysql_query($update_query) or trigger_error('entry: cannot update tstamp in employee record. ' . mysql_error(), E_USER_WARNING);
    } else {
        trigger_error('entry: cannot insert timestamp into info record. ' . mysql_error(), E_USER_WARNING);
    }
    # Uncomment next to display success message. The entry status display also shows last punch-in/out.
开发者ID:benscanfiles,项目名称:timeclock,代码行数:31,代码来源:entry.php

示例9: cpm_get_email_header

<?php

cpm_get_email_header();
$new = CPM_URL . '/assets/images/new.png';
$triangle = CPM_URL . '/assets/images/triangle.png';
$template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => get_post_field('post_title', $project_id), '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>', '%AUTHOR%' => $user->display_name, '%AUTHOR_EMAIL%' => $user->user_email, '%TASKLIST_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_tasklist($project_id, $list_id) . '">' . get_post_field('post_title', $list_id) . '</a>', '%TASK_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_task($project_id, $list_id, $task_id) . '">' . get_post_field('post_title', $task_id) . '</a>', '%TASK%' => $data['post_content'], '%IP%' => get_ipaddress());
$subject = cpm_get_option('new_task_sub');
$message = cpm_get_content(cpm_get_option('new_task_body'));
// subject
foreach ($template_vars as $key => $value) {
    $subject = str_replace($key, $value, $subject);
}
// message
foreach ($template_vars as $key => $value) {
    $message = str_replace($key, $value, $message);
}
?>


    <table width="600" style="margin-top: 50px; background: #fff;">
    	<tr>
    		<td>
    			<center><img src="<?php 
echo $new;
?>
"/></center>
    		</td>
    	</tr> 
    	<tr>
    		<td>
    			<center><div style="font-size: 45px; padding-top: 38px;"><?php 
开发者ID:javalidigital,项目名称:multipla,代码行数:31,代码来源:new-task.php

示例10: rtp_display_template

    function rtp_display_template($post_id = 0)
    {
        global $id;
        $rtp_options = get_option('aft_options_array');
        $session_key = $_COOKIE[RTP_COOKIE_NAME];
        if (intval($post_id) > 0) {
            $postid = $post_id;
        } else {
            $postid = $id;
        }
        $is_rated = rtp_is_rated($postid);
        $is_page = 'post' === get_post_type() ? 'false' : 'true';
        // Show the current rating data if logged by IP or by IP and Cookie
        if ($rtp_options['rtp_logged_by'] == 1 || $rtp_options['rtp_logged_by'] == 3) {
            $data = rtp_fetch_ratings_byip($postid, get_ipaddress(), $is_page);
        } else {
            $data = aft_plgn_fetch_ratings($postid, $session_key, $is_page);
        }
        $ave_data = aft_plgn_fetch_rate_summary($postid, $is_page);
        $display = '<!--Main Content-->
			<div class="rtp-feedback">
				<div class="rtp-feedback-panel">
					<div class="rtp-feedback-buffer">
						<div id="rtp-report" class="rtp-switch rtp-switch-form">View ratings</div>
						<div id="rtp-form" class="rtp-switch rtp-switch-report">Rate this article</div>
						<div class="feedback-title rtp-switch-form">%TITLE_LABEL%</div>
						<div class="feedback-title rtp-switch-report" id="rtp-report-title">%TITLE_LABEL_REPORT%<br /><span>Current average ratings.</span></div>
						<div style="clear:both;"></div>
						<!--Primary Feedback-->
						<div class="feedback-rating">									
							<div class="feedback-ratings">
								<div class="feedback-label">%LABEL_TRUSTWORTHY%</div>
								<span class="rtp-average-report rtp-switch-report">%AVE_TRUSTWORTHY%</span>
								<div id="rtp-trustworthy-bar" class="rtp-switch-report"></div>
								<div class="rtp-switch-form" id="feedback-trustworthy">
									<input type="hidden" id="rtp-trustworthy-val" name="trustworthy-score" value="%VAL_TRUSTWORTHY%" />
								</div>
								<div class="rtp-rating-count rtp-switch-report">%COUNT_TRUSTWORTHY%</div>
								<div class="rtp-trustworthy-hint"></div>
							</div>
							<div class="feedback-ratings">
								<div class="feedback-label">%LABEL_OBJECTIVE%</div>
								<span class="rtp-average-report rtp-switch-report">%AVE_OBJECTIVE%</span>
								<div id="rtp-objective-bar" class="rtp-switch-report"></div>
								<div class="rtp-switch-form" id="feedback-objective">
									<input type="hidden" id="rtp-objective-val" name="objective-score" value="%VAL_OBJECTIVE%" />
								</div>
								<div class="rtp-rating-count rtp-switch-report">%COUNT_OBJECTIVE%</div>
								<div class="rtp-objective-hint"></div>
							</div>
							<div class="feedback-ratings">
								<div class="feedback-label">%LABEL_COMPLETE%</div>
								<span class="rtp-average-report rtp-switch-report">%AVE_COMPLETE%</span>
								<div id="rtp-complete-bar" class="rtp-switch-report"></div>
								<div class="rtp-switch-form" id="feedback-complete">
									<input type="hidden" id="rtp-complete-val" name="complete-score" value="%VAL_COMPLETE%" />
								</div>
								<div class="rtp-rating-count rtp-switch-report">%COUNT_COMPLETE%</div>
								<div class="rtp-complete-hint"></div>
							</div>
							<div class="feedback-ratings">
								<div class="feedback-label">%LABEL_WELLWRITTEN%</div>
								<span class="rtp-average-report rtp-switch-report">%AVE_WELLWRITTEN%</span>
								<div id="rtp-wellwritten-bar" class="rtp-switch-report"></div>
								<div class="rtp-switch-form" id="feedback-wellwritten">
									<input type="hidden" id="rtp-wellwritten-val" name="wellwritten-score" value="%VAL_WELLWRITTEN%" />
								</div>
								<div class="rtp-rating-count rtp-switch-report">%COUNT_WELLWRITTEN%</div>
								<div class="rtp-wellwritten-hint"></div>
							</div>
						</div>
					<div style="clear:both;"></div>
					<!--For Feedback Options-->
					<div class="feedback-options rtp-switch-form">
						<div class="feedback-options-selection">
							<input id="feedback-options-general" type="checkbox" name="feedback-general" value="" />
							<label class="feedback-label" for="feedback-options-general">' . __('I am highly knowledgeable about this topic (optional)') . '</label>
						</div>
						<div class="feeback-helpimprove-hidden" style="display:none;">
							<ul id="feedback-helpimprove">
								<li><input id="feedbackStudies" type="checkbox" name="feedback-studies" value="" /><label class="feedback-label" for="feedbackStudies">' . __('I have a relevant college/university degree') . '</label></li>
								<li><input id="feedbackProfession" type="checkbox" name="feedback-profession" value="" /><label class="feedback-label" for="feedbackProfession">' . __('It is part of my profession') . '</label></li>
								<li><input id="feedbackPassion" type="checkbox" name="feedback-passion" value="" /><label class="feedback-label" for="feedbackPassion">' . __('It is a deep personal passion') . '</label></li>
							</ul>
						</div>
					</div>
					<button class="rtp-button rtp-switch-form" id="submit-feedback" type="submit" name="aft-submit-feedback" value="aft-submit-feedback"><span id="rtp-button-label">' . __('Submit Ratings') . '</span></button>
					<div id="formstatus" class="rtp-switch-form"></div>
					</div>
				</div>
				<input type="hidden" id="feedback-postid" name="feedback-postid" value="%POST_ID%" />
				<input type="hidden" id="feedback-datetime" name="feedback-datetime" value="%RATE_DATE%" />
				<input type="hidden" id="feedback-ispage" name="feedback-ispage" value="%IS_PAGE%" />
			</div>';
        return rtp_extend_template($display, $postid, $data, $ave_data);
    }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:96,代码来源:rtp-main.php

示例11: process_ratings

function process_ratings()
{
    global $wpdb, $user_identity, $user_ID;
    $rate = intval($_GET['rate']);
    $post_id = intval($_GET['pid']);
    if ($rate > 0 && $post_id > 0 && check_allowtorate()) {
        // Check For Bot
        $bots_useragent = array('googlebot', 'google', 'msnbot', 'ia_archiver', 'lycos', 'jeeves', 'scooter', 'fast-webcrawler', 'slurp@inktomi', 'turnitinbot', 'technorati', 'yahoo', 'findexa', 'findlinks', 'gaisbo', 'zyborg', 'surveybot', 'bloglines', 'blogsearch', 'ubsub', 'syndic8', 'userland', 'gigabot', 'become.com');
        $useragent = $_SERVER['HTTP_USER_AGENT'];
        foreach ($bots_useragent as $bot) {
            if (stristr($useragent, $bot) !== false) {
                return;
            }
        }
        header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
        postratings_textdomain();
        $rated = check_rated($post_id);
        // Check Whether Post Has Been Rated By User
        if (!$rated) {
            // Check Whether Is There A Valid Post
            $post = get_post($post_id);
            // If Valid Post Then We Rate It
            if ($post && !wp_is_post_revision($post)) {
                $ratings_max = intval(get_option('postratings_max'));
                $ratings_custom = intval(get_option('postratings_customrating'));
                $ratings_value = get_option('postratings_ratingsvalue');
                $post_title = addslashes($post->post_title);
                $post_ratings = get_post_custom($post_id);
                $post_ratings_users = intval($post_ratings['ratings_users'][0]);
                $post_ratings_score = intval($post_ratings['ratings_score'][0]);
                // Check For Ratings Lesser Than 1 And Greater Than $ratings_max
                if ($rate < 1 || $rate > $ratings_max) {
                    $rate = 0;
                }
                $post_ratings_users = $post_ratings_users + 1;
                $post_ratings_score = $post_ratings_score + intval($ratings_value[$rate - 1]);
                $post_ratings_average = round($post_ratings_score / $post_ratings_users, 2);
                if (!update_post_meta($post_id, 'ratings_users', $post_ratings_users)) {
                    add_post_meta($post_id, 'ratings_users', $post_ratings_users, true);
                }
                if (!update_post_meta($post_id, 'ratings_score', $post_ratings_score)) {
                    add_post_meta($post_id, 'ratings_score', $post_ratings_score, true);
                }
                if (!update_post_meta($post_id, 'ratings_average', $post_ratings_average)) {
                    add_post_meta($post_id, 'ratings_average', $post_ratings_average, true);
                }
                // Add Log
                if (!empty($user_identity)) {
                    $rate_user = addslashes($user_identity);
                } elseif (!empty($_COOKIE['comment_author_' . COOKIEHASH])) {
                    $rate_user = addslashes($_COOKIE['comment_author_' . COOKIEHASH]);
                } else {
                    $rate_user = __('Guest', 'wp-postratings');
                }
                $rate_userid = intval($user_ID);
                // Only Create Cookie If User Choose Logging Method 1 Or 3
                $postratings_logging_method = intval(get_option('postratings_logging_method'));
                if ($postratings_logging_method == 1 || $postratings_logging_method == 3) {
                    $rate_cookie = setcookie("rated_" . $post_id, $ratings_value[$rate - 1], time() + 30000000, COOKIEPATH);
                }
                // Log Ratings No Matter What
                $rate_log = $wpdb->query("INSERT INTO {$wpdb->ratings} VALUES (0, {$post_id}, '{$post_title}', " . $ratings_value[$rate - 1] . ",'" . current_time('timestamp') . "', '" . get_ipaddress() . "', '" . esc_attr(@gethostbyaddr(get_ipaddress())) . "' ,'{$rate_user}', {$rate_userid})");
                # store into transver LHG database
                lhg_store_ratings($post_id, $post_ratings_users, $post_ratings_score, $ratings_value[$rate - 1]);
                // Output AJAX Result
                //echo the_ratings_results($post_id, $post_ratings_users, $post_ratings_score, $post_ratings_average);
                //show my rating, not the average
                echo the_ratings_results($post_id, $post_ratings_users, $post_ratings_score, $ratings_value[$rate - 1]);
                exit;
            } else {
                printf(__('Invalid Post ID. Post ID #%s.', 'wp-postratings'), $post_id);
                exit;
            }
            // End if($post)
        } else {
            printf(__('You Had Already Rated This Post. Post ID #%s.', 'wp-postratings'), $post_id);
            exit;
        }
        // End if(!$rated)
    }
    // End if($rate && $post_id && check_allowtorate())
}
开发者ID:cptpike,项目名称:linuxhardwareguide,代码行数:82,代码来源:wp-postratings.php

示例12: cpm_get_email_header

<?php

$users = $this->prepare_contacts();
if (!$users) {
    return;
}
cpm_get_email_header();
$new = CPM_URL . '/assets/images/new.png';
$triangle = CPM_URL . '/assets/images/triangle.png';
$pro_obj = CPM_Project::getInstance();
$msg_obj = CPM_Message::getInstance();
$project = $pro_obj->get($project_id);
$msg = $msg_obj->get($message_id);
$author = wp_get_current_user();
$template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => $project->post_title, '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>', '%AUTHOR%' => $author->display_name, '%AUTHOR_EMAIL%' => $author->user_email, '%MESSAGE_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_message($project_id, $message_id) . '">' . get_post_field('post_title', $message_id) . '</a>', '%MESSAGE%' => $msg->post_content, '%IP%' => get_ipaddress());
$subject = cpm_get_option('new_message_sub');
$message = cpm_get_content(cpm_get_option('new_message_body'));
// subject
foreach ($template_vars as $key => $value) {
    $subject = str_replace($key, $value, $subject);
}
// message
foreach ($template_vars as $key => $value) {
    $message = str_replace($key, $value, $message);
}
?>

    <table width="600" style="margin-top: 50px; background: #fff;">
    	<tr>
    		<td>
    			<center><img src="<?php 
开发者ID:javalidigital,项目名称:multipla,代码行数:31,代码来源:new-message.php

示例13: rtp_logged_ip

 function rtp_logged_ip($post_id)
 {
     global $wpdb;
     $sql = "SELECT ip FROM %sfeedbacks WHERE post_id = %d AND ip = %d";
     $sql = sprintf($sql, $wpdb->prefix, $post_id, get_ipaddress());
     return intval($wpdb->get_var($sql));
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:7,代码来源:rtp-query.php

示例14: get_post

$msg_obj = CPM_Message::getInstance();
$parent_post = get_post($data['comment_post_ID']);
$author = wp_get_current_user();
$comment_url = '';
switch ($parent_post->post_type) {
    case 'message':
        $comment_url = cpm_url_single_message($project_id, $data['comment_post_ID']);
        break;
    case 'task_list':
        $comment_url = cpm_url_single_tasklist($project_id, $parent_post->ID);
        break;
    case 'task':
        $comment_url = cpm_url_single_task($project_id, $parent_post->post_parent, $parent_post->ID);
        break;
}
$template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => get_post_field('post_title', $project_id), '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>', '%AUTHOR%' => $author->display_name, '%AUTHOR_EMAIL%' => $author->user_email, '%COMMENT_URL%' => '<a style="text-decoration: none;" href="' . $comment_url . '/#cpm-comment-' . $comment_id . '">' . __('comment link', 'cpm') . '</a>', '%COMMENT%' => $data['comment_content'], '%IP%' => get_ipaddress());
$subject = cpm_get_option('new_comment_sub');
$message = cpm_get_content(cpm_get_option('new_comment_body'));
// subject
foreach ($template_vars as $key => $value) {
    $subject = str_replace($key, $value, $subject);
}
// message
foreach ($template_vars as $key => $value) {
    $message = str_replace($key, $value, $message);
}
?>

  	<table width="600" style="margin-top: 50px; background: #fff;">
    	<tr>
    		<td>
开发者ID:javalidigital,项目名称:multipla,代码行数:31,代码来源:new-comment.php

示例15: detectID

/**
 * Tries to find any session id in $_GET, $_POST or $_COOKIE
 *
 * @param string $sessionname - the name of this session..   
 * @param bool   $allow_ip_host_sessions -  finding session id based on ip and host (identity)
 * @param string   $identitystring - host/ip string
 *
 * @global object $mydatabase mysql database object.  
 * @global array  $_POST  
 * @global array  $_GET               
 * @global array  $_COOKIE     
 *  
 * @return string Session ID (if exists) or empty string
 */
function detectID($sessionname, $allowhostiplogins, $identitystring)
{
    global $mydatabase, $CSLH_Config, $UNTRUSTED;
    $PHPSESSID = "";
    if (!empty($UNTRUSTED[$sessionname])) {
        $PHPSESSID = $UNTRUSTED[$sessionname];
    }
    if (!empty($_GET[$sessionname])) {
        $PHPSESSID = $_GET[$sessionname];
    }
    if (!empty($_POST[$sessionname])) {
        $PHPSESSID = $_POST[$sessionname];
    }
    if (!empty($_COOKIE[$sessionname])) {
        $PHPSESSID = $_COOKIE[$sessionname];
    }
    // Security : If SESSIONID is aquired make sure it is sent from
    //            the same class C ip address.. This is so people following referer
    //            links do not gain access to the account by having the
    //            operators sessionid. the class C is used because of proxies.
    if ($CSLH_Config['matchip'] == "Y" && !empty($PHPSESSID)) {
        $hostip_array = explode(".", get_ipaddress());
        $classc = "{$hostip_array['0']}.{$hostip_array['1']}.{$hostip_array['2']}";
        $sqlquery = "SELECT sessionid FROM livehelp_users WHERE sessionid='" . filter_sql($PHPSESSID) . "' AND ipaddress LIKE '" . $classc . "%' LIMIT 1";
        $test = $mydatabase->query($sqlquery);
        if ($test->numrows() == 0) {
            $PHPSESSID = "";
        }
    }
    // if we allow same host ip logins and this is a Database session:
    // this is useful when we absolutly can not set the cookie.
    if ($allowhostiplogins && empty($PHPSESSID)) {
        // query database for this hostip.
        $sqlquery = "SELECT sessionid FROM livehelp_users WHERE identity='" . filter_sql($identitystring) . "' AND cookied='N'";
        $people = $mydatabase->query($sqlquery);
        if ($people->numrows() != 0) {
            $row = $people->fetchRow(DB_FETCHMODE_ORDERED);
            $PHPSESSID = $row[0];
        }
    }
    if (!preg_match('/^[A-Za-z0-9]*$/', $PHPSESSID)) {
        $PHPSESSID = "";
    }
    return $PHPSESSID;
}
开发者ID:pankajsinghjarial,项目名称:SYLC-AMERICAN,代码行数:59,代码来源:functions.php


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