Mikebs vragentopic

Gestart doorMikeb19 reacties113 weergaven

20 berichten · pagina 2 van 2

Mikeb

Lid · Topicstarter

Berichten
6.356
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Die dat het alleen uit getallen mag bestaan werkt niet.
Ik heb wel die { en } toegevoegd smile
[COLOR= #0000BB]<?
    $vergoeding[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]])*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #0000BB]0.10[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De Vergoeding moet minstens &euro; 0.10 zijn!"[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/is_int"]is_int[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$string_naam[/COLOR][COLOR= #007700])){[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO doeadvertenties (adv, link, banner, vergoeding, adverteerder, termijn, opdracht, actief) VALUES ( $_POST[adv], $_POST[link], $_POST[banner], "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$vergoeding[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", $user, $_POST[termijn], $_POST[opdracht], 0)"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Succesvol toegevoegd!"[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"De vergoeding mag enkel uit getallen bestaan!"[/COLOR][COLOR= #007700];
}
}
}[/COLOR]
    ?>
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je moet wel inputs nog beveiligen anders kan iedereen je database verwijderen.

[COLOR= #0000BB]<?php

$vergoeding[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]])*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #0000BB]0.10[/COLOR][COLOR= #007700]){[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De Vergoeding moet minstens &euro; 0.10 zijn!"[/COLOR][COLOR= #007700];
        
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/is_numeric"]is_numeric[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$vergoeding[/COLOR][COLOR= #007700])){[/COLOR]
            
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO doeadvertenties (adv, link, banner, vergoeding, adverteerder, termijn, opdracht, actief) VALUES ( $_POST[adv], $_POST[link], $_POST[banner], "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$vergoeding[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", $user, $_POST[termijn], $_POST[opdracht], 0)"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Succesvol toegevoegd!"[/COLOR][COLOR= #007700];
        
        }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"De vergoeding mag enkel uit getallen bestaan!"[/COLOR][COLOR= #007700];
            
        }
        
    }
    
}[/COLOR]
?>
0
Mikeb

Lid · Topicstarter

Berichten
6.356
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik kan nu nog steeds Letters en cijfers invullen.
Als ik bijv.

0.10g intyp doet hij dat gewoon. confused
Tevens ook nog een andere vraag;

if(!$_GET[new] AND !$_GET[send] AND !$_GET[id] AND !$_GET[deleteall] AND !$_GET[delete] AND !$_GET[reply]){ 
    $select = "SELECT *, date_format(datum,%d-%m-%Y) AS datum FROM priveberichten WHERE naar = $naam ORDER BY id DESC"; 
    $query = mysql_query($select); 
    $aantal = mysql_num_fields($query); 

    echo "<h2>Inbox <B>($aantal)</B></h2>"; 
    echo "Dit is uw inbox, hier ontvangt u mails van ons en andere leden. U kunt ook mails versturen naar andere leden!";


Hij doet bij $aantal mysql_num_fields niet en mysql_num_rows werkt ook niet. Maar hij moet het aantal berichten weergeven in de Inbox.
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat van cijfers is makkelijk..

[COLOR= #0000BB]<?php

$vergoeding[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]])*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #0000BB]0.10[/COLOR][COLOR= #007700]){[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De Vergoeding moet minstens &euro; 0.10 zijn!"[/COLOR][COLOR= #007700];
        
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]/^[0-9.,]+$/[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
            
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO doeadvertenties (adv, link, banner, vergoeding, adverteerder, termijn, opdracht, actief) VALUES ( $_POST[adv], $_POST[link], $_POST[banner], "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$vergoeding[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", $user, $_POST[termijn], $_POST[opdracht], 0)"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Succesvol toegevoegd!"[/COLOR][COLOR= #007700];
        
        }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"De vergoeding mag enkel uit getallen bestaan!"[/COLOR][COLOR= #007700];
            
        }
        
    }
    
}[/COLOR]
?>


aangezien jij waarschijnlijk met punten en kommas werkt, en waarschijnlijk ook met Punten op de website..
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kevmaus schreef:
Dat van cijfers is makkelijk..

[COLOR= #0000BB]<?php

$vergoeding[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]])*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #0000BB]0.10[/COLOR][COLOR= #007700]){[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De Vergoeding moet minstens &euro; 0.10 zijn!"[/COLOR][COLOR= #007700];
        
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]/^[0-9.,]+$/[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]vergoeding[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
            
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO doeadvertenties (adv, link, banner, vergoeding, adverteerder, termijn, opdracht, actief) VALUES ( $_POST[adv], $_POST[link], $_POST[banner], "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$vergoeding[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]", $user, $_POST[termijn], $_POST[opdracht], 0)"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/print"]print[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Succesvol toegevoegd!"[/COLOR][COLOR= #007700];
        
        }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"De vergoeding mag enkel uit getallen bestaan!"[/COLOR][COLOR= #007700];
            
        }
        
    }
    
}[/COLOR]
?>
aangezien jij waarschijnlijk met punten en kommas werkt, en waarschijnlijk ook met Punten op de website..

Het is inderdaad makkelijk, maar niet zoals jij het doet!
is_numeric of ctyp_digit zijn wel iets makkelijker...
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