registratie hulp

Gestart doorFreestyle7 reacties6 weergaven

8 berichten · pagina 1 van 1

Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik ben bezig met een registreren pagina. En ik wil controleren of de gebruikersnaam of het ip al in gebruik is. als hij al in gebruik is komt er te staan:
Deze gebruikersnaam is al ingebruik
of
Dit IP heeft al een account!

ik heb de waardes in de database op uniek gezet.

alvast bedankt.
0
Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
en wat is je vraag?¿?
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rohimma schreef:
en wat is je vraag?¿?
hoe je moet controleren op gebruikersnaam en op IP yummie
0
Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$gebruikersnaam_check = mysql_query("SELECT id FROM users WHERE Gebruikersnaam=$gebruikersnaam LIMIT 1");
    
if ($gebruikersnaam_check > 0)
{ 
       $errorMsg = "<u>ERROR:</u><br />Uw gebruikersnaam is al in gebruik, probeer een ander.";
}


en dan moet je ergens op je site:

echo $errorMsg;

zetten, dit kan je ook voor ip doen
0
Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$gebruikersnaam_check = mysql_query("SELECT id FROM users WHERE Gebruikersnaam=$gebruikersnaam LIMIT 1");
    
if ($gebruikersnaam_check > 0)
{ 
       echo "<u>ERROR:</u><br />Uw gebruikersnaam is al in gebruik, probeer een ander.";
}


Waarom zo moelijk ^^? Zo is het tog veel makkelijker?
Is het zelfde ja maar gewoon gelijk laten weer geven vin ik handiger.
ene je kan ook gewoon echo $errorMsg; doen hoor xD
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT naam FROM users WHERE gebruiksnaam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gebruikersnaam is bezet.[/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]Gebruikersnaam is <b>niet</b> bezet.[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT naam FROM users WHERE gebruiksnaam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Gebruikersnaam is bezet.[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt allemaal.

Er mag een slotje op
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