Ok, ik heb een scriptje, waarme mensen zich kunnen registreren bij een Service (bestaat niet echt, is voor stage).
Nu heb ik dus een paar vraagjes.
1) hoe zorg ik ervoor dat hij een fout geeft zodra 'Password1' en 'Password2' niet overeenkomen?
2) Hoe kan ik hem laten checken of 'Username' al in gebruik is?
3) Hoe kan ik hem als ie klaar is een pagina laten openen ipv. een tekstmelding geven (de foutmeldingen moeten wel gewoon als tekst bovenaan aangegeven worden)
hier is her script:
<?php
if (!empty($_POST)){
// Connect to Server
$server = mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db("NitroServe", $server) or die(mysql_error());
// In case of strange signs,add a \
$Username = addslashes($_POST['Username']);
$Password1 = addslashes($_POST['Password1']);
$EAddress = addslashes($_POST['EAddress']);
$FirstName = addslashes($_POST['FirstName']);
$LastName = addslashes($_POST['LastName']);
$ZipPostal = addslashes($_POST['ZipPostal']);
$Address = addslashes($_POST['Address']);
$City = addslashes($_POST['City']);
$Service = addslashes($_POST['Service']);
$CustomWebspace = addslashes($_POST['CustomWebspace']);
$CustomFTPUsers = addslashes($_POST['CustomFTPUsers']);
$CustomPOP3Addresses = addslashes($_POST['CustomPOP3Addresses']);
// Insert to tables (INSERT)
$sql = "INSERT INTO userinfo (Username, Password, Email, Name, LastName, ZipOrPostal, Address, City, Service, Webspace, FTPusers, POPaccounts)
VALUES ('$Username', '$Password1', '$EAddress', '$FirstName', '$LastName', '$ZipPostal', '$Address', '$City', '$Service', '$CustomWebspace', '$CustomFTPusers', '$CustomPOP3Addresses')";
// Exexute SQL
mysql_query($sql) or die(mysql_error());
// On complete
echo "Cool, winkel is suxesvol toegevoegd.";
}
?>
<html>
<title>NitroServe.com</title>
<style fprolloverstyle>
BODY {
scrollbar-face-color: #DAEDFF; scrollbar-shadow-color: #FFFFFF;
scrollbar-highlight-color: #FFFFFF; scrollbar-3dlight-color: #A3D3FF;
scrollbar-darkshadow-color: #A3D3FF; scrollbar-track-color: #A3D3FF;
scrollbar-arrow-color: #000000
}
</style>
<style type="text/css">
A:link, A:visited, A:active {text-decoration : underline; color : #000000;}
A:hover {text-decoration : bold; color : #000000; font-weight : bold;}
body {font-family : verdana, arial, helvetica, sans-serif; font-size : x-small; color : #000000; background-color : #FFFFFF}
</style>
</head>
<body background="backgr.gif">
<form action="register.php3" method="post">
<input type="hidden" name="submit" value="yes">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="50%"><font size="2">Desired username:</td>
<td width="50%">
<input type="text" name="Username" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Password:</td>
<td width="50%">
<input type="password" name="Password1" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Re-type your password:</td>
<td width="50%">
<input type="password" name="Password2" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">E-mail:</td>
<td width="50%">
<input type="text" name="EAddress" size="20"></td>
</tr>
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%"><font size="2">First name:</td>
<td width="50%">
<input type="text" name="FirstName" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Last name:</td>
<td width="50%">
<input type="text" name="LastName" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Zip or Postal code:</td>
<td width="50%">
<input type="text" name="ZipPostal" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Address:</td>
<td width="50%">
<input type="text" name="Address" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">City:</td>
<td width="50%">
<input type="text" name="City" size="20"></td>
</tr>
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%"><font size="2">Desired Service:</td>
<td width="50%">
<select size="1" name="Service">
<option value="Light">Light</option>
<option selected value="Standard">Standard</option>
<option value="Plus">Plus</option>
<option value="Extreme">Extreme</option>
<option value="Custom">Custom</option>
</select></td>
</tr>
<tr>
<td width="100%" colspan="2">
<p align="center"><font size="2">The next options are only necessary when you've chosen for "Custom",
else click Register to continue.</td>
</tr>
<tr>
<td width="50%"><font size="2">Amount of webspace:</td>
<td width="50%">
<input type="text" name="CustomWebspace" size="20"><font size="2">MB</td>
</tr>
<tr>
<td width="50%"><font size="2">Amount of FTP-users:</td>
<td width="50%">
<input type="text" name="CustomFTPUsers" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Amount of POP3 addresses:</td>
<td width="50%">
<input type="text" name="CustomPOP3Addresses" size="20"></td>
</tr>
</table>
<p><font size="2">By clicking "Register" you agree to "<a href="stos.htm">terms of service</a>"<br>
<p><input type="submit" value="Voeg toe" name="Register">
<input type="reset" value="Start all over" name="StartAllOver"></p>
</form>
</body>
</html>
Nu heb ik dus een paar vraagjes.
1) hoe zorg ik ervoor dat hij een fout geeft zodra 'Password1' en 'Password2' niet overeenkomen?
2) Hoe kan ik hem laten checken of 'Username' al in gebruik is?
3) Hoe kan ik hem als ie klaar is een pagina laten openen ipv. een tekstmelding geven (de foutmeldingen moeten wel gewoon als tekst bovenaan aangegeven worden)
hier is her script:
<?php
if (!empty($_POST)){
// Connect to Server
$server = mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db("NitroServe", $server) or die(mysql_error());
// In case of strange signs,add a \
$Username = addslashes($_POST['Username']);
$Password1 = addslashes($_POST['Password1']);
$EAddress = addslashes($_POST['EAddress']);
$FirstName = addslashes($_POST['FirstName']);
$LastName = addslashes($_POST['LastName']);
$ZipPostal = addslashes($_POST['ZipPostal']);
$Address = addslashes($_POST['Address']);
$City = addslashes($_POST['City']);
$Service = addslashes($_POST['Service']);
$CustomWebspace = addslashes($_POST['CustomWebspace']);
$CustomFTPUsers = addslashes($_POST['CustomFTPUsers']);
$CustomPOP3Addresses = addslashes($_POST['CustomPOP3Addresses']);
// Insert to tables (INSERT)
$sql = "INSERT INTO userinfo (Username, Password, Email, Name, LastName, ZipOrPostal, Address, City, Service, Webspace, FTPusers, POPaccounts)
VALUES ('$Username', '$Password1', '$EAddress', '$FirstName', '$LastName', '$ZipPostal', '$Address', '$City', '$Service', '$CustomWebspace', '$CustomFTPusers', '$CustomPOP3Addresses')";
// Exexute SQL
mysql_query($sql) or die(mysql_error());
// On complete
echo "Cool, winkel is suxesvol toegevoegd.";
}
?>
<html>
<title>NitroServe.com</title>
<style fprolloverstyle>
BODY {
scrollbar-face-color: #DAEDFF; scrollbar-shadow-color: #FFFFFF;
scrollbar-highlight-color: #FFFFFF; scrollbar-3dlight-color: #A3D3FF;
scrollbar-darkshadow-color: #A3D3FF; scrollbar-track-color: #A3D3FF;
scrollbar-arrow-color: #000000
}
</style>
<style type="text/css">
A:link, A:visited, A:active {text-decoration : underline; color : #000000;}
A:hover {text-decoration : bold; color : #000000; font-weight : bold;}
body {font-family : verdana, arial, helvetica, sans-serif; font-size : x-small; color : #000000; background-color : #FFFFFF}
</style>
</head>
<body background="backgr.gif">
<form action="register.php3" method="post">
<input type="hidden" name="submit" value="yes">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="50%"><font size="2">Desired username:</td>
<td width="50%">
<input type="text" name="Username" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Password:</td>
<td width="50%">
<input type="password" name="Password1" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Re-type your password:</td>
<td width="50%">
<input type="password" name="Password2" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">E-mail:</td>
<td width="50%">
<input type="text" name="EAddress" size="20"></td>
</tr>
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%"><font size="2">First name:</td>
<td width="50%">
<input type="text" name="FirstName" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Last name:</td>
<td width="50%">
<input type="text" name="LastName" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Zip or Postal code:</td>
<td width="50%">
<input type="text" name="ZipPostal" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Address:</td>
<td width="50%">
<input type="text" name="Address" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">City:</td>
<td width="50%">
<input type="text" name="City" size="20"></td>
</tr>
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%"><font size="2">Desired Service:</td>
<td width="50%">
<select size="1" name="Service">
<option value="Light">Light</option>
<option selected value="Standard">Standard</option>
<option value="Plus">Plus</option>
<option value="Extreme">Extreme</option>
<option value="Custom">Custom</option>
</select></td>
</tr>
<tr>
<td width="100%" colspan="2">
<p align="center"><font size="2">The next options are only necessary when you've chosen for "Custom",
else click Register to continue.</td>
</tr>
<tr>
<td width="50%"><font size="2">Amount of webspace:</td>
<td width="50%">
<input type="text" name="CustomWebspace" size="20"><font size="2">MB</td>
</tr>
<tr>
<td width="50%"><font size="2">Amount of FTP-users:</td>
<td width="50%">
<input type="text" name="CustomFTPUsers" size="20"></td>
</tr>
<tr>
<td width="50%"><font size="2">Amount of POP3 addresses:</td>
<td width="50%">
<input type="text" name="CustomPOP3Addresses" size="20"></td>
</tr>
</table>
<p><font size="2">By clicking "Register" you agree to "<a href="stos.htm">terms of service</a>"<br>
<p><input type="submit" value="Voeg toe" name="Register">
<input type="reset" value="Start all over" name="StartAllOver"></p>
</form>
</body>
</html>