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


PHP sanitize_text函数代码示例

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


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

示例1: create_new_group

 public function create_new_group($name, $public, $category_id, $max_members, $user_id, $description)
 {
     $new_group_data = array();
     $new_group_data['name'] = sanitize_text($name);
     $new_group_data['public'] = $public;
     $new_group_data['category'] = sanitize_int($category_id);
     $new_group_data['max'] = sanitize_int($max_members);
     $new_group_data['creator'] = sanitize_int($user_id);
     $new_group_data['desc'] = $this->make_description_safe($description);
     $result = $this->save_new_group($new_group_data);
     return $result;
 }
开发者ID:DonBananos,项目名称:studyteam,代码行数:12,代码来源:group_controller.php

示例2: ip_address

/**
 * Try to fetch the current users IP address
 * @return string
 */
function ip_address()
{
    //Get IP address - if proxy lets get the REAL IP address
    if (!empty($_SERVER['REMOTE_ADDR']) and !empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
        $ip = $_SERVER['REMOTE_ADDR'];
    } elseif (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $ip = '0.0.0.0';
    }
    //Clean the IP and return it
    return sanitize_text($ip, 2);
}
开发者ID:stas,项目名称:facebook-ideas-app,代码行数:21,代码来源:common.php

示例3: the_referers

function the_referers($num = 5, $before = '<li>', $after = '</li>', $none = 'none yet')
{
    $completed = 0;
    if ($referers = $GLOBALS['post_meta_cache'][wp_id()][$GLOBALS['wp_post_id']]['wp-refer']) {
        $referers = array_reverse($referers);
        foreach ($referers as $referer) {
            $referer = explode(':!-!:', $referer);
            $title = mb_conv(sanitize_text($referer[0]), $GLOBALS['blog_charset'], 'auto');
            $url = sanitize_text($referer[1], false, true);
            echo $before . '<a href="' . $url . '">' . $title . '</a>' . $after;
            $completed++;
            if ($completed == $num) {
                break;
            }
        }
    } else {
        echo $before . $none . $after;
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:19,代码来源:wp-refer.php

示例4: the_referers

function the_referers($num = 5, $before = "<li>", $after = "</li>", $none = "none yet")
{
    global $post_meta_cache, $id, $wp_id, $blog_charset;
    $completed = 0;
    if ($referers = $post_meta_cache[$wp_id][$id]['wp-refer']) {
        $referers = array_reverse($referers);
        foreach ($referers as $referer) {
            $referer = explode(":!-!:", $referer);
            $title = mb_conv(sanitize_text($referer[0]), $blog_charset, "auto");
            $url = sanitize_text($referer[1], false, true);
            echo $before . "<a href=\"{$url}\">{$title}</a>" . $after;
            $completed++;
            if ($completed == $num) {
                break;
            }
        }
    } else {
        echo $before . $none . $after;
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:20,代码来源:wp-refer.php

示例5: insertComment

 public static function insertComment($comment)
 {
     $commentText = sanitize_text($comment['commentText']);
     $userId = $comment['userId'];
     $postId = $comment['postId'];
     $query = "INSERT INTO comments VALUES (NULL,'{$commentText}',NOW(),'{$postId}','{$userId}','1')";
     $result = @mysql_query($query);
     if ($result != false) {
         $lastCmmtId = mysql_insert_id();
         $lastCmmtQ = "SELECT \n\t\t\tcommentId,\n\t\t\tcommentText,\n\t\t\tUNIX_TIMESTAMP(commentDate) AS commentDate,\n\t\t\tfirstName,\n\t\t\tlastName,\n\t\t\tusername,\n\t\t\tprofilePicAddr\n\t\t\tFROM comments\n\t\t\tJOIN user ON comments.userId = user.userId\n\t\t\tJOIN profilepics ON profilepics.userId = comments.userId\n\t\t\tWHERE comments.commentId = '{$lastCmmtId}' AND profilepics.statusId = 1";
         $lastCmmtR = mysql_query($lastCmmtQ);
         if ($lastCmmtR != false) {
             $lastCmmt = mysql_fetch_array($lastCmmtR);
             return $lastCmmt;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:amriterry,项目名称:ptn,代码行数:21,代码来源:comment.php

示例6: init_param

<body></body>
</html><?php 
} else {
    init_param('GET', 'popuptitle', 'string', '');
    init_param('GET', 'popupurl', 'string', '');
    init_param('GET', 'text', 'html', '');
    init_param('GET', 'post_pingback', 'integer', 0);
    $action = 'post';
    $pinged = '';
    $default_post_cat = get_settings('default_post_category');
    /* big funky fixes for browsers' javascript bugs */
    $_popuptitle = fix_js_param(get_param('popuptitle'));
    $_text = fix_js_param(get_param('text'));
    $_popuptitle = sanitize_text($_popuptitle);
    $_text = sanitize_text($_text, true);
    $_popupurl = sanitize_text(get_param('popupurl'), true, true);
    $post_title = $_popuptitle;
    $edited_post_title = $post_title;
    $content = '<a href="' . $_popupurl . '">' . $_popuptitle . '</a>' . "\n{$_text}";
    // autodetect Trackback
    $tb_obj = new WP_TrackBack_XML_collection();
    $trackback_url = $tb_obj->get($_popupurl);
    $target_charset = $tb_obj->charset;
    $_css_file = get_custom_url('wp-admin.css');
    $_xoops_css = xoops_getcss($GLOBALS['xoopsConfig']['theme_set']);
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress > Bookmarklet</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:bookmarklet.php

示例7: sanitize_text

<?php

require "../includes/conf.inc.php";
require "../includes/functions.inc.php";
$sq = $_POST['search'];
$sqn = sanitize_text($sq);
$searchResult = post::searchPosts($sqn, '');
if ($searchResult == false) {
    echo $e;
} else {
    if ($searchResult == 'empty') {
        echo '<span class="search-wait">No Results Found</span>';
    } else {
        $srOutput = '';
        foreach ($searchResult as $sr) {
            $srOutput .= '<a href="' . generate_link($sr['postTitle'], $sr['postId']) . '">' . $sr['postTitle'] . '</a>';
        }
        echo $srOutput;
    }
}
开发者ID:amriterry,项目名称:ptn,代码行数:20,代码来源:ajax.php

示例8: Student_controller

<?php

require_once './includes/configuration.php';
require_once './student/student_controller.php';
$display_message = FALSE;
$sc = new Student_controller();
if (isset($_POST['login'])) {
    $user = sanitize_text($_POST['user']);
    $pass = sanitize_text($_POST['pass']);
    $error_msg;
    if ($sc->validate_username($user) !== 1 || $sc->validate_password($pass) === FALSE) {
        $error_msg = "Invalid username or password";
        $display_message;
    } else {
        $answer = $sc->log_member_in($user, $pass);
        if ($answer !== FALSE && $answer !== TRUE) {
            $display_message = TRUE;
        } elseif ($answer === FALSE) {
            $display_message = TRUE;
        }
    }
    if (isset($_SESSION['logged_in'])) {
        if (!empty($_SESSION['tried_url'])) {
            $tried_url = $_SESSION['tried_url'];
            $_SESSION['tried_url'] = null;
            ?>
			<script>window.location = "<?php 
            echo $tried_url;
            ?>
";</script>
			<?php 
开发者ID:DonBananos,项目名称:studyteam,代码行数:31,代码来源:login.php

示例9: header

<?php

require "../includes/conf.inc.php";
require "../includes/functions.inc.php";
if (!isset($_SESSION['userLogin'])) {
    header("location: login.php");
} else {
    if (!isset($_GET['u'])) {
        $userId = $_SESSION['userId'];
        $userInfo = user::getUserInfoById(1);
        /*if($userInfo == false){
        			echo 'err';
        		}*/
        var_dump($userInfo);
    } else {
        $userName = sanitize_text($_GET['u']);
        if ($userName == '') {
            $userId = $_SESSION['userId'];
            $userInfo = user::getUserInfoById($userId);
            echo 'Dfd';
            if ($userInfo == false) {
                die($e);
            }
        } else {
            $userInfo = user::getUserInfoByUsername($userName);
            if ($userInfo == false) {
                die($e);
            }
        }
    }
}
开发者ID:amriterry,项目名称:ptn,代码行数:31,代码来源:index.php

示例10: sanitize_text

        ?>
 &rsaquo; <?php 
        echo $title;
        ?>
</title>
<link rel="stylesheet" href="<?php 
        echo $css_file;
        ?>
" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        echo $blog_charset;
        ?>
" />
<?php 
        if ($redirect == 1) {
            $redirect_url = sanitize_text($redirect_url);
            ?>
<script language="javascript" type="text/javascript">
<!--
function redirect() {
  window.location = "<?php 
            echo $redirect_url;
            ?>
";
}
setTimeout("redirect();", 600);
//-->
</script>
<?php 
        }
    }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:admin-header.php

示例11: db_query

             $result = db_query("SELECT * FROM comment WHERE status = 0 AND " . "url LIKE '{$listpath}%' ORDER BY id");
             print "<p><a href='{$PHP_SELF}?L'>Show All Comments</a></p>\n";
         }
     }
     if (db_count($result) == 0) {
         if ($LOGIN_LEVEL >= AUTH_DEVEL && $op == 'l') {
             print "<p>No hidden comments.</p>\n";
         } else {
             print "<p>No visible comments.</p>\n";
         }
     } else {
         print "<ul>\n";
         while ($row = db_next($result)) {
             $create_date = date("M d, Y", $row['create_date']);
             $create_user = sanitize_email($row['create_user']);
             $contents = sanitize_text($row['contents']);
             $location = str_replace("_", "?", $row['url']);
             print "<li><a href='{$location}'>{$row['url']}</a> " . " by {$create_user} on {$create_date} " . "<a href='{$PHP_SELF}?e{$row['id']}+p{$row['url']}'>Edit</a> " . "&middot; <a href='{$PHP_SELF}?d{$row['id']}+p{$row['url']}'>Delete</a>" . "<br><tt>{$contents}</tt></li>\n";
         }
         print "</ul>\n";
     }
     db_free($result);
     html_footer();
     break;
 case 'm':
     // Moderate
     if (array_key_exists("MODPOINTS", $_COOKIE)) {
         $modpoints = $_COOKIE["MODPOINTS"];
     } else {
         $modpoints = 5;
     }
开发者ID:jokepinocchio,项目名称:MiniXML,代码行数:31,代码来源:comment.php

示例12: preg_replace

 if ($is_macIE && !isset($IEMac_bookmarklet_fix)) {
     $popuptitle = preg_replace($wp_macIE_correction["in"], $wp_macIE_correction["out"], $popuptitle);
     $text = preg_replace($wp_macIE_correction["in"], $wp_macIE_correction["out"], $text);
 }
 if ($is_winIE && !isset($IEWin_bookmarklet_fix)) {
     $popuptitle = preg_replace("/\\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $popuptitle);
     $text = preg_replace("/\\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
 }
 if ($is_gecko && !isset($Gecko_bookmarklet_fix)) {
     $popuptitle = preg_replace($wp_gecko_correction["in"], $wp_gecko_correction["out"], $popuptitle);
     $text = preg_replace($wp_gecko_correction["in"], $wp_gecko_correction["out"], $text);
 }
 $post_title = $_REQUEST['post_title'];
 if (!empty($post_title)) {
     //        $post_title =  stripslashes($post_title);
     $post_title = sanitize_text($post_title);
 } else {
     $post_title = $popuptitle;
 }
 // I'm not sure why we're using $edited_post_title in the edit-form.php, but we are
 // and that is what is being included below. For this reason, I am just duplicating
 // the var instead of changing the assignment on the lines above.
 // -- Alex King 2004-01-07
 $edited_post_title = $post_title;
 $content = $_REQUEST['content'];
 if (!empty($content)) {
     $content = stripslashes($content);
 } else {
     $content = '<a href="' . $popupurl . '">' . $popuptitle . '</a>' . "\n{$text}";
 }
 /* /big funky fixes */
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:bookmarklet.php

示例13: sanitize_text

<?php

require "../includes/conf.inc.php";
require "../includes/functions.inc.php";
if (isset($_POST['email'])) {
    $email = sanitize_text($_POST['email']);
    if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $selQuery = "SELECT user.userId FROM user WHERE user.email = '{$email}'";
        $selResult = @mysql_query($selQuery) or die($e);
        $numEmail = mysql_num_rows($selResult);
        if ($numEmail != 1) {
            echo 0;
        } else {
            echo 1;
        }
    } else {
        echo 2;
    }
}
开发者ID:amriterry,项目名称:ptn,代码行数:19,代码来源:check-email.php

示例14: elseif

        } else {
            $answer = "Something went wrong. Please reload page and try again!";
        }
        ?>
		<script>alert("<?php 
        echo $answer;
        ?>
");</script>
		<?php 
    } elseif (isset($_POST['edit'])) {
        $student_level_in_group = $student->get_student_level_in_group($group->get_id());
        if ($student_level_in_group === 2 || $student_level_in_group === 3) {
            $safe_name = sanitize_text($_POST['editGroupName']);
            $safe_max_size = sanitize_int($_POST['editGroupSize']);
            $safe_category = sanitize_int($_POST['editGroupCategory']);
            $safe_description = sanitize_text($_POST['editGroupDescription']);
            if ($student_level_in_group === 2) {
                $safe_name = $group->get_name();
                $safe_max_size = $group->get_max_members();
                $safe_category = $group->get_category_id();
                $edit_message = $group->update_group($safe_name, $safe_max_size, $safe_category, $safe_description);
                $edited = TRUE;
            } elseif ($student_level_in_group === 3) {
                if ($gc->validate_if_category($safe_category) === FALSE) {
                    $safe_category = $group->get_category_id();
                }
                $edit_message = $group->update_group($safe_name, $safe_max_size, $safe_category, $safe_description);
                $edited = TRUE;
            }
        }
    }
开发者ID:DonBananos,项目名称:studyteam,代码行数:31,代码来源:details.php

示例15: search_for_student

 public function search_for_student($search_string)
 {
     $results = array();
     if ($this->validate_email($search_string)) {
         $results = $this->search_for_email(sanitize_email($search_string));
     } else {
         $username_results = $this->search_for_username(sanitize_text($search_string));
         $name_results = $this->search_for_name(sanitize_text($search_string));
         $email_results = $this->search_for_first_part_of_email($search_string);
         foreach ($username_results as $username_result) {
             $results[] = $username_result;
         }
         foreach ($name_results as $name_result) {
             if (!in_array($name_result, $results)) {
                 $results[] = $name_result;
             }
         }
         foreach ($email_results as $email_result) {
             if (!in_array($email_result, $results)) {
                 $results[] = $email_result;
             }
         }
     }
     return $results;
 }
开发者ID:DonBananos,项目名称:studyteam,代码行数:25,代码来源:student_controller.php


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