Nieuw lid |
|
Hoi, ik ben redelijk nieuw in HTML en PHP. Ben een site aan het maken met een registratieformulier dat verdeeld is over verschillende pagina's, de laatste pagina submit alle gegevens van vorige pagina's naar mijn database. Nu het probleem is dat een deel van de PHP code zichtbaar is op de site en ik begrijp niet waarom. Kan iemand mij helpen? Alvast bedankt!
Uiteraard heb ik een aantal url's enzo gesencureerd.
<?php
// Include our config file that connects to MySQL server and selects database
include ("xxx.php");
// Define $_POST's from form
$username = $_POST['username'];
$password = $_POST['lastname'];
$email = $_POST['email'];
$province = $_POST['province'];
$region = $_POST['region'];
$terms = $_POST['terms'];
$bday = $_POST['bday'];
$bmonth = $_POST['bmonth'];
$byear = $_POST['byear'];
$prof = $_POST['prof'];
$education = $_POST['education'];
$query = "SELECT username FROM user WHERE username='$username'";
$result = mysql_query($query) or die ("foutje.");
$num = mysqli_num_rows($result);
if ($num>0)
{
$message_1 = "Username already exist!";
include("join.php");
include("join2.php");
include("join3.php");
exit();
}
else
{
$query = "INSERT INTO user (username, password, email, province, region, terms, bday, bmonth, byear, prof, education) VALUES ('$username','$password','$email','$province','$region','$terms','$bday','$bmonth','$byear','$prof','$education')";
$result = mysql_query($query);
}
// Check if result is inserted into table or not
if (!$result)
{
echo "Unable to insert data into table";
}
else
{
echo '<a href="http://www.mysite.com/yyy.php?page=" target="_self" > </a>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
<?php // Include our config file that connects to MySQL server and selects database include ("xxx.php"); // Define $_POST's from form $username = $_POST['username']; $password = $_POST['lastname']; $email = $_POST['email']; $province = $_POST['province']; $region = $_POST['region']; $terms = $_POST['terms']; $bday = $_POST['bday']; $bmonth = $_POST['bmonth']; $byear = $_POST['byear']; $prof = $_POST['prof']; $education = $_POST['education']; $query = "SELECT username FROM user WHERE username='$username'"; $num = mysqli_num_rows($result); if ($num>0) { $message_1 = "Username already exist!"; include("join.php"); include("join2.php"); include("join3.php"); } else { $query = "INSERT INTO user (username, password, email, province, region, terms, bday, bmonth, byear, prof, education) VALUES ('$username','$password','$email','$province','$region','$terms','$bday','$bmonth','$byear','$prof','$education')"; } // Check if result is inserted into table or not if (!$result) { echo "Unable to insert data into table"; } else { echo '<a href="http://www.mysite.com/yyy.php?page=" target="_self" > </a>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> </body> </html>
|