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


PHP Sanitize::clearWhiteSpaceLR方法代码示例

本文整理汇总了PHP中Sanitize::clearWhiteSpaceLR方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::clearWhiteSpaceLR方法的具体用法?PHP Sanitize::clearWhiteSpaceLR怎么用?PHP Sanitize::clearWhiteSpaceLR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitize的用法示例。


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

示例1: cleanAndPost

 protected function cleanAndPost()
 {
     for ($n = 0; $n < count($this->message_information); $n++) {
         //clean left and white white space, escape the string for the Database
         $this->message_information[$n] = Sanitize::prepForDatabase(Sanitize::clearWhiteSpaceLR($this->message_information[$n]));
     }
     $d = new Database();
     $d->open('hacker_blog');
     //check for duplicates
     $chx = $d->q("SELECT * FROM user_messages WHERE user_messages.message = '{$this->message_information[2]}'");
     if ($chx && $d->numrows() <= 0) {
         // id in the messages field is for the user's uid or user_id, depending on how you are moving forward with your code
         $s = $d->q("INSERT into user_messages\n\t\t\t\t \t\t(user_message_id,first_name,last_name,id,message,type,added_on) VALUES\n\t\t\t\t\t\t(NULL,'{$this->message_information[0]}','{$this->message_information[1]}',NULL,'{$this->message_information[2]}','{$this->type}',now())");
         if ($s) {
             //echo 'made it through gauntlet. Added info into Database.';
             $this->passed = true;
         } else {
             $this->passed = false;
         }
     } else {
         //echo 'You have already made a comment like this.';
         $this->passed = false;
     }
     $d->close();
     //print_r($this->message_information);
 }
开发者ID:newfront,项目名称:dojophp,代码行数:26,代码来源:clsUserBlogCommentMessage.php

示例2: strtolower

<?php

require_once '../blog/includes/session.php';
require_once '../blog/classes/clsDatabase.php';
require_once '../blog/classes/clsSanitize.php';
if ($_POST['login']) {
    //print_r($_POST);
    // sanitize
    $login = Sanitize::clearWhiteSpaceLR($_POST['login']);
    //$password = Sanitize::clearWhiteSpaceLR($_POST['password']);
    $password = strtolower(Sanitize::clearWhiteSpaceLR($_POST['password']));
    //echo $login.' '.$password;
    // test if in Database as well
    $d = new Database();
    $d->open('hacker_blog');
    $s = $d->q("SELECT * FROM user WHERE user.username = '{$login}' AND user.password = sha1('{$password}') LIMIT 0,1");
    if ($s && $d->numrows() > 0) {
        //mysql fetch assoc
        $info = $d->mfa();
        //print_r($info);
        //$info = associative array
        $_SESSION['loggedin'] = true;
        // concat first and last name
        $name = $info['user_first_name'] . ' ' . $info['user_last_name'];
        //echo "NAME: $name";
        $_SESSION['loggedin'] = true;
        $_SESSION['user_full_name'] = $name;
        $_SESSION['user_quick_name'] = $info['user_first_name'];
        $_SESSION['user_id'] = $info['id'];
        //echo '<a href="/week_eight/secret_loggedin_area.php">Manual Override</a>';
        header("Location: /week_eight/secret_loggedin_area.php");
开发者ID:newfront,项目名称:dojophp,代码行数:31,代码来源:check_username_login.php

示例3: Navigation

<?php

//main application methods
require_once 'classes/clsNavigation.php';
require_once 'classes/clsSanitize.php';
//require_once 'helpers/application_helper.php';//used for some neat tricks and what not (db side of things!)
$nav = new Navigation();
$simple_navigation = "<ul><li><a href=\"javascript:void(0);\">Action</a></li></ul>";
//$new = $nav->createNavigation("Box Office", "/blog/box_office", 1,2);
//use php to have gui access to your database
$bad_string = "            chicken little            ";
// good string
$good = Sanitize::clearWhiteSpaceLR($bad_string);
if (Sanitize::checkSize($good)) {
    echo 'Our Word has passed the length test';
}
if (Sanitize::isEmailFormat('scott@newfrontcreative.com')) {
    echo 'Your Email is valid';
}
开发者ID:newfront,项目名称:dojophp,代码行数:19,代码来源:application_controller.php


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