Checking filled in data for change_info has to be updated

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-07-02 16:36:44 +02:00
parent d3b12f74a4
commit 1b8bf17c8b
2 changed files with 23 additions and 5 deletions

View file

@ -17,6 +17,24 @@ function change_info(){
}
$webUser = new WebUsers();
$current_info = $webUser->getInfo($_POST['target_id']);
//TODO: XSS filtering
$query = "UPDATE ams_user SET ";
if(($_POST['FirstName'] != "") && ($_POST['FirstName'] != $current_info['FirstName'])){
$query = $query . "FirstName = :fName ";
}
if(($_POST['LastName'] != "") && ($_POST['LastName'] != $current_info['LastName'])){
$query = $query . "LastName = :lName ";
}
//TODO: add the other fields too
$query = $query . "WHERE Login = :user";
print($query);
exit;
$reply = $webUser->checkEmail($_POST['NewEmail']);
if ( $reply != "success" ){
$result['EMAIL_ERROR'] = 'TRUE';

View file

@ -144,7 +144,7 @@
<div class="controls">
<div class="input-prepend">
<span class="add-on" style="margin-left:5px;"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" id="Firstname" name="Firstname" placeholder="Your firstname" {if isset($FirstName) and $FirstName neq ""}value="{$FirstName}"{/if}>
<input type="text" class="input-xlarge" id="FirstName" name="FirstName" placeholder="Your firstname" {if isset($FirstName) and $FirstName neq ""}value="{$FirstName}"{/if}>
</div>
</div>
</div>
@ -154,7 +154,7 @@
<div class="controls">
<div class="input-prepend">
<span class="add-on" style="margin-left:5px;"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" id="Lastname" name="Lastname" placeholder="Your lastname">
<input type="text" class="input-xlarge" id="LastName" name="LastName" placeholder="Your lastname" {if isset($LastName) and $LastName neq ""}value="{$LastName}"{/if}>
</div>
</div>
</div>
@ -421,17 +421,17 @@
<label class="control-label">Gender</label>
<div class="controls">
<label class="radio">
<div id="uniform-optionsRadios2" class="radio"><span class=""><input style="opacity: 0;" name="optionsRadios" id="optionsRadios2" value="option2" checked="" type="radio"></span></div>
<div id="uniform-optionsRadios2" class="radio"><span class="{if isset($Gender) and $Gender eq 0}checked{/if}"><input style="opacity: 0;" name="optionsRadios" id="optionsRadios2" value="option2" {if isset($Gender) and $Gender eq 0}checked=""{/if} type="radio"></span></div>
Secret
</label>
<div style="clear:both"></div>
<label class="radio">
<div id="uniform-optionsRadios1" class="radio"><span class="checked"><input style="opacity: 0;" name="optionsRadios" id="optionsRadios1" value="option1" type="radio"></span></div>
<div id="uniform-optionsRadios1" class="radio"><span class="{if isset($Gender) and $Gender eq 1}checked{/if}"><input style="opacity: 0;" name="optionsRadios" id="optionsRadios1" value="option1" {if isset($Gender) and $Gender eq 1}checked=""{/if} type="radio"></span></div>
Male
</label>
<div style="clear:both"></div>
<label class="radio">
<div id="uniform-optionsRadios2" class="radio"><span class=""><input style="opacity: 0;" name="optionsRadios" id="optionsRadios2" value="option2" type="radio"></span></div>
<div id="uniform-optionsRadios2" class="radio"><span class="{if isset($Gender) and $Gender eq 2}checked{/if}"><input style="opacity: 0;" name="optionsRadios" id="optionsRadios2" value="option2" {if isset($Gender) and $Gender eq 2}checked=""{/if} type="radio"></span></div>
Female
</label>
</div>