<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>memo.393 &#187; PHP</title>
	<atom:link href="http://memo.393.bz/cate/php/feed" rel="self" type="application/rss+xml" />
	<link>http://memo.393.bz</link>
	<description>個人的メモです。間違いなどありましたらご指摘ください。。。</description>
	<lastBuildDate>Sun, 27 Nov 2011 15:27:41 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[PHP]データの受け渡しについて(Hidden,Cookie,Session)</title>
		<link>http://memo.393.bz/archives/1240</link>
		<comments>http://memo.393.bz/archives/1240#comments</comments>
		<pubDate>Wed, 30 Jun 2010 07:26:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://memo.393.bz/?p=1240</guid>
		<description><![CDATA[なんとなくPHPを勉強中。 ページ遷移した際のデータの受け渡しの方法はざっと3種類。 ※今回の例としたシチュエーションはメールフォームのようなもの 1ページ目で、メールフォームにデータ入力して確認ボタンを押すと、 2ペー [...]]]></description>
			<content:encoded><![CDATA[<p>なんとなくPHPを勉強中。</p>
<p>ページ遷移した際のデータの受け渡しの方法はざっと3種類。</p>
<p>※今回の例としたシチュエーションはメールフォームのようなもの<br />
1ページ目で、メールフォームにデータ入力して確認ボタンを押すと、<br />
2ページ目には1ページ目で入力した内容が表示されている、って感じ。</p>
<p>◆データ受け渡し方法<br />
1)htmlのinput要素で渡す<br />
2)PHP（もしくはJavascript)でcookieに保持する<br />
3)PHPでｓｅｓｓｉｏｎに保持する</p>
<p>1)はブラウザ内での受け渡しとなるので容易に改ざんできる。<br />
2)はユーザーのHDDにデータが保持されるがデータを抜かれる可能性あり<br />
3)はサーバーのHDDにデータが保持される。sessionIDが盗まれなければデータは抜かれない。</p>
<p>セキュリティ的な効果は、<br />
1) < 2) < 3)<br />
※3)も絶対に安全かといえばそうでもない。</p>
<p>去年やった仕事でsessionIDを読み込んでうんちゃらかんちゃらってのがあったのだけど、意味がよくわかってなかった。<br />
ようは、サーバーのHDDにデータが残せるCookieみたいな仕組みってことなのね。<br />
Javaでもsession管理はできるみたいだから、サーバーサイドのプログラムなら使えるってことなのかな。</p>
]]></content:encoded>
			<wfw:commentRss>http://memo.393.bz/archives/1240/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP]PHPでBasic認証を突破する方法（IDとPASSWORDがわかっている状態で)</title>
		<link>http://memo.393.bz/archives/803</link>
		<comments>http://memo.393.bz/archives/803#comments</comments>
		<pubDate>Fri, 06 Nov 2009 09:49:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://memo.393.bz/?p=803</guid>
		<description><![CDATA[すぐ忘れるのでmemoする。 http://ユーザー名:パスワード@ドメイン名という感じ。 たとえば、http://www.hoge.comがBasic認証かかっていて、 ID：sakusan、PASSWORD：hoge [...]]]></description>
			<content:encoded><![CDATA[<p>すぐ忘れるのでmemoする。</p>
<p>http://ユーザー名:パスワード@ドメイン名という感じ。</p>
<p>たとえば、http://www.hoge.comがBasic認証かかっていて、<br />
ID：sakusan、PASSWORD：hogeo、というIDとPASSの場合は、</p>
<p>http://sakusan:hogeo@www.hoge.com</p>
<p>こんな感じでいいと思う。</p>
<p>参考：<a href="http://www.miuxmiu.com/archives/2009/09/14/php_basic_authentication_login_connections.html">PHPでBASIC認証のかかったページに接続（ログイン）する方法：MiuxMiu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://memo.393.bz/archives/803/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[AS][PHP]GMT(正確にはUTC)タイムを取得する方法</title>
		<link>http://memo.393.bz/archives/523</link>
		<comments>http://memo.393.bz/archives/523#comments</comments>
		<pubDate>Thu, 16 Apr 2009 19:31:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://memo.393.bz/?p=523</guid>
		<description><![CDATA[ローカルの時間（PCに設定されてる時計による）ではなく、正確な時間を取得したい場合。 ただFLASH単体では、UTC(GMTみたいなもの)の取得はできないようす。 なのでサーバーサイドのプログラムPHPを使ったら意外と簡 [...]]]></description>
			<content:encoded><![CDATA[<p>ローカルの時間（PCに設定されてる時計による）ではなく、正確な時間を取得したい場合。<br />
ただFLASH単体では、UTC(GMTみたいなもの)の取得はできないようす。<br />
なのでサーバーサイドのプログラムPHPを使ったら意外と簡単にできました。</p>
<p>↓PHPはこれだけ</p>
<pre name="code" class="php">

&lt;?php
//GMTを取得
$time09 = gmdate(&quot;D M d Y H:i:s&quot;, time()+9*60*60);
//ASでは、utc_timeというプロパティで扱える
echo &quot;utc_time=&quot;.$time09
?&gt;
</pre>
<p>FLASH側はこんな感じで、読み込みます。<br />
以下、フレームアクション</p>
<pre name="code" class="as">

//フレームアクション
//PHPファイルのURLを定義
var request:URLRequest = new URLRequest ( &quot;get_utc.php&quot; );
//送信方法をPOSTに
request.method = URLRequestMethod.POST;

//ローダーを作って、PHPを読み込み(実行)
var loader:URLLoader = new URLLoader (request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(request);

//PHP読み込み(実行)後の処理
function onComplete(event:Event):void {
	//↓PHPからの戻り値を変数に格納
	var vars:URLVariables = new URLVariables( event.target.data );
	//UTCデータを格納するための変数
	var utc:String;
	//データがちゃんとあった場合は、
	if (vars.utc_time!= undefined) {
		//変数に、文字列を渡す
		utc = vars.utc_time;
		next(utc);
		//ムービープレビューのときはローカルタイムを取得
	} else {
		var date:Date = new Date();
		utc = date.toString();
		next(utc);
		tf.text = &quot;↓ローカルタイムです&quot;;
	}
}
//PHPから読み込んだ文字列を引数にしてDateインスタンスを作成で完了
function next(utc) {
	var date:Date = new Date(utc);
	tf2.text = String(date);
}

//結果表示用のテキストフィールド（2つ用意）
var tf:TextField = new TextField();
tf.autoSize =&quot;left&quot;;
addChild(tf);
var tf2:TextField = new TextField();
tf2.autoSize =&quot;left&quot;;
addChild(tf2);
tf2.y = 30;
</pre>
<p>ポイントはPHPから取得した文字列をそのままDateクラスのコンストラクタの引数に突っ込めば、その情報を持ったDateインスタンスが作れるところですかね。<br />
(逆に言うと、PHPで取得する文字列は、Dateクラスで認識できる形にしてあげる必要があるってことかね）</p>
<p>ただこの場合の「UTCタイム」はサーバーの時計ってことになるのかな？<br />
ってことは、サーバーの時計が狂ったらアウトってことなんだろうね。</p>
]]></content:encoded>
			<wfw:commentRss>http://memo.393.bz/archives/523/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

