function SaveUser($data) { global $MDL, $GV; $MDL->Load("smadbis"); $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]); $user = $BILL->GetUserData($data["id"]); $user[user] = $data["login"]; $user[password] = $data["passwd"]; $user[email] = $data["email"]; $user[add_date] = norm_date_yymmdd($data["regdate"]); $user[nick] = $data["nick"]; $user[gender] = $data["gender"]; //$user[address] = $data["address"]; $user[icq] = $data["icq"]; $user[url] = $data["url"]; $user[rang] = $data["rang"]; $user[group] = $data["group"]; $user[city] = $data["city"]; $user[country] = $data["country"]; $user[raiting] = $data["raiting"]; $user[signature] = $data["signature"]; $user[info] = $data["info"]; return $BILL->UpdateUser($data["id"], $user); /* $string=$user['login'].$this->chr1. $user['passwd'].$this->chr1. $user['nick'].$this->chr1. $user['gender'].$this->chr1. $user['email'].$this->chr1. $user['url'].$this->chr1. $user['icq'].$this->chr1. $user['regdate'].$this->chr1. $user['rang'].$this->chr1. $user['group'].$this->chr1. $user['raiting'].$this->chr1. $user['country'].$this->chr1. $user['city'].$this->chr1. $user['signature'].$this->chr1. $user["info"].$this->chr1; $fp=fopen("$this->data_dir/".$user['id'],"w+"); fwrite($fp,$string); fclose($fp); //OUT("<textarea cols=30 rows=5>$string</textarea>"); include $this->list_file; $USERS_IDS[$user['login']]=$user['id']; for($i=0;$i<count($USERS);++$i) {if($USERS[$i]["id"]==$user['id'])$USERS[$i]["login"]=$user['login'];} $string="<?php\r\n"; for($i=0;$i<count($USERS);++$i) { $string.="\$USERS[\"".$i."\"][\"id\"]=\"".$USERS[$i]["id"]."\";\r\n"; $string.="\$USERS[\"".$i."\"][\"login\"]=\"".$USERS[$i]["login"]."\";\r\n"; $string.="\$USERS_IDS[\"".$USERS[$i]["login"]."\"]=\"".$USERS[$i]["id"]."\";\r\n"; } $string.="?>"; //OUT("<textarea cols=30 rows=5>$string</textarea>"); $fp=fopen($this->list_file,"w+"); fwrite($fp,$string); fclose($fp); */ }
function AddUser($user) { global $GV, $CURRENT_USER; /* uid - ДЗПУ (скорее всего используется функция time() ) - user + password + crypt_method - взять один из них (посмотреть как сделано в NIBS и что при этом добавляется в - таблицу. Лучше использовать MD5) gid + fio + phone + address + prim - ДЗПУ + add_date + add_uid ( Alter table users add (`add_uid` after `add_date`);... ) + expired - ДЗПУ + */ if ($this->IsUserExists($user['user'])) { return "Ошибка, данный логин уже занят!"; } $query = "Insert into `" . $GV["users_tbl"] . "`(`user`,`password`,`gid`,`fio`,`phone`,`address`,`prim`,`add_uid`,`nick`,`gender`,`email`,`icq`,`url`,`rang`,`group`,`city`,`country`,`raiting`,`signature`,`info`,`add_date`\r\n ,`max_total_traffic`,`max_month_traffic`,`max_week_traffic`,`max_day_traffic`,`simultaneous_use`) values ('" . $user['user'] . "','" . $user['password'] . "'," . $user['gid'] . ",'" . $user['fio'] . "','" . $user['phone'] . "','" . $user['address'] . "','" . $user['prim'] . "'," . $user['add_uid'] . ",'" . $user['nick'] . "'," . $user['gender'] . ",'" . $user['email'] . "','" . $user['icq'] . "','" . $user['url'] . "','" . $user['rang'] . "','" . $user['group'] . "','" . $user['city'] . "','" . $user['country'] . "'," . $user['raiting'] . ",'" . $user['signature'] . "','" . $user['info'] . "','" . norm_date_yymmdd(time()) . "'," . $user['max_total_traffic'] . "," . $user['max_month_traffic'] . "," . $user['max_week_traffic'] . "," . $user['max_day_traffic'] . "," . $user['simultaneous_use'] . ");"; $result = mysql_query($query, $this->link) or die("Invalid query(Add User): " . mysql_error()); //Журналирование событий $data["uid"] = $CURRENT_USER["id"]; $data["event"] = "Добавление пользователя: " . $user["user"]; $data["date"] = norm_date_yymmddhhmmss(time()); $this->AddEvent($data); radius_restart(); return ""; }