Просмотр файла pages/info_edit.php

Размер файла: 5.35Kb
<?php
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
// Sitchi CMS - Mobile Content Management System //
// The author:  Nikoloz Sitchinava [sitchi]      //
// Link:        http://sitchicms.num.ge          //
// Skype:       SitchiCMS                        //
// License:     LICENSE.txt (see attached file)  //
// Version:     VERSION.txt (see attached file)  //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
define('_SITCHICMS', 1);
$root_path='../';
require $root_path.'includes/db_connect.php';
require $root_path.'includes/start.php';
require $root_path.'includes/header.php';
require $root_path.'includes/functions.php';
require $root_path.'includes/head.php'; // თავი
$lng_info = load_lng('info');
head($lng_info['1_21'].' | '.$user['login']);
echo'<div class="hdr"><b>'.$lng_info['1_21'].'</b></div>';
aut_off();
if (isset($_POST['save']))
{
if (isset($_POST['name']) && preg_match('#^([A-zა-ჰ \-]*)$#ui', $_POST['name']))
{
$user['name']=$_POST['name'];
mysql_query("UPDATE `users` SET `name` = '".mres($user['name'])."' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_6'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['country']) && preg_match('#^([A-zა-ჰ \-]*)$#ui', $_POST['country']))
{
$user['country']=$_POST['country'];
mysql_query("UPDATE `users` SET `country` = '".mres($user['country'])."' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_7'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['city']) && preg_match('#^([A-zა-ჰ \-]*)$#ui', $_POST['city']))
{
$user['city']=$_POST['city'];
mysql_query("UPDATE `users` SET `city` = '".mres($user['city'])."' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_8'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['chemze']) && preg_match('#^([A-zა-ჰ \-]*)$#ui', $_POST['chemze']))
{
$user['chemze']=$_POST['chemze'];
mysql_query("UPDATE `users` SET `chemze` = '".mres($user['chemze'])."' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_13'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['email']) && ($_POST['email']==null || preg_match('#^[a-z0-9\-\._]+\@([a-z0-9]+\.)+([a-z0-9]{2,4})$#ui',$_POST['email'])))
{
$user['email']=$_POST['email'];
mysql_query("UPDATE `users` SET `email` = '$user[email]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_15'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['number']) && (is_numeric($_POST['number']) && strlen($_POST['number'])>=5 && strlen($_POST['number'])<=11 || $_POST['number']==NULL))
{
$user['number']=$_POST['number'];
mysql_query("UPDATE `users` SET `number` = '$user[number]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_17'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['skype']))
{
$user['skype']=$_POST['skype'];
mysql_query("UPDATE `users` SET `skype` = '$user[skype]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_16'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['icq']) && (is_numeric($_POST['icq']) && strlen($_POST['icq'])>=5 && strlen($_POST['icq'])<=9 || $_POST['icq']==NULL))
{
$user['icq']=$_POST['icq'];
if ($user['icq']==null)$user['icq']='null';
mysql_query("UPDATE `users` SET `icq` = $user[icq] WHERE `id` = '$user[id]' LIMIT 1");
if ($user['icq']=='null')$user['icq']=NULL;
}else $err[] = '<div class="errmenu">'.$lng_info['1_18'].' '.$lng_info['1_29'].'</div>';
if (isset($_POST['site']) && ($_POST['site']==null || preg_match('#^[-a-z0-9_\.]+[-a-z0-9_\.]+[_-a-Z0-9\.]?#i', $_POST['site'])))
{
$user['site']=$_POST['site'];
mysql_query("UPDATE `users` SET `site` = '$user[site]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[] = '<div class="errmenu">'.$lng_info['1_19'].' '.$lng_info['1_29'].'</div>';
if (!isset($err))msg('<div class="menu">'.$lng_info['1_27'].'</div>');
}
err();
echo'<div class="egmenu"><form method="POST" action="?">' .
''.$lng_info['1_6'].'(max 64):<br/><input type="text" name="name" value="'.$user['name'].'" maxlength="64" /><br/>' .
''.$lng_info['1_7'].'(max 32):<br/><input type="text" name="country" value="'.$user['country'].'" maxlength="32" /><br/>' .
''.$lng_info['1_8'].'(max 32):<br/><input type="text" name="city" value="'.$user['city'].'" maxlength="32" /><br/>' .
''.$lng_info['1_13'].'(max 128):<br/><input type="text" name="chemze" value="'.$user['chemze'].'" maxlength="128" /><br/>' .
''.$lng_info['1_15'].':<br/><input type="text" name="email" value="'.$user['email'].'" maxlength="50" /><br/>' .
''.$lng_info['1_17'].'(max 11):<br/><input type="text" name="number" value="'.$user['number'].'" maxlength="11" /><br/>' .
''.$lng_info['1_16'].'(max 32):<br/><input type="text" name="skype" value="'.$user['skype'].'" maxlength="32" /><br/>' .
''.$lng_info['1_18'].'(max 9):<br/><input type="text" name="icq" value="'.$user['icq'].'" maxlength="9" /><br/>' .
''.$lng_info['1_19'].'(max 64)(http://'.$lng['1_9'].'):<br/><input type="text" name="site" value="'.$user['site'].'" maxlength="64" /><br/>' .
'<input type="submit" name="save" value="'.$lng['1_53'].'" /></form></div>'; 
if (isset($_SERVER['HTTP_REFERER']))
echo'<a href="'.htmlspecialchars($_SERVER['HTTP_REFERER']).'"> '.$lng['1_50'].'</a>';
require $root_path.'includes/end.php'; // დასასრული
?>