registering doesn't work anymore.....



Hi All,

sorry for the long post but I created a registering page which all of
a sudden doesn't work anymore.
I have no idea where to start. Maybe someone can help me out:

register.php:

<HTML>
<HEAD>
<title>Sphinx Registreren</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000000;
text-decoration: none;
scrollbar-face-color: #DEE3E7;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #DEE3E7;
scrollbar-3dlight-color: #D1D7DC;
scrollbar-arrow-color: #006699;
scrollbar-track-color: #EFEFEF;
scrollbar-darkshadow-color: #98AAB1;
background-color: #FFFFFF;
margin: 0px;
}
td {
font-size: 10px;
color: #666666;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;

border-bottom-style:none;
}
tr {
font-size: 10px;
color: #666666;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
border-bottom-style:none;
}
th {
font-size: 10px;
color: #666666;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
border-bottom-style:none;
border:0;
}

A {text-decoration: none;COLOR: #000000; }
A:visited { text-decoration: none;color: #000000; }
A:hover { COLOR: #000000; TEXT-DECORATION: none }
..style1 {
font color:#000000;
}
..style2 {
font color: #000000;
}
..style3 {
font color: #ffffff;
}
form {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #ffffff;}
<!--body {
color: #000000;-->
}
..tablest { text-decoration: none;
border-color: #000000;
background :#D8D8D8;
}
..tablebg1 { text-decoration: none;
border-color: #000000;
background :#59002D;
}
..tablebg2 { font-family: Tahoma, Arial,
Helvetica, sans-serif;
font-size: 11px;
text-decoration: none;
border-color: #000000;
font-color : #ffffff;
color : #ffffff;
background :#010D55;
}
..tablebg3{ background :#CCCCCC;
border-color :
#cccccc;
}
..tablebg4{
background :#F4F4F4;
color : #000000;
font-color : #ffffff;
}
..tablebg5{
border-color: #000000;
color : #000000;
}
.adminarea{ font-family: arial;
font-size: 30px;
font-style:oblique;
text-decoration: none;
border-color: #000000;
font-color : #ffffff;
color : #ffffff;
background :#010D55;
font-weight: bold;
}

..textboxgray {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #666666;
border: 1px solid #999999;
background-color: #f7f7f7;
}
..textboxgray1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
border: 1px solid #999999;
background-color: #f7f7f7;

padding: 1px;
width:100%;
border-spacing: inherit;

}
form {
margin: 0px;
padding: 20px;
color: #000000;
}
</STYLE>
</HEAD>
<body>
<script type="text/javascript" src="wz_tooltip.js"></script>
<form name=form1 method=post action=register2.php>
<center>
<br><br>
<table width=410 border=1 cellpadding=4 cellspacing=0>
<tr>
<td width=410 align=left valign=top bgcolor=#F0F0F0>
<table width=400 border=0 cellpadding=4 cellspacing=0>
<tr>
<td width=54% align=left valign=top>Voornaam</td>
<td width=46%><input name=first_name type=text id=first_name> *</
td>
</tr>
<tr>
<td align=left valign=top>Achternaam</td>
<td><input name=last_name type=text id=last_name> *</td>
</tr>
<tr>
<td align=left valign=top>E-mail adres</td>
<td><input name=email_address type=text id=email_address> *</td>
</tr>
<tr>
<td align=left valign=top>Gewenste Username</td>
<td><input name=username type=text id=username> *</td>
</tr>
<tr>
<td align=left valign=top>Informatie over jou</td>
<td><textarea name=info id=info></textarea></td></tr>
<tr>
<tr><br>
<td align=left valign=top>Ontvang <strong>Gratis</strong> SMS
bij Nieuws.</td>
<td><input type=checkbox name=sms value='ja'>&nbsp;<img
onmouseover="Tip('Gratis SMS bij nieuws<br>&nbsp;&nbsp;&nbsp;Wanneer
je deze optie aanvinkt ontvang je<br>&nbsp;&nbsp;&nbsp;een GRATIS sms
op je mobiele telefoon<br>&nbsp;&nbsp;&nbsp;wanneer er een nieuwsitem
is geplaatst<br>&nbsp;&nbsp;&nbsp;op de homepage van onze Sphinx
website.<br>&nbsp;&nbsp;&nbsp;Op deze manier ben je direct op de
hoogte.<br>&nbsp;&nbsp;&nbsp;Vul hiervoor je mobiele nummer in.<br>',
TITLE, 'SPHINX website registratie')" src="/images/questionMark.gif"></
td></tr>
<tr>
<tr>
<td align=left valign=top>Mobiel nummer</td>
<td><input name=gsm type=text id=gsm><br>(Format +31612345678)</
td></tr>
<tr>
<td align=left valign=top>Ontvang Email bij Nieuws.</td>
<td><input type=checkbox name=email value='ja'>&nbsp;<img
onmouseover="Tip('Email bij nieuws<br>&nbsp;&nbsp;&nbsp;Wanneer je
deze optie aanvinkt krijg je<br>&nbsp;&nbsp;&nbsp;automatisch de
Sphinx Nieuwsbrief in je<br>&nbsp;&nbsp;&nbsp;email met het laatste
nieuws van onze website.<br>&nbsp;&nbsp;&nbsp;De nieuwsbrief wordt
alleen verstuurd als er<br>&nbsp;&nbsp;&nbsp;een nieuwsitem op de
website is geplaatst.<br>', TITLE, 'SPHINX website registratie')"
src="/images/questionMark.gif"></td></tr>
<tr>
<td align=left valign=top><img src="CaptchaSecurityImages.php?
width=100&height=40&characters=5" /></td>
<td><input id=security_code name=security_code type=text /></
td></tr>
<tr>
<td align=left valign=top>&nbsp;</td>
<td><input type=submit name=Submit value=Join Now!></td>
</tr>
</table>
</table><br>
Velden gemarkeerd met een asterisk (*) zijn verplicht.
</form>
</center>
</body>
</html>

Register2.php:

<?php
session_start();
// SET ERROR REPORTING
error_reporting(E_ALL ^ E_NOTICE);
date_default_timezone_set('Europe/Paris');
include("database.php");

$connection = mysql_connect($db_host, $db_name , $db_password) or die
(mysql_error());
$db = mysql_select_db($db_name) or die(mysql_error());

// Define post fields into simple variables
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$username = $_POST['username'];
$info = $_POST['info'];
$gsm = $_POST['gsm'];
$sitename = "Sphinx Website";

if (isset($_POST['sms'])) {
$sms = $_POST['sms'];

if ($sms == 'ja') {
$sms = 1;
}
else { $sms = 0;
}
}

if (isset($_POST['email'])) {
$email = $_POST['email'];

if ($email == 'ja') {
$email = 1;
}
else { $email = 0;
}
}
/* Lets strip some slashes in case the user entered
any escaped characters. */

$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name);
$email_address = stripslashes($email_address);
$username = stripslashes($username);
$info = stripslashes($info);
$gsm = stripslashes($gsm);

/* Do some error checking on the form posted fields */
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty
($_SESSION['security_code'] ) ) {
unset($_SESSION['security_code']);
} else {
echo "<link rel=\"stylesheet\" href=\"images/style.css\" type=\"text/
css\" />";
echo "<div class=msg>Je hebt een verkeerde Security code ingegeven.</
div><br />";
include 'register.php'; // Show the form again!
exit(); // if the error checking has failed, we'll exit the script!
}

