nu lijkt mooie als ik daar profiel foto laat toevoegen gelijk gekopeld is aan de username
zou iemand hier iets op weten
dit is wat ik heb database table zijn id, username, pasword, email,avatar, geslacht, leeftijd, relatie, woonplaats
<?php
include('config.php');
?>
<!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" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Edit my personnal informations</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Members Area" /></a>
</div>
<?php
if(isset($_SESSION['username']))
{
if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email'], $_POST['avatar'], $_POST['geslacht'], $_POST['leeftijd'], $_POST['relatie'], $_POST['woonplaats']))
{
if(get_magic_quotes_gpc())
{
$_POST['username'] = stripslashes($_POST['username']);
$_POST['password'] = stripslashes($_POST['password']);
$_POST['passverif'] = stripslashes($_POST['passverif']);
$_POST['email'] = stripslashes($_POST['email']);
$_POST['avatar'] = stripslashes($_POST['avatar']);
$_POST['geslacht'] = stripslashes($_POST['geslacht']);
$_POST['leeftijd'] = stripslashes($_POST['leeftijd']);
$_POST['relatie'] = stripslashes($_POST['relatie']);
$_POST['woonplaats'] = stripslashes($_POST['woonplaats']);
}
if($_POST['password']==$_POST['passverif'])
{
if(strlen($_POST['password'])>=6)
{
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['email']))
{
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$email = mysql_real_escape_string($_POST['email']);
$avatar = mysql_real_escape_string($_POST['avatar']);
$geslacht = mysql_real_escape_string($_POST['geslacht']);
$leeftijd = mysql_real_escape_string($_POST['leeftijd']);
$relatie = mysql_real_escape_string($_POST['relatie']);
$woonplaats = mysql_real_escape_string($_POST['woonplaats']);
$dn = mysql_fetch_array(mysql_query('select count(*) as nb from users where username="'.$username.'"'));
if($dn['nb']==0 or $_POST['username']==$_SESSION['username'])
{
if(mysql_query('update users set username="'.$username.'", password="'.$password.'", email="'.$email.'", avatar="'.$avatar.'", geslacht="'.$geslacht.'", leeftijd="'.$leeftijd.'", relatie="'.$relatie.'", woonplaats="'.$woonplaats.'" where id="'.mysql_real_escape_string($_SESSION['userid']).'"'))
{
$form = false;
unset($_SESSION['username'], $_SESSION['userid']);
?>
<div class="message">Uw informatie hebben successfuly bijgewerkt. U moet opnieuw aanmelden.<br />
<a href="connexion.php">Log in</a></div>
<?php
}
else
{
$form = true;
$message = 'An error occurred while updating your informations.';
}
}
else
{
$form = true;
$message = 'The username you want to use is not available, please choose another one.';
}
}
else
{
$form = true;
$message = 'The email you entered is not valid.';
}
}
else
{
$form = true;
$message = 'Your password must contain at least 6 characters.';
}
}
else
{
$form = true;
$message = 'The passwords you entered are not identical.';
}
}
else
{
$form = true;
}
if($form)
{
if(isset($message))
{
echo '<strong>'.$message.'</strong>';
}
if(isset($_POST['username'],$_POST['password'],$_POST['email']))
{
$pseudo = htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8');
if($_POST['password']==$_POST['passverif'])
{
$password = htmlentities($_POST['password'], ENT_QUOTES, 'UTF-8');
}
else
{
$password = '';
}
$email = htmlentities($_POST['email'], ENT_QUOTES, 'UTF-8');
$avatar = htmlentities($_POST['avatar'], ENT_QUOTES, 'UTF-8');
$geslacht = htmlentities($_POST['geslacht'], ENT_QUOTES, 'UTF-8');
$leeftijd = htmlentities($_POST['leeftijd'], ENT_QUOTES, 'UTF-8');
$relatie = htmlentities($_POST['relatie'], ENT_QUOTES, 'UTF-8');
$woonplaats = htmlentities($_POST['woonplaats'], ENT_QUOTES, 'UTF-8');
}
else
{
$dnn = mysql_fetch_array(mysql_query('select username,password,email,avatar,geslacht,relatie,woonplaats from users where username="'.$_SESSION['username'].'"'));
$username = htmlentities($dnn['username'], ENT_QUOTES, 'UTF-8');
$password = htmlentities($dnn['password'], ENT_QUOTES, 'UTF-8');
$email = htmlentities($dnn['email'], ENT_QUOTES, 'UTF-8');
$avatar = htmlentities($dnn['avatar'], ENT_QUOTES, 'UTF-8');
$geslacht = htmlentities($dnn['geslacht'], ENT_QUOTES, 'UTF-8');
$leeftijd = htmlentities($dnn['leeftijd'], ENT_QUOTES, 'UTF-8');
$relatie = htmlentities($dnn['relatie'], ENT_QUOTES, 'UTF-8');
$woonplaats = htmlentities($dnn['woonplaats'], ENT_QUOTES, 'UTF-8');
}
?>
<div class="content">
<form action="edit_infos.php" method="post">
U kunt uw informatie bewerken:<br />
<div class="center">
<label for="username">Gebruikersnaam :</label><input type="text" name="username" id="username" value="<?php echo $username; ?>" /><br />
<label for="password">wachtwoord<span class="small">(6 characters min.)</span></label><input type="password" name="password" id="password" value="<?php echo $password; ?>" /><br />
<label for="passverif">Wachtwoord<span class="small">(verification)</span></label><input type="password" name="passverif" id="passverif" value="<?php echo $password; ?>" /><br />
<label for="email">Email</label><input type="text" name="email" id="email" value="<?php echo $email; ?>" /><br />
<label for="avatar">Avatar<span class="small">(optional)</span></label><input type="text" name="avatar" id="avatar" value="<?php echo $avatar; ?>" /><br />
<label for="geslacht">man of vrouw :</label><input type="text" name="geslacht" id="geslacht" value="<?php echo $geslacht; ?>" /><br />
<label for="leeftijd">U leeftijd :</label><input type="text" name="leeftijd" id="leeftijd" value="<?php echo $leeftijd; ?>" /><br />
<label for="relatie">Relatie status :</label><input type="text" name="relatie" id="relatie" value="<?php echo $relatie; ?>" /><br />
<label for="woonplaats">Woonplaats :</label><input type="text" name="woonplaats" id="woonplaats" value="<?php echo $woonplaats; ?>" /><br />
<input type="submit" value="Send" />
</div>
</form>
</div>
<?php
}
}
else
{
?>
<div class="message">Om deze pagina te openen , moet u ingelogd zijn ..<br />
<a href="connexion.php">Log in</a></div>
<?php
}
?>
<div class="foot"><a href="<?php echo $url_home; ?>">Home</a> - </div>
</body>
</html>