從例如在http://acko.net/dev/farbtastic:
<form action="yourFile.php" method="post">
<div style="margin-bottom: 1em;" id="picker">
<div class="farbtastic">
<div class="color" style="background-color: rgb(0, 127, 255);"></div>
<div class="wheel"></div>
<div class="overlay"></div>
<div class="h-marker marker" style="left: 55px; top: 170px;"></div>
<div class="sl-marker marker" style="left: 82px; top: 127px;"></div>
</div>
</div>
<div class="form-item">
<label for="color">Color:</label>
<input type="text" style="width: 195px; background-color: rgb(18, 52, 86); color: rgb(255, 255, 255);" value="#123456" name="color" id="color">
</div>
</form>
和你的PHP:
if (!empty($_POST['color']) && preg_match('/^#[a-fA-f0-9]{6}/', $_POST['color']) != 0) {
$thisarray[] = $_POST['color'];
SetProfileField('usercss', $USER->id, implode(',',$thisarray));
}
-1:非過濾用戶輸入 – hobodave 2010-02-22 20:16:19
你正確..編輯我的答案 – harpax 2010-02-22 20:31:48