Probleem met live checken

Gestart doorMilan6 reacties22 weergaven

7 berichten · pagina 1 van 1

Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Om bij het registratieformulier te checken of de naam al voorkomt in de database heb ik deze 3 bestandjes:

Registreren.php:

[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #FF8000]/**
 * @author Milan
 * @package registreren.php
 * @copyright 2009
 */[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]
?>
<script type="text/javascript" src="check.js"></script>
[COLOR= #0000BB]<?php[/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]
    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR]    [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR]   [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR]   [URL="http://www.php.net/ucfirst"]ucfirst[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR]       [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]paas[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR]       [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR]       [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR]            [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR]            [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]info[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"nee"[/COLOR][COLOR= #007700];
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        [COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"ja"[/COLOR][COLOR= #007700];
    }[/COLOR]
    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Je moet een gebruikersnaam invullen."[/COLOR][COLOR= #007700];
    }[/COLOR]    
    [COLOR= #0000BB]$result1[/COLOR][COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM leden WHERE naam = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result1[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][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]$result[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Een gebruiker met deze naam bestaat al."[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Je moet een wachtwoord invullen."[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"De gebruikersnaam mag niet hetzelfde zijn als je wachtwoord."[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Je moet een email adres invullen."[/COLOR][COLOR= #007700];
    }[/COLOR]
    [COLOR= #0000BB]$result1[/COLOR][COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM leden WHERE email = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result1[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    
          [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/eregi"]eregi[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])) {[/COLOR]
      [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Voer een geldige email adres in."[/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]$result[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Er is al een gebruiker met deze e-mail."[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$result1[/COLOR][COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM table WHERE ip = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result1[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][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]$result[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]"Er is al een gebruiker met dit ip, er kan maximaal 1 account per ip worden aangemaakt."[/COLOR][COLOR= #007700];
      }
          }[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #DD0000]0[/COLOR] [COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De volgende fouten zijn opgetreden.<br />"[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]AS[/COLOR] [COLOR= #0000BB]$error[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"<br />"[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>
        <a href="registreren"><button>Ga terug</button></a>
        [COLOR= #0000BB]<?php[/COLOR]

    [COLOR= #007700]}[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]    
     [COLOR= #0000BB]$code[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1111111111[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]9999999999[/COLOR][COLOR= #007700]);[/COLOR]
     [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO pb (afzender,bericht,voor,onderwerp,tijd) VALUES (site,Hallo "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]",<br /><br />Welkom op site.nl!<br /><br />Met vriendelijke groeten,<br />site.nl,"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]",Welkom op site.nl,now())"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO table (naam, wachtwoord, email, geactiveerd, ip, status, aangemeldop, activatiecode, verbannen, bericht, geld, soldaten, dorpslevel, beginnersbescherming, aangevallen, info) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", nee, "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]", lid, NOW() ,"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$code[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", nee, nee, 1000, 0, 0, ja, nee, "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$info[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]")"[/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]"U heeft zich aangemeld! U krijgt een e-mail van ons om uw account te activeren.<br /><b>Let op! De e-mail kan aankomen als spam/ongewenst.</b>"[/COLOR][COLOR= #007700];[/COLOR]
            
            [COLOR= #0000BB]$to[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
            [COLOR= #0000BB]$subject[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Activatie account[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"MIME-Version: 1.0"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"Content-type: text/html; charset=iso-8859-1"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"From: site.nl <info@site.nl>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"X-Mailer: PHP v"[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/phpversion"]phpversion[/URL][COLOR= #007700]().[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] registratiemailboven[COLOR= #007700]();[/COLOR]
            [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]Hallo [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000],<br /><br />
            Je hebt aangemeld bij site.nl met de volgende gegevens. <br />
            <br />
            Gebruikersnaam: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />
            Wachtwoord: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />
            email: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />
            <br />
            Je moet nu je account activeren.. <br />
            <a href="http://www.site.nl/activeer?user=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]&code=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$code[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]">klik hier</a> om je account te activeren.<br />
            <br />
            Met Vriendelijk Groeten,
            <br />
            site.nl<br />
            <br />
            <font size=1 color=red>Deze e-mail is automatisch verstuurd omdat iemand zich heeft geregistreerd op site.nl met dit e-mail adres. Indien u zich niet geregistreerd hebt, gelieve deze mail te verwijderen.</font>[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700].=[/COLOR] registratiemailonder[COLOR= #007700]();[/COLOR]
            [URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$to[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$subject[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$headers[/COLOR][COLOR= #007700]);
    }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
?>
<form name="form1" id="form1" method="POST" action="">
Gebruikersnaam:<br /><input type="text" name="gebruikersnaam" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700];[/COLOR] ?>" onkeyup="checkname(this.value)" ><div id="usererror"></div><br />
Wachtwoord:<br /><INPUT type="password" name="pass" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]];[/COLOR] ?>"><br />
E-mail:<br /><INPUT type="text" name="email" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700];[/COLOR] ?>"><br /><br />
<input type="checkbox" name="info" value="info" />Ik wil informatie ontvangen over mijn account.
<br />
<input type="submit" name="Submit" value="Registreren" />
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
layoutonder[COLOR= #007700]();[/COLOR]
?>


check.js:

function checkname(value)
{
    $.ajax({
        type: "POST",
        url: "check.php", // Het php bestandje dat je wilt aanoepen
        data: "naam=" + value, // values die je mee wilt geven
        success: function(msg){
            $("#usererror").html(msg); // de div waarin je het wilt echoen
        }
    });
}


check.php:

[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]])) {[/COLOR]
        [COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strtolower"]strtolower[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]);[/COLOR]
        [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT naam FROM table WHERE naam = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$username[/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]$user[/COLOR][COLOR= #007700])){[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="rederror">Gebruikersnaam is in gebruik</div>[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]16[/COLOR][COLOR= #007700]) {[/COLOR]  
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="rederror">Gebruikersnaam is te lang</div>[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700])) {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="rederror">Vul aub een naam in</div>[/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]<div class="greenerror">Gebruikersnaam is beschikbaar</div>[/COLOR][COLOR= #007700];
        }
        
    }[/COLOR]
?>


Wanneer ik iets invoer bij de naam, gebeurd er niks.. Waar zit de fout?

Alvast bedankt,
Milan
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Je moet voor dat script ook jQuery hebben emo
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
GLS 1 rip xd
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Luukvdo schreef:
GLS 1 rip xd
Nah, hij heeft van mij gewoon de zooi gekregen.
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
wat is gls?
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Oeps, foutje.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Guildjuhh`s Leden Systeem
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