Registeer probleem!

Gestart doorRobertt9 reacties41 weergaven

10 berichten · pagina 1 van 1

Robertt

Lid · Topicstarter

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

Ik ben een beetje bezig met PHP en mijn login alles werkt (als ik gebruikers via DB invul ^^)
Maar nu ben ik met registreer pagina bezig. Hij zegt wel: Je account is geregistreerd maar hij staat niet in DB)

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<h1>Registeren</h1>"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$submit[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]];[/COLOR]

[COLOR= #0000BB]$helenaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]helenaam[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]);[/COLOR]

[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]repeatpassword[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Y-d-m"[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$submit[/COLOR][COLOR= #007700])
{[/COLOR]

[COLOR= #FF8000]//check for dingen.[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$helenaam[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700])
{[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700])
    {[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$helenaam[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700])
    {[/COLOR]
     [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lenge gebruikers naam of helenaam is te kocht<br>"[/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/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700])<[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Passwoord is te lelang!<br>"[/COLOR][COLOR= #007700];
        }
        {[/COLOR]
            [COLOR= #FF8000]//rehisteer de gebruiker
            
            // md5 van maken![/COLOR]
    [COLOR= #0000BB]$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$repeatpassword[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700]);[/COLOR]
    
    [COLOR= #0000BB]$connect[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"root"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"nietzichtbaarsorry"[/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_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"phplogin"[/COLOR][COLOR= #007700]);[/COLOR]
    
    [COLOR= #0000BB]$qlquery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO users VALUES($helenaam,$username,$password,$date)"[/COLOR][COLOR= #007700];[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je bent geregisteerd! <a href=index.php>Klik hier</a> om inteloggen!"[/COLOR][COLOR= #007700];
            
        }
    }
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"paswoord is niet goed<br>"[/COLOR][COLOR= #007700]);
    
    {[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je Gebruikersnaam/helenaam is te lang of te kort!!"[/COLOR][COLOR= #007700];   
        
    }
    
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Vul wel alles in!"[/COLOR][COLOR= #007700];
    
}[/COLOR] 

?>
<html>
<form action="registeren.php"  method="POST">
<table>
<tr>
<td>
Jouw helenaam
</td>
<td>
<input type="text" name="helenaam" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$helenaam[/COLOR][COLOR= #007700];[/COLOR] ?>">
</td>
</tr>

<tr>
<td>
Je gebruikersnaam:
</td>
<td>
<input type="text" name="username" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$username[/COLOR][COLOR= #007700];[/COLOR] ?>">
</td>
</tr>

<tr>
<td>
Wachtwoord
</td>
<td>
<input type="password"  name="password" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700];[/COLOR] ?>">
</td>
</tr>

<tr>
<td>
Herhaal je wachtwoord
</td>
<td>
<input type="password" name="repeatpassword"  value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700];[/COLOR] ?>">
</tr>
</table>
<p>
<input type="submit" name="submit" value="Registeren!">
<input type="reset" name="rest" value="Leegmaken">

</form>

</html>


Voor de goede oplossing krijg die persoon 0,01 yummie
Alvast Bedankt!
0
Berichten
1.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$qlquery = "INSERT INTO users VALUES($helenaam,$username,$password,$date)";

Dat heb je wel maar als je de $qlquery niet echoed gebeurt er niks. Dus echo $qlquery eronder en klaar of je doet gewoon: else{ insert into blaablaablla }
Ik zit op me ipod dus hopelijk lukt het hiermeewink
Edit: waarom md5 je $repeatpassword ? Of zie ik iets over het hoofd(kan natuurlijk) maar lijkt mij niet nodig omdat je die toch nirt opslaat en de check al voor het md5-en doetwink
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt niet
0
Berichten
5.795
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<h1>Registeren</h1>"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$submit[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]];[/COLOR]

[COLOR= #0000BB]$helenaam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]helenaam[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]);[/COLOR]

[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]repeatpassword[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Y-d-m"[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$submit[/COLOR][COLOR= #007700])
{[/COLOR]

[COLOR= #FF8000]//check for dingen.[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$helenaam[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700])
{[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700])
    {[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$helenaam[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700])
    {[/COLOR]
     [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lenge gebruikers naam of helenaam is te kocht<br>"[/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/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700])<[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Passwoord is te lelang!<br>"[/COLOR][COLOR= #007700];
        }
        {[/COLOR]
            [COLOR= #FF8000]//rehisteer de gebruiker
            
            // md5 van maken![/COLOR]
    [COLOR= #0000BB]$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$repeatpassword[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700]);[/COLOR]
    
    [COLOR= #0000BB]$connect[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"root"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"nietzichtbaarsorry"[/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_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"phplogin"[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO users VALUES($helenaam,$username,$password,$date)"[/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/echo"]echo[/URL] [COLOR= #DD0000]"Je bent geregisteerd! <a href=index.php>Klik hier</a> om inteloggen!"[/COLOR][COLOR= #007700];
            
        }
    }
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"paswoord is niet goed<br>"[/COLOR][COLOR= #007700]);
    
    {[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je Gebruikersnaam/helenaam is te lang of te kort!!"[/COLOR][COLOR= #007700];  
        
    }
    
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Vul wel alles in!"[/COLOR][COLOR= #007700];
    
}[/COLOR]

?>
<html>
<form action="registeren.php"  method="POST">
<table>
<tr>
<td>
Jouw helenaam
</td>
<td>
<input type="text" name="helenaam" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$helenaam[/COLOR][COLOR= #007700];[/COLOR] ?>">
</td>
</tr>

<tr>
<td>
Je gebruikersnaam:
</td>
<td>
<input type="text" name="username" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$username[/COLOR][COLOR= #007700];[/COLOR] ?>">
</td>
</tr>

<tr>
<td>
Wachtwoord
</td>
<td>
<input type="password"  name="password" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700];[/COLOR] ?>">
</td>
</tr>

<tr>
<td>
Herhaal je wachtwoord
</td>
<td>
<input type="password" name="repeatpassword"  value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$repeatpassword[/COLOR][COLOR= #007700];[/COLOR] ?>">
</tr>
</table>
<p>
<input type="submit" name="submit" value="Registeren!">
<input type="reset" name="rest" value="Leegmaken">

</form>

</html>
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan krijg ik Column count doesnt match value count at row 1 ?
0
Berichten
5.795
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
mysql_query("INSERT INTO users VALUES($helenaam,$username,$password,$date)") OR DIE(mysql_error());

daar je meot achter users dit doen (veldnaam1,veldnaam2,veldnaam3,veldnaam4)
en die moeten gelijk zijn aan die uit je database
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt ^^ werkt!

Alleen nog 1 vraagjes aan de php mensen biggrin
Hoe kan ik laten controleren als account al bestaat (gebruikers naam)? Heb veel geprobeerd maar wil maar niet lukken !
0
Krm

Lid

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ff van een bestaande script geplukt

if(isset($_POST[submit])){
        $sql1 = "SELECT 1 FROM `users` WHERE `email`=".mysql_real_escape_string(trim($_POST[email]))."";
        $query1 = mysql_query($sql1) OR DIE(mysql_error());
        $bestaat1 = mysql_num_rows($query1);
        
        $sql2 = "SELECT 1 FROM `users` WHERE `user`=".mysql_real_escape_string(trim($_POST[email]))."";
        $query2 = mysql_query($sql2) OR DIE(mysql_error());
        $bestaat2 = mysql_num_rows($query2);        
        
        $sql3 = "SELECT 1 FROM `users` WHERE `ip`=".$_SERVER[REMOTE_ADDR]."";
        $query3 = mysql_query($sql3) OR DIE(mysql_error());
        $bestaat3 = mysql_num_rows($query3);


}elseif($bestaat1 != 0){
            echo Dit email is al in gebruik!;
        }elseif($bestaat2 != 0){
            echo Deze gebruikersnaam is al in gebruik!;
        }elseif($bestaat3 != 0){
            echo Je hebt hier al een account!;
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En je moet ook even je script netter maken want er zitten er onnodige dingen in yummie
0
Robertt

Lid · Topicstarter

Berichten
1.579
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dankje wel allemaal voor de tips!
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