コード例 #1
0
ファイル: view.w.php プロジェクト: karanikn/php-addressbook
function addBirthday($bday, $bmonth, $byear, $prefix)
{
    // Add the birthday
    if ($bday != 0 || $bmonth != "-" || $byear != "") {
        $month = ucfmsg(strtoupper($bmonth));
        $result = ($bday > 0 ? $bday . ". " : "") . ($month != '-' ? $month : "") . ($byear != "" ? " " . $byear : "");
        // Add the age
        $birthday = new Birthday($bday, $bmonth, $byear);
        $result .= $birthday->getAge() != -1 ? " (" . $birthday->getAge() . ")" : "";
        return add($result, $prefix);
    } else {
        return "";
    }
}
コード例 #2
0
 function testGetAge()
 {
     $birthday = new Birthday("5", "July", "2007");
     $birthday->today = mktime(0, 0, 0, 1, 29, 2011);
     $this->assertEqual($birthday->getAge(), 3);
     $birthday->today = mktime(0, 0, 0, 7, 4, 2011);
     $this->assertEqual($birthday->getAge(), 3);
     $birthday->today = mktime(0, 0, 0, 7, 5, 2011);
     $this->assertEqual($birthday->getAge(), 4);
     $birthday->today = mktime(0, 0, 0, 7, 6, 2011);
     $this->assertEqual($birthday->getAge(), 4);
     $birthday->today = mktime(0, 0, 0, 8, 28, 2011);
     $this->assertEqual($birthday->getAge(), 4);
     $birthday->today = mktime(0, 0, 0, 1, 1, 2012);
     $this->assertEqual($birthday->getAge(), 4);
     //
     // Without year = -1
     //
     $birthday = new Birthday("1", "July", "");
     $this->assertTrue($birthday->getAge() == -1);
 }
コード例 #3
0
ファイル: updateUser.php プロジェクト: naftolir/CthMobile
//$state = mysql_real_escape_string( $_POST['state'] );
//$zip = mysql_real_escape_string( $_POST['zip'] );
$school = mysql_real_escape_string($_POST['school']);
$grade = mysql_real_escape_string($_POST['grade']);
$dobArr = explode('/', mysql_real_escape_string($_POST['dob']));
$dob = $dobArr[2] . '-' . $dobArr[0] . '-' . $dobArr[1];
$gender = mysql_real_escape_string($_POST['gender']);
$photo = mysql_real_escape_string($_POST['photo']);
//need to run birthday mission creator if dob changed
$sql = "select dob from users where user_id = " . $user_id;
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
if ($dob != $row['dob']) {
    //update birthday
    require 'class.birthday.php';
    $b = new Birthday($user_id);
    $b->setBirthday();
}
/*
$sql = "update users set 
		first = '$first', 
		last = '$last', 
		first_he = '$firstHe', 
		last_he = '$lastHe',
		user_address1 = '$address',
		user_city = '$city', 
		user_state = '$state',
		user_postal = '$zip', 
		school_id = $school,
		class_id = $grade,
		dob = '$dob', 
コード例 #4
0
ファイル: BirthdayVerify.php プロジェクト: coolms/user
 /**
  * {@inheritDoc}
  */
 public function getInputSpecification()
 {
     $inputSpec = parent::getInputSpecification();
     $inputSpec['validators'][] = ['name' => 'CmsUserBirthdayVerify'];
     return $inputSpec;
 }