if(empty($_POST['first_name']) || empty($_POST['last_name']) || empty
($_POST['email_address']) || empty($_POST['username']) || empty($_POST
['gsm'])){

echo "<link rel=\"stylesheet\" href=\"images/style.css\" type=\"text/
css\" />";
if(!$first_name){
echo "<div class=msg>Voornaam is een verplicht veld. Vul het alsnog
in.</div><br />";
}
if(!$last_name){
echo "<div class=msg>Achternaam is een verplicht veld. Vul het
alsnog in.</div><br />";
}
if(!$email_address){
echo "<div class=msg>E-mail adres is een verplicht veld. Vul het
alsnog in.</div><br />";
}
if(!$username){
echo "<div class=msg>Gebruikersnaam is een verplicht veld. Vul het
alsnog in.</div><br />";
}
if(empty($_POST['gsm'])){
if($_POST['sms'] == 'ja'){
echo "<div class=msg>Vul je mobiele nummer in om SMS te kunnen
ontvangen.</div><br />";
}
}
session_unset();
session_destroy();
include 'register.php'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script!
}

if(preg_match("/^[0-9]{13}$/s", $_POST['gsm']) || preg_match("/^+[0-9]
{11}$/s", $_POST['gsm'])) {

} else {
echo "<link rel=\"stylesheet\" href=\"images/style.css\" type=\"text/
css\" />";
echo "<div class=msg>Dit is geen correct mobiel nummer, controleer
het format.</div><br />";

session_unset();
session_destroy();
include 'register.php'; // Show the form again!
exit(); // if the error checking has failed, we'll exit the script!

}

/* Let's do some checking and ensure that the user's email address or
username
does not exist in the database */

$sql_email_check = mysql_query("SELECT email_address FROM members
WHERE email_address='$email_address'");
$sql_username_check = mysql_query("SELECT username FROM members WHERE
username='$username'");

$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);

if(($email_check > 0) || ($username_check > 0)){
echo "<link rel=\"stylesheet\" href=\"images/style.css\" type=\"text/
css\" />";
echo "<div class=msg>De volgende fouten werden gevonden: </div><br /
";
if($email_check > 0){
echo "<div class=msg>Je E-mail adres komt reeds voor in onze
database. Gebruik een ander E-mail adres!</div><br />";
unset($email_address);
}
if($username_check > 0){
echo "<div class=msg>De gekozen username komt reeds voor in onze
database. Gebruik een andere username!</div><br />";
unset($username);
}
session_unset();
session_destroy();
include 'register.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}

/* Everything has passed both error checks that we have done.
It's time to create the account! */

/* Random Password generator.
http://www.phpfreaks.com/quickcode/Random_Password_Generator/56.php

We'll generate a random password for the
user and encrypt it, email it and then enter it into the db.
*/

function makeRandomPassword() {
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}

$random_password = makeRandomPassword();

$db_password = md5($random_password);

// Enter info into the Database.
$info2 = htmlspecialchars($info);

$sql = mysql_query("INSERT INTO members (first_name, last_name,
email_address, username, password, info, signup_date,
decrypted_password, sms , mobiel, email)
VALUES('$first_name', '$last_name', '$email_address', '$username',
'$db_password', '$info2', now(), '$random_password', '$sms' , '$gsm',
'$email')") or die (mysql_error());

if(!$sql){
echo "<link rel=\"stylesheet\" href=\"images/style.css\" type=\"text/
css\" />";
echo 'Er is een fout opgetreden bij het aanmaken van de account. Neem
contact op met de webmaster.';
} else {
$userid = mysql_insert_id();
$activatepath = "http://www.stommen.nl/activate.php?id=$userid&code=
$db_password";

// Let's mail the webmaster!

$Name = $last_name; //senders name
$email = $email_address; //senders e-mail adress
$recipient = "stommennl@xxxxxxxxxx"; //recipient
$mail_body = "De Activeringscode voor Sphinx: $activatepath"; //mail
body
$subject = "Registratieverzoek op Sphinx"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional
headerfields

ini_set('mail.stommen.nl', 'smtp1.argewebhosting.nl'); //Suggested
by "Some Guy"

mail($recipient, $subject, $mail_body, $header); //mail command :)

// Let's mail the user!

$Name = $last_name; //senders name
$email = $adminemail; //senders e-mail adress
$recipient = $email_address; //recipient
$mail_body = " Bedankt voor je registratie op Sphinx,
Om je account te activeren heb je een code nodig, deze wordt je
opgestuurd door de webmaster.

Wanneer je account is geactiveerd kun je met de volgende gegevens
inloggen:
Username: $username
Password: $random_password

Veel plezier!
Webmaster, $sitename


Dit is een automatisch gegenereerde email, beantwoorden is niet
mogelijk!";

$subject = "Registratieverzoek op Sphinx"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional
headerfields

ini_set('mail.stommen.nl', 'smtp1.argewebhosting.nl'); //Suggested
by "Some Guy"

mail($recipient, $subject, $mail_body, $header); //mail command :)

echo "<link rel=\"stylesheet\" href=\"images/style.css\" type=\"text/
css\" />";
echo '<div class=msg>Je aanvraag is ontvangen en wordt verwerkt. Je
keert automatisch terug naar de inlogpagina.</div><br />';
}
?>
<HTML>
<HEAD>
<title>Sphinx Registreren</title>
<meta http-equiv="REFRESH" content="5;url=http://www.stommen.nl/
mylogin.php">
</HEAD>
</HTML>



Regards
Marco
.



Relevant Pages

  • captcha doesnt work
    ... font-size: 14px; ... text-decoration: none; ... eerste karakter ...
    (comp.lang.php)
  • Fieldset CSS Centering
    ... I created a CSS file which defined the attributes of my fieldset. ... font-weight: Normal; ... font-size: 11px; ... border-color: 888888; ...
    (alt.html)