A PHP implement for Brainfuck Compiler
<?php /** Brainfuck Compiler on PHP
Copyright 2015 Everstray Jun Sinri Edogawa **/ $bc=new BrainfuckCompiler(); $bc->compile( '++++++++++[>+++++++>++++++++++>+++>+++.>+.+++++++..+++.>++..+++.------.--------.>+.>.' ); /** 字符 含义 > 指针加一 '; public static $PTR_LEFT ='0,0=>0,1=>0); private $codes=array(); private $code_index=0; public function compile($program_code){ $this->codes=str_split($program_code); $this->code_index=0; while($this->code_index<count>codes)){ $this->process_code(); } } private function process_code(){ if(BrainfuckCompiler::$DEBUG_MODE){ echo "[DEBUG] process_code at ".$this->code_index; } $code=$this->codes[$this->code_index]; if(BrainfuckCompiler::$DEBUG_MODE){ echo " as ".$code.PHP_EOL; } if($code===BrainfuckCompiler::$PTR_RIGHT){ $this->act_ptr_right(); $this->code_index+=1; } elseif($code===BrainfuckCompiler::$PTR_LEFT){ $this->act_ptr_left(); $this->code_index+=1; } elseif($code===BrainfuckCompiler::$VAL_PLUS){ $this->act_val_plus(); $this->code_index+=1; } elseif($code===BrainfuckCompiler::$VAL_MINUS){ $this->act_val_minus(); $this->code_index+=1; } elseif($code===BrainfuckCompiler::$PTR_OUTPUT){ $this->act_ptr_output(); $this->code_index+=1; } elseif($code===BrainfuckCompiler::$PTR_INPUT){ $this->act_ptr_input($this->codes[$this->code_index+1]); $this->code_index+=2; } elseif($code===BrainfuckCompiler::$WHILE_BEGIN){ $this->act_while_begin(); } elseif($code===BrainfuckCompiler::$WHILE_END){ $this->act_while_end(); } } private function act_ptr_right(){ $this->ptr+=1; if(!isset($this->memory[$this->ptr])){ $this->memory[$this->ptr]=0; } } private function act_ptr_left(){ $this->ptr-=1; if(!isset($this->memory[$this->ptr])){ $this->memory[$this->ptr]=0; } } private function act_val_plus(){ $this->memory[$this->ptr]=($this->memory[$this->ptr]+1)%256; } private function act_val_minus(){ $this->memory[$this->ptr]=($this->memory[$this->ptr]-1)%256; } private function act_ptr_output(){ echo chr($this->memory[$this->ptr]); } private function act_ptr_input($value){ $this->memory[$this->ptr]=($value%256); } private function act_while_begin(){ if($this->memory[$this->ptr]===0){ //find the pair WHILE_END $pair=1; $i=0; for($i=$this->code_index+1;$i<count>codes);$i++){ if($this->codes[$i]===BrainfuckCompiler::$WHILE_BEGIN){ $pair+=1; }elseif($this->codes[$i]===BrainfuckCompiler::$WHILE_END){ $pair-=1; } if($pair==0){ //here it is break; } } $this->code_index=$i; }else{ $this->code_index+=1; } } private function act_while_end(){ if($this->memory[$this->ptr]!==0){ //find the pair WHILE_BEGIN $pair=1; $i=0; for($i=$this->code_index-1;$i>=0;$i--){ if($this->codes[$i]===BrainfuckCompiler::$WHILE_END){ $pair+=1; }elseif($this->codes[$i]===BrainfuckCompiler::$WHILE_BEGIN){ $pair-=1; } if($pair==0){ //here it is break; } } $this->code_index=$i+1; }else{ $this->code_index+=1; } } } ?></count></count>
著作権表示: この記事はブロガーによるオリジナル記事であり、ブロガーの許可なく複製することはできません。
上記では、PHP の Brainfuck Compiler を関連コンテンツも含めて紹介しています。PHP チュートリアルに興味のある友人に役立つことを願っています。

phpidentifiesauser'ssessionsingsinssessionCookiesIds.1)whensession_start()iscalled、phpgeneratesauniquesidstoredsored incoookienadphpsessidontheuser'sbrowser.2)thisidallowsphptortorieSessiondatadata fromthata

PHPセッションのセキュリティは、次の測定を通じて達成できます。1。session_regenerate_id()を使用して、ユーザーがログインまたは重要な操作である場合にセッションIDを再生します。 2. HTTPSプロトコルを介して送信セッションIDを暗号化します。 3。Session_Save_Path()を使用して、セッションデータを保存し、権限を正しく設定するためのSecure Directoryを指定します。

phpsessionFilesToredInthededirectoryspecifiedBysession.save_path、通常/tmponunix-likesystemsorc:\ windows \ temponwindows.tocustomizethis:1)uesession_save_path()tosetaCustomdirectory、ensuringit'swritadistradistradistradistradistra

toretrievedatafrompsession、Startthessession withsession_start()andAccessvariablesshe $ _SessionArray.forexample:1)Startthessession:session_start()

セッションを使用して効率的なショッピングカートシステムを構築する手順には、次のものがあります。1)セッションの定義と機能を理解します。セッションは、リクエスト全体でユーザーのステータスを維持するために使用されるサーバー側のストレージメカニズムです。 2)ショッピングカートに製品を追加するなど、基本的なセッション管理を実装します。 3)製品の量管理と削除をサポートし、高度な使用状況に拡大します。 4)セッションデータを持続し、安全なセッション識別子を使用することにより、パフォーマンスとセキュリティを最適化します。

この記事では、PHPでインターフェイスを作成、実装、および使用する方法について説明し、コード組織と保守性の利点に焦点を当てています。

この記事では、PHPのCrypt()とpassword_hash()の違いについて、パスワードハッシュの違いについて説明し、最新のWebアプリケーションの実装、セキュリティ、および適合性に焦点を当てています。

記事では、入力検証、出力エンコード、およびOWASP ESAPIやHTML浄化器などのツールを使用して、PHPのクロスサイトスクリプト(XSS)を防止します。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

DVWA
Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

SublimeText3 中国語版
中国語版、とても使いやすい

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

ホットトピック









