Toon posts:

[php] addslashes auto uitvoeren op meerder vars

Pagina: 1
Acties:

Verwijderd

Topicstarter
Is het mogelijk dat PHP automatisch een addslashes uitvoert op alle variabelen die gepost zijn dmv. van formvelden?!

  • Lord-M
  • Registratie: September 2000
  • Laatst online: 17-07 20:42
Zoek in je config naar 'magic_quotes_gpc' en verander de waarde erachter van 0 naar 1. Het kan geloof ik ook in een php script dmv: get_magic_quotes_gpc(1)

  • thomaske
  • Registratie: Juni 2000
  • Laatst online: 08-09 23:32

thomaske

» » » » » »

je zou de $_POST variabele kunnen aflopen, en daar addslashes op uitvoeren..

Brusselmans: "Continuïteit bestaat niet, tenzij in zinloze vorm. Iets wat continu is, is obsessief, dus ziekelijk, dus oninteressant, dus zinloos."


Verwijderd

Nou okee omdat het weekend is...
PHP:
1
<?function SlashIt(&amp;$value,$key){  $value = addslashes($value);  }array_walk($_POST, 'SlashIt');?>

  • GraasGast
  • Registratie: Oktober 2000
  • Laatst online: 03-09 17:11

GraasGast

Analogue Heaven

of, om het nog netter te doen:
PHP:
1
<?function _wrap_addslashes($string) {    return addslashes($string);}function array_addslashes($array) {    array_walk($array, "_wrap_addslashes");}array_addslashes($_POST);?>

Verwijderd

Op zaterdag 11 mei 2002 01:29 schreef GraasGast het volgende:
of, om het nog netter te doen:
PHP:
1
<?function _wrap_addslashes($string) {    return addslashes($string);}function array_addslashes($array) {    array_walk($array, "_wrap_addslashes");}array_addslashes($_POST);?>
Je moet een call by reference hebben ipv een call by value. Daarnaast zul je in je _wrap_addslashes het volgende moeten doen:
code:
1
$string = addslashes($string);

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

GraasGast:
of, om het nog netter te doen:
PHP:
1
<?/* Snip php-quote topix-layoutverneuking */?>
Nou vraag ik me af waarom een extra functie toevoegen het netter maakt?

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz

Pagina: 1