<?php
/* Written by Gerben Schmidt, http://scripts.zomp.nl */
ob_start();
include_once("functions.php");
include('config.php');
include("session.php");
// this setting activates tinyMCE for all textareas in the page
$set_mce = 1;
include("header.php");
if(!$_SESSION["loggedIn"]){ echo "You are not allowed to view this page, please log in first."; exit; }
$user = loadUser($_SESSION['login'],$link,$table_users);
$moblog = loadMoblogSettings($link,$table_moblog);
if($_POST["Submit"]){
if(($_POST["password2"]) && (strcmp($_POST["password"], $_POST["password2"]))) {
$messages[]="$lang_mismatch";
}
/*
// uncomment any of these to make them obligatory
if(!$_POST['email']){
$messages[]="$lang_message031";
}
if(!$_POST['name']){
$messages[]="$lang_message030";
}
if(!$_POST['adress']){
$messages[]="$lang_message034";
}
if(!$_POST['zip']){
$messages[]="$lang_message035";
}
if(!$_POST['country']){
$messages[]="$lang_message036";
}
*/
if(empty($messages)) {
if($_POST[password2]){
updatePass($user[id],$link,$table_users);
}
updateUser($user[id],$link,$table_users);
header("Location: profile.php?message=4");
ob_end_flush();
}
}
?>
<div id="submenu"><a href="profile.php" class="sub"><?php echo "$lang_editprofile"; ?></a><?php if($user[admin]){ ?> | <a href="users.php" class="sub"><?php echo "$lang_manage_users"; ?></a><?php } ?></div>
<div id="side">
<div class="title"> </div>
<div class="box"><?php
if(!empty($messages)){
displayErrors($messages);
}
elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
}
else{
echo "$lang_message007";
}
?>
</div>
<?php if ($user[admin]){ ?>
<br />
<div class="title"><?php echo "$lang_latest_users"; ?></div>
<div class="box">
<?php
$query = "SELECT * FROM $table_users ORDER BY id DESC LIMIT 10";
$result = mysql_query ($query, $link) or die("Died getting info from db. Error returned if any: ".mysql_error());
$numrows = mysql_num_rows($result);
$users = arrayMaker($result,MYSQL_ASSOC);
if($users){
foreach($users as $user){
echo "<a href='users.php?id=$user[id]'>$user[login]</a><br />";
}
}
else
{
echo $lang_no_results;
}
?>
</div>
<?php } ?>
</div>
<div id="main">
<form name="myform" method="post" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h1><?php echo "$lang_editprofile: $user[login]"; ?></h1></td>
<td>
<?php if(!$_GET['username']){ ?>
<input type="submit" name="Submit" value="<?php echo "$lang_submit"; ?>" id="button" />
<?php } ?> </td>
</tr>
</table></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<fieldset id="titlediv">
<legend><?php echo "$lang_password"; ?></legend>
<input name="password" type="password" id="password"><br /><br />
<em><?php echo "$lang_retype_password"; ?></em><br />
<input name="password2" type="password" id="password2" value=""> <?php echo "$lang_password_only_when"; ?>
</fieldset> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> <fieldset id="titlediv">
<legend><?php echo "$lang_name"; ?></legend>
<input name="name" type="text" id="name" value="<?php echo "$user[name]"; ?>"></fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<fieldset id="titlediv">
<legend><?php echo "$lang_email"; ?></legend>
<?php if($moblog[use_moblog]){
echo "--> $lang_use_email_moblog. <a href='help.php?id=1'>$lang_what_is_moblogging</a>";
} ?>
<input name="email" type="text" id="email" value="<?php echo "$user[email]"; ?>"></fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_address"; ?></legend>
<input name="adress" type="text" id="adress" value="<?php echo "$user[adress]"; ?>"></fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_zipcode"; ?></legend>
<input name="zip" type="text" id="zip" value="<?php echo "$user[zip]"; ?>"></fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_country"; ?></legend>
<?php
$query = "SELECT * FROM $table_cat WHERE id = '$user[country]' LIMIT 1";
$result = mysql_query($query,$link);
$row = mysql_fetch_array($result);
$stored = $user[country];
?>
<?php selectCountry($stored); ?>
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_birthday"; ?></legend>
<input name="birthday" type="text" id="birthday" value="<?php echo "$user[birthday]"; ?>"></fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_gender"; ?></legend>
<input name="gender" type="radio" value="male" <?php if($user[gender] == 'male'){ ?> checked="checked" <?php } ?> />
<?php echo "$lang_male"; ?>
<input name="gender" type="radio" value="female" <?php if($user[gender] == 'female'){ ?> checked="checked" <?php } ?> />
<?php echo "$lang_female"; ?>
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<fieldset id="titlediv">
<legend><?php echo "$lang_home_url"; ?></legend>
<input name="url" type="text" id="url" value="<?php echo "$user[url]"; ?>" size="35" />
</fieldset> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> <fieldset id="titlediv">
<legend><?php echo "$lang_image_url"; ?></legend>
<input name="image" type="text" id="image" value="<?php echo "$user[image]"; ?>" size="35" />
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> <fieldset id="titlediv">
<legend><?php echo "$lang_utube_url"; ?></legend>
<input name="movie" type="text" id="movie" value="<?php echo "$user[movie]"; ?>" size="35" />
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<fieldset id="titlediv">
<legend><?php echo "$lang_about_me"; ?></legend> <textarea name="about" cols="65" rows="8" id="about"><?php echo "$user[about]"; ?></textarea>
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_interests"; ?></legend>
<textarea name="interests" cols="65" rows="8" id="interests"><?php echo "$user[interests]"; ?></textarea>
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<?php if(!$_GET['username']){ ?>
<input type="submit" name="submit" value="<?php echo "$lang_submit"; ?>" id="submit" />
<?php } ?> </td>
</tr>
</table>
</form>
</div>
<?php include("footer.php"); ?>