Tag Archive for input

Input redirect

<input name="acabados" type="button" value="acabados" onclick="window.location.href='editar_acabados.php?id_producto=<?php echo $row_productos['id_productos']; ?><?php if(isset($_GET['pageNum_productos'])){echo "&pageNum_productos={$_GET['pageNum_productos']}";} ?>';"  />

source

General get value from possible input sources

/* Get a variable from the possible input sources. */
function getVar($var_name) {
if (!empty($_GET[ $var_name ])) {
return $_GET[ $var_name ];
} elseif (!empty($_POST[ $var_name ])) {
return $_POST[$var_name ];
} elseif (!empty($_SESSION[ $var_name ])) {
return $_SESSION[ $var_name ];
} elseif (!empty($_COOKIE[ $var_name ])) {
return $_COOKIE[ $var_name ];
} else {
return null;
}
}

source

Secure Undo magic_quotes

<?php
if (get_magic_quotes_gpc()) {
$in = array(&$_GET, &$_POST, &$_COOKIE);
while (list($k,$v) = each($in)) {
foreach ($v as $key => $val) {
if (!is_array($val)) {
$in[$k][$key] = stripslashes($val);
continue;
}
$in[] =& $in[$k][$key];
}
}
unset($in);
}
?>

source

Class

data class;
input Id SubId Name $ Sex $ Age Height Weight var1 var2;
cards;
1 1 Alfred M 14 69 112.5 6 2006
2 5 Alice F 13 56.5 84 9 2007
3 1 Barbara F 13 65.3 98 8 2006
4 3 Carol F 14 62.8 102.5 8 2006
5 2 Henry M 14 63.5 102.5 10 2006
6 4 James M 12 57.3 83 5 2007
7 1 Jane F 12 59.8 84.5 3 2007
8 5 Janet F 15 62.5 112.5 6 2006
9 3 Jeffrey M 13 62.5 84 11 2006
10 2 John M 12 59 99.5 1 2007
11 2 Joyce F 11 51.3 50.5 10 2007
12 5 Judy F 14 64.3 90 7 2006
13 4 Louise F 12 56.3 77 9 2006
14 4 Mary F 15 66.5 112 8 2007
15 1 Philip M 16 72 150 8 2007
16 3 Robert M 12 64.8 128 3 2006
17 2 Ronald M 15 67 133 5 2007
18 4 Thomas M 11 57.5 85 5 2007
19 2 William M 15 66.5 112 12 2006
20 5 Woolfred M 22 76.2 139 9 2007
;
run;

source

Highlight active form fields

textarea:focus, input:focus {
border: 1px solid #900;
background-color: #FFFF9D;
}

source

FireFox wmode input fix

//util.FirefoxWmodeFix.fix(field);

class util.FirefoxWmodeFix {

// [lettre écrite sous FF, bonne lettre, condition]
public static var  FRENCH_KEYBOARD:Array = [
["&", "1", Key.SHIFT],
["é", "2", Key.SHIFT],
[""", "3", Key.SHIFT],
["'", "4", Key.SHIFT],
["(", "5", Key.SHIFT],
["-", "6", Key.SHIFT],
["è", "7", Key.SHIFT],
["_", "8", Key.SHIFT],
["ç", "9", Key.SHIFT],
["à", "0", Key.SHIFT],

["<", "?", Key.SHIFT],
[":", ".", Key.SHIFT],
["!", "§", Key.SHIFT],
["ù", "%", Key.SHIFT],
["$", "£", Key.SHIFT],
["<", ">", Key.SHIFT],

[""", "#", Key.ALT],
["'", "{", Key.ALT],
["(", "[", Key.ALT],
["-", "|", Key.ALT],
["è", "", Key.ALT],
["_", "", Key.ALT],
["ç", "^", Key.ALT],
["à", "@", Key.ALT]
]

public static var USED_KEYBOARD:Array

public static function fix(_field:TextField)
{
if(!USED_KEYBOARD) USED_KEYBOARD = FRENCH_KEYBOARD
_field.addListener(FirefoxWmodeFix)
_field.textLength = _field.text.length
}

private static function onChanged(_field):Boolean
{
// si on supprime une lettre, on ignore
if (_field.textLength > _field.text.length) {
_field.textLength = _field.text.length
return false
}else {
_field.textLength = _field.text.length
}

var index = Selection.getBeginIndex()
var newLetter = _field.text.substr(index - 1, 1)

for (var i:Number = 0; i <USED_KEYBOARD.length ; i++) {
if (USED_KEYBOARD[i][0] == newLetter) {
if (Key.isDown(USED_KEYBOARD[i][2])) {
_field.text = _field.text.substr(0, index - 1) + USED_KEYBOARD[i][1] + _field.text.substr(index)
return true
}
/* ---===CAPSLOCK ne marche tout simplement pas sur firefox ===---
*
if (USED_KEYBOARD[i][2] == Key.CAPSLOCK && Key.isToggled(Key.CAPSLOCK) ) {
_field.text = _field.text.substr(0, index - 1) + USED_KEYBOARD[i][1] + _field.text.substr(index)
return true
}
*/
}
}

}

}

source

Smart Quoting

function quote_smart( $value )
{
// Stripslashes
if( get_magic_quotes_gpc() )
{
$value = stripslashes( $value );
}

// Quote if not integer
if( ! is_numeric( $value ) )
{
// mysql_real_escape_string requires PHP 4.3.0 and higher!
$value = "'" . mysql_real_escape_string( $value ) . "'";
}

return $value;
}

source

Get Input Controls Name And Value In HTML Page

public static string GetInputControlsNameAndValueInPage(string strPage)
{
string strRegExPatten = "<s*input.*?names*=s*"(?<Name>.*?)".*?values*=s*"(?<Value>.*?)".*?>";
Regex reg = new Regex(strRegExPatten, RegexOptions.Multiline);
MatchCollection mc = reg.Matches(strPage);
string strTemp = string.Empty;
foreach (Match m in mc)
{
strTemp = strTemp + m.Groups["Name"].Value + "=" + m.Groups["Value"].Value + "&";
}
int n = strTemp.Length;
strTemp = strTemp.Remove(n - 1);
return strTemp;
}

source

clean user input data ( GET, POST, COOKIE )

<?php

function clean($value)
{
if (get_magic_quotes_gpc())	$value = stripslashes($value);

if (!is_numeric($value))	$value = mysql_real_escape_string($value);

return $value;
}

array_walk($_GET,'clean');
array_walk($_POST,'clean');
array_walk($_COOKIE,'clean');

extract($_GET,EXTR_PREFIX_ALL,'get');
extract($_POST,EXTR_PREFIX_ALL,'post');
extract($_COOKIE,EXTR_PREFIX_ALL,'cookie');

?>

source

form

.hazte-socio.alta-form fieldset { border: 0; margin: 0 0 20px 0; padding: 0 }
.hazte-socio.alta-form legend { margin: 0 0 12px 0; * margin-left: -5px; padding: 0 }

.hazte-socio.alta-form legend span {
display: block;
width: 720px;
border-bottom: 1px solid #ecf0f5;
padding-bottom: 1px;
color: #064598;
font-size: 1.4em;
font-weight: bold;
}

/* Etiquetas */
.hazte-socio.alta-form label {
display: block;
position: relative;
width: 170px;
height: 26px;
position: relative;
color: #333;
font-size: 1.2em;
text-align: right;
}

/* Campos */
.hazte-socio.alta-form label input,
.hazte-socio.alta-form label select {
position: absolute;
top: -2px;
left: 181px;
font-weight: bold;
}

source