Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 56 van 286

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Lennard schreef:
Probeer het uit. smile
Al gedaan. ik had allemaal errors maar ik denk dat dat komt omdat de sessie zo is:

$_SESSION[user][id]
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik snap er niets meer van, is er niet iets dat ik wel punten, uitroeptekens, vraagtekens kan toelaten en cijfers maar derest niet?
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jvdw schreef:
ik snap er niets meer van, is er niet iets dat ik wel punten, uitroeptekens, vraagtekens kan toelaten en cijfers maar derest niet?
Maak het zelf?
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Jvdw schreef:
ik snap er niets meer van, is er niet iets dat ik wel punten, uitroeptekens, vraagtekens kan toelaten en cijfers maar derest niet?
gebruik deze functie:
function xss($xss) {

return stripslashes(htmlentities($xss, ENT_QUOTES));
}

toevoeging op 28 juli 2012, 14:01:32:
werkt bij mij nu ook biggrin
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Eerdere citaten tonen
Jvdw schreef:
ik snap er niets meer van, is er niet iets dat ik wel punten, uitroeptekens, vraagtekens kan toelaten en cijfers maar derest niet?
gebruik deze functie:
function xss($xss) {

return stripslashes(htmlentities($xss, ENT_QUOTES));
}

toevoeging op 28 juli 2012, 14:01:32:
werkt bij mij nu ook biggrin
Dit heeft er niks mee te maken?
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gamedealer schreef:
Eerdere citaten tonen
Jvdw schreef:
ik snap er niets meer van, is er niet iets dat ik wel punten, uitroeptekens, vraagtekens kan toelaten en cijfers maar derest niet?
Maak het zelf?
idk hoe het moet, daarom vraag ik het hieremo
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jvdw schreef:
Eerdere citaten tonen
Gamedealer schreef:
Eerdere citaten tonen
Jvdw schreef:
ik snap er niets meer van, is er niet iets dat ik wel punten, uitroeptekens, vraagtekens kan toelaten en cijfers maar derest niet?
Maak het zelf?
idk hoe het moet, daarom vraag ik het hieremo
Maak een functie waarin je alle toegestane tekens in een array zet, dan kijk je of een teken in die array zit, en zoniet verwijder je hem?

Edit:
(Scriptje)
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] strip[COLOR= #007700]([/COLOR][COLOR= #0000BB]$var[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$alpha_tokens[/COLOR]    [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"."[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"?"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"!"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"0"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"1"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"2"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"3"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"4"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"5"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"6"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"7"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"8"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"9"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Toegestane tekens[/COLOR]
    [URL="http://www.php.net/for"]for[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<=[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$var[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++) {[/COLOR]
        [COLOR= #0000BB]$token[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$var[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$token[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$alpha_tokens[/COLOR][COLOR= #007700])) {[/COLOR]
            [COLOR= #0000BB]$characters[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #0000BB]$token[/COLOR][COLOR= #007700];
        }
    }[/COLOR]
    [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$characters[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$letter[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$woord[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #0000BB]$letter[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$woord[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #FF8000]//Voorbeeld:[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] strip[COLOR= #007700]([/COLOR][COLOR= #DD0000]Aphlas.2930123?!!u2938u4jlksDF[/COLOR][COLOR= #007700]);[/COLOR]
?>
Het werkt wel maar geen idee of dit is wat je bedoelde.
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@hierboven: een regex is sowieso beter. Kijk eens op regexr.
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
@hierboven: een regex is sowieso beter. Kijk eens op regexr.
Dan zou je dit moeten gebruiken?

preg_match (/^[0-9.!?]+$/, $var))
0
Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe krijg ik:
[COLOR= #0000BB]<?php
$usuario[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]habbotjes_staff[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Usuário do Twitter[/COLOR]
[COLOR= #0000BB]$feed[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]http://twitter.com/statuses/user_timeline/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$usuario[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].rss[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Apenas o URL do Feed[/COLOR]
[COLOR= #0000BB]$limite[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Limite te Tweets que aparecerão na tela[/COLOR]
?>
<html>
<head>
<title>Tweets de <?=$usuario;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
[COLOR= #0000BB]<?php
$conta[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR]simplexml_load_file[COLOR= #007700]([/COLOR][COLOR= #0000BB]$feed[/COLOR][COLOR= #007700])->[/COLOR]channel[COLOR= #007700]->[/COLOR]item [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$item[/COLOR] [COLOR= #007700]):[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$conta[/COLOR][COLOR= #007700]>=[/COLOR][COLOR= #0000BB]$limite[/COLOR][COLOR= #007700]){[/COLOR][URL="http://www.php.net/break"]break[/URL][COLOR= #007700];}[/COLOR] [COLOR= #0000BB]$conta[/COLOR][COLOR= #007700]++;[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$usuario[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$nome[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]:[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR]title[COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$nome[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$nome[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$link[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR][URL="http://www.php.net/link"]link[/URL][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR]pubDate[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$nome[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]: [/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR]description[COLOR= #007700]);[/COLOR]
?>
<div id="tweet<?=$conta;?>">
<a target="_blank" href="http://twitter.com/<?=$username;?>"><img src="http://api.twitter.com/1/users/profile_image/<?=$username;?>" border="0" style="float:left; padding:3px;" width="48" height="48" title="@<?=$username;?>" /></a><a title="@<?=$username;?>" target="_blank" href="http://twitter.com/<?=$username;?>"><b><?=$nome;?></b></a>: <?=$tweet;?>
<br>
<small><span><a href="<?=$link;?>" target="_blank" style="color:#444444; text-decoration:none;"><?=$data;?></a></span></small>
</div>
<div style="clear:both;"></div>
[COLOR= #0000BB]<?php[/COLOR]
endforeach[COLOR= #007700];[/COLOR]
?>
</body>
</html>


In een update query? Wil via cronjob dit weergeven, alleen het nu nu traag. En via cronjob/mysql sneller.
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat van dit wil je in een query krijgen?
0
Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
<div id="tweet<?=$conta;?>">
<a target="_blank" href="http://twitter.com/<?=$username;?>"><img src="http://api.twitter.com/1/users/profile_image/<?=$username;?>" border="0" style="float:left; padding:3px;" width="48" height="48" title="@<?=$username;?>" /></a><a title="@<?=$username;?>" target="_blank" href="http://twitter.com/<?=$username;?>"><b><?=$nome;?></b></a>: <?=$tweet;?>
<br>
<small><span><a href="<?=$link;?>" target="_blank" style="color:#444444; text-decoration:none;"><?=$data;?></a></span></small>
</div>
<div style="clear:both;"></div>


Dit.
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maak er een string van en zet hem in een query?
0
Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gamedealer schreef:
Maak er een string van en zet hem in een query?
Dan werken deze dingen niet meer:
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren