View file Spiderwap.in File Hosting/panel/editme.php

File size: 2.32Kb
<?php
require('../sys/set.php');

if(!isset($_POST['edit'])){
$smarty->assign('title','Edit Profile');
$smarty->display('header.tpl');
$smarty->display('ank.edit.tpl');
$smarty->display('footer.tpl');
} else {

$_POST['name'] = fil($_POST['name'],'str');
$_POST['siti'] = fil($_POST['siti'],'str');
$_POST['osebe'] = fil($_POST['osebe'],'str');
$_POST['skype'] = fil($_POST['skype'],'str');
$_POST['icq'] = fil($_POST['icq'],'int');

if(!empty($_POST['name']) && (mb_strlen($_POST['name'])<3 || mb_strlen($_POST['name'])>35)){
	$err = 'The name can be from 3 to 35 characters';}

if(!empty($_POST['siti']) && (mb_strlen($_POST['siti'])<3 || mb_strlen($_POST['siti'])>50)){
	$err = 'Length of residence must be between 3 and 50 characters';}

if(!empty($_POST['skype']) && (mb_strlen($_POST['skype'])<3 || mb_strlen($_POST['skype'])>25)){
	$err = 'Skype length must be between 3 and 25 characters';}

if(!empty($_POST['osebe']) && (mb_strlen($_POST['osebe'])<3 || mb_strlen($_POST['osebe'])>150)){
	$err = 'The length of the field "about yourself" should be between 3 and 150 characters';}

if(!empty($_POST['icq']) && (mb_strlen($_POST['icq'])<5 || mb_strlen($_POST['icq'])>10)){
	$err = 'Icq length must be between 5 and 10 characters';}

if (!filter_var($_POST['url'], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)){
	$err = 'Invalid format of the site address';}


if(isset($err)){
$smarty->assign('title','Error');
$smarty->assign('back','/panel/editme.php');
$smarty->assign('error',$err);
$smarty->display('header.tpl');
$smarty->display('error.tpl');
$smarty->display('footer.tpl');
}

if($sql->query('UPDATE `acc` SET
`name`="'.$_POST['name'].'",
`siti`="'.$_POST['siti'].'",
`osebe`="'.$_POST['osebe'].'",
`skype`="'.$_POST['skype'].'",
`icq`="'.$_POST['icq'].'",
`site`="'.$_POST['url'].'"')){
 $smarty->assign('title','Profile Edit');
$smarty->assign('back','/anketa-'.$user['id']);
$smarty->assign('ok','Profile Edit');
$smarty->assign('nz','By form');
$smarty->display('header.tpl');
$smarty->display('ok.tpl');
$smarty->display('footer.tpl');
} else {
$smarty->assign('title','Error');
$smarty->assign('back','/anketa-'.$user['id']);
$smarty->assign('error','Contact the administrator');
$smarty->display('header.tpl');
$smarty->display('error.tpl');
$smarty->display('footer.tpl');
}

}
?>