Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <span class="newstitle">Registrer bruker</span>
- <span class="newstext">
- <form method="post" name="regbruker" id="regbruker" action="">
- <strong>Brukernavn:</strong><br /><input type="text" name="username" id="username" style="width:300px;height:20px" /><br /><br />
- <strong>Passord:</strong><br /><input type="password" name="password" id="password" style="width:300px;height:20px" /><br /><br />
- <strong>Mail:</strong><br /><input type="text" name="mail" id="mail" style="width:300px;height:20px" /><br /><br />
- <strong>Navn:</strong><br /><input type="text" name="navn" id="navn" style="width:300px;height:20px" /><br /><br />
- <strong>Bosted:</strong><br /><input type="text" name="bosted" id="bosted" style="width:300px;height:20px" /><br /><br />
- <input style="float:left;width:100px" type="submit" value="Registrer" name="reg" id="reg" /><br /><br />
- </form>
- <br />
- <?PHP
- $username=$_POST["username"];
- $password=(md5($_POST["password"]));
- $mail=$_POST["mail"];
- $navn=$_POST["navn"];
- $bosted=$_POST["bosted"];
- $reg=$_POST["reg"];
- include("connect.php");
- if ($reg)
- {
- $valider=1;
- if (!$username)
- {
- print("Du må fylle ut brukernavn<br />");
- $valider=0;
- }
- if (!$password)
- {
- print("Du må fylle ut passord<br />");
- $valider=0;
- }
- if (!$mail)
- {
- print("Du må fylle ut mail<br />");
- $valider=0;
- }
- if (!$navn)
- {
- print("Du må fylle ut navn<br />");
- $valider=0;
- }
- if (!$bosted)
- {
- print("Du må fylle ut bosted<br />");
- $valider=0;
- }
- if ($valider)
- {
- $sqlquery=mysql_query("SELECT * FROM bruker WHERE brukernavn='$username';");
- if(mysql_num_rows($sqlquery) != 0)
- {
- print("Brukernavnet finnes allerede fra før<br /><br />");
- }
- else
- {
- $sqlquery=mysql_query("INSERT INTO bruker VALUES('$username','$password','$mail','$navn','$bosted')");
- if ($sqlquery)
- {
- print("Du har nå registrert følgende informasjon:<br /><br /><strong>Brukernavn: </strong> $username<br /><strong>Passord: </strong><i>skjult</i><br /><strong>Mail: </strong><i>$mail</i><br /><strong>Navn: </strong><i>$navn</i><br /><strong>Bosted: </strong><i>$bosted</i><br /><br />Du kan nå logge inn!<br /><br />");
- }
- else
- {
- die(mysql_error);
- }
- }
- }
- }
- ?>
- </span>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement