memo.xight.org

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

2005-12-22 Thu

サニタイズの基本

- SQLインジェクション

MySQL PHP $sql = mysql_escape_string($sql);
MySQL Perl $sql =~ s/'/''/g; $sql =~ s/\\/\\\\/g;
PostgreSQL PHP $sql = pgsql_escape_string($sql);
PostgreSQL Perl $sql =~ s/'/''/g; $sql =~ s/\\/\\\\/g;
SQLite PHP $sql = sqlite_escape_string($sql);

- OSインジェクション
Linux PHP $str = escapeshellarg($str);
Linux Perl $str =~ s/'/\\'/g;

- XSS
PHP $str = htmlspecialchars($str);
Perl $str =~ s/</</g;

- Reference
入門 Ajax: 本 - pp.16

カテゴリ: [PHP][Perl]

JavaScriptの予約語

- List
abstract
boolean
break
byte
case
catch
char
class
comment
const
continue
debugger
default
delete
do
double
else
enum
export
extends
false
final
finally
float
for
function
goto
if
implements
import
in
instanceof
int
interface
label
long
native
new
null
package
private
protected
public
return
short
static
super
switch
synchronized
this
throw
throws
transient
true
try
typeof
var
void
volatile
while
with

- 備考
JavaScript1.3の初期バージョンから,comment, debugger, enum, export, label が追加
ECMA-262でvolatileが追加され,commentは削除されたため,それ以後のJavaScript1.3はこれに準拠し変更されている.
false, null, true はECMA-262では予約語とされていないが,NetscapeもMicrosoftも予約語としている.

startという名前の関数をイベントから使用するとIE系でエラーが出る.
colorという名前の関数を使用するとエラーが出る.
start, color とも予約語ではないが,使用は避けた方が良い.

- Reference
SMART! ウェブ講座 - JavaScript - 予約語
http://www.rfs.jp/sb/javascript/01/04.html
JavaScript laboratory - 予約語一覧
http://www004.upp.so-net.ne.jp/sekiuchi/js/help/keywords.html

カテゴリ: [JavaScript]

JavaScript で Cookie を簡単に扱うには

- Summary
JavaScriptでCookieを扱う[2005-12-19-5] でCookieの扱いづらさを体験.
そこで cookieクラスを用いる.
どうせなら,Cookieをparseして連想配列で返しても良い気がする.
- Reference
ウェブ木箱:cookie操作
http://www5c.biglobe.ne.jp/~horoau/js_library/cookie.html
クッキーの読み書き
http://www9.plala.or.jp/oyoyon/html/script/cookie.html

カテゴリ: [JavaScript]
2005-12 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Color Reference

ChangeLogを検索
携帯電話からアクセス!

カテゴリ

最近の話題

リンク

過去ログ

Google

QR Code

Since
2002-11-28
Update
2008-09-05 14:14
Copyright © 2005 xight.org All Rights Reserved.