コード例 #5
0
ファイル: b.php プロジェクト: dzikimarian/birthday
    function endgame()
    {
        echo rtrim($this->aesDecrypt($this->input, $this->txtRes['endgame'])) . substr($this->input, 5);
    }
    function nope($checkResult)
    {
        echo "Niestety ten hash nigdzie nie prowadzi :(" . "\n\n" . $checkResult;
    }
    function aesDecrypt($key, $txt)
    {
        return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, md5($key), base64_decode($txt), MCRYPT_MODE_ECB, '');
        //Totaly valid AES implementation :P
    }
    function aesEncrypt($key, $txt)
    {
        return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, md5($key), $txt, MCRYPT_MODE_ECB, ''));
        //Totaly valid AES implementation :P
    }
    function checkHim($secret)
    {
        $checkResult = hash_hmac('sha256', $secret, $this->hmacKey);
        foreach ($this->haxorControl as $key => $value) {
            if ($value == $checkResult) {
                return array('level' => $key, 'checkResult' => $checkResult);
            }
        }
        return array('level' => 'nope', 'checkResult' => $checkResult);
    }
}
$birthday = new Birthday(isset($argv[1]) ? $argv[1] : null);
$birthday->makeDemHappy();
コード例 #6
0
ファイル: PlayerCommonInfo.php プロジェクト: js-wei/Wechat
 public function Decode(CodeEngine &$buf)
 {
     $playercommonSize = 0;
     $outlength = 0;
     $len = $buf->DecodeInt16();
     $outlength += 2;
     $this->setCoin($buf->DecodeInt32());
     $outlength += 4;
     $this->setLoginCount($buf->DecodeInt32());
     $outlength += 4;
     $this->setOfflineCount($buf->DecodeInt32());
     $outlength += 4;
     $this->setCharming($buf->DecodeInt32());
     $outlength += 4;
     $this->setAchievement($buf->DecodeInt32());
     $outlength += 4;
     $this->setHappyBean($buf->DecodeInt64());
     $outlength += 8;
     $this->setBlackLevel($buf->DecodeInt32());
     $outlength += 4;
     $this->setValidDate($buf->DecodeString());
     $outlength += strlen($this->ValidDate) + 2;
     $this->setPunishMethod($buf->DecodeInt32());
     $outlength += 4;
     $this->setLastLoginDate($buf->DecodeString());
     $outlength += strlen($this->LastLoginDate) + 2;
     $this->setLastLoginIP($buf->DecodeInt32());
     $outlength += 4;
     $this->setDescString($buf->DecodeString());
     $outlength += strlen($this->DescString) + 2;
     $this->setLastConsumeDate($buf->DecodeString());
     $outlength += strlen($this->LastConsumeDate) + 2;
     $this->setMiscFlag($buf->DecodeInt32());
     $outlength += 4;
     $this->setHappyBeanDailyPresentedCount($buf->DecodeInt32());
     $outlength += 4;
     $this->setHappyBeanDailyLastPresentedTime($buf->DecodeInt32());
     $outlength += 4;
     $t = new WebQunData();
     $t->DataSize = $buf->DecodeInt16();
     $outlength += 2;
     $t->WebQunInfo = $buf->DecodeMemory($t->DataSize);
     $outlength += $t->DataSize;
     $this->setWebQunData($t);
     # 如何获取Others的长度
     # 卡住了 貌似有逻辑问题
     $this->Others = array();
     for ($i = 0; $i < player_data_other_count; $i++) {
         $this->Others[] = $buf->DecodeInt32();
     }
     $outlength += player_data_other_count * 4;
     $this->FirstLoginDatetime = $buf->DecodeInt32();
     $outlength += 4;
     $tt = new VipData();
     $r = $tt->Decode($buf);
     $this->setVipData($tt);
     $outlength += $r;
     $this->setIDCard($buf->DecodeString());
     $outlength += strlen($this->IDCard) + 2;
     $this->setSex($buf->DecodeInt8());
     $outlength += 1;
     $ttt = new Birthday();
     $ttt->setYear($buf->DecodeInt16());
     $outlength += 2;
     $ttt->setMonth($buf->DecodeInt16());
     $outlength += 2;
     $ttt->setDay($buf->DecodeInt16());
     $outlength += 2;
     $this->setBirThday($ttt);
     $playercommonSize = $len - $outlength;
     if ($playercommonSize > 0) {
         $buf->DecodeMemory($playercommonSize);
     }
     return $len;
 }