File indexing completed on 2024-12-22 05:33:23

0001 <?php
0002 
0003 include("gfx3/lib.php");
0004 
0005 $prevpage = EPageProperties::get_previous_page();
0006 
0007 
0008 $login = EHeaderDataParser::db_post("login");
0009 $password = EHeaderDataParser::db_post("password");
0010 $email = EHeaderDataParser::db_post("email");
0011 $firstname = EHeaderDataParser::db_post("firstname");
0012 $lastname = EHeaderDataParser::db_post("lastname");
0013 
0014 $postdata = array(
0015   "login" => $login,
0016   "password" => $password,
0017   "email" => $email,
0018   "firstname" => $firstname,
0019   "lastname" => $lastname
0020   );
0021 
0022 $client = new OCSClient(EConfig::$data["ocs"]["host"]);
0023 $check = $client->post("v1/person/add",$postdata);
0024 
0025 if($check["ocs"]["meta"]["statuscode"]=="100"){
0026   
0027   // add a post variable to be inserted
0028   EHeaderDataParser::add_post("tgroup","user");
0029   
0030   //wrapper
0031   $users = new EData("ocs_person");
0032   $users->insert(array("login","password","email","firstname","lastname","tgroup"));
0033   
0034   header("Location: $prevpage?e=Registration%20completed!");
0035   
0036 } else {
0037   // redirecting to main page
0038   $message = $check["ocs"]["meta"]["message"];
0039   $message = str_replace(" ","%20",$message);
0040   header("Location: $prevpage?e=".$message);
0041   
0042 }
0043 
0044 ?>