예제 #1
0
 private function login_internal($config, $name, $password)
 {
     $mg = mg_connect($config, "", "", "");
     if ($mg) {
         $stmt = new mg_stmt_select($mg, "users");
         $query_username = array('user_name' => $name);
         if (isset($password) && !empty($password)) {
             $query_password = array('$or' => array(array('user_password' => md5($password)), array('user_password' => $password)));
             $query = array('$and' => array($query_username, $query_password));
         } else {
             $query = $query_username;
         }
         $stmt->setQuery($query);
         $count = $stmt->execute();
         if ($count == 1) {
             $cursor = $stmt->getCursor();
             $rs = $cursor->getNext();
             $this->id = $rs["id"];
             $this->name = $rs["user_name"];
             $this->level = intval($rs["user_level"]);
             $this->id_account = $rs["id_account"];
             $this->change_password = $rs["change_password_next_logon"] == "1";
             // mise a jour login_lasttime
             $stmt = new mg_stmt_update($mg, "users");
             $stmt->addColumnValueDate("login_lasttime");
             $stmt->setQuery(array('id' => $this->id));
             $stmt->execute();
             return true;
         }
     }
     return false;
 }
 $mg = mg_connect($config, "", "", "");
 if ($mg) {
     $stmt = new mg_stmt_update($mg, "sources");
     $query = array("id" => intval($_GET["id"]));
     $stmt->setQuery($query);
     if ($action == "stopsource") {
         $stmt->addColumnValue("crawl_process_status", "5");
     }
     if ($action == "pausesource") {
         $stmt->addColumnValue("crawl_process_status", "2");
     }
     if ($action == "resumesource") {
         $stmt->addColumnValue("crawl_process_status", "3");
         $stmt->addColumnValue("crawl_priority", "1");
     }
     $stmt->addColumnValueDate("crawl_nexttime");
     $stmt->execute();
     /*
     if (!$rs)
     {
     	$res = "Error";
     }
     else
     {
     	$res = "Success";
     }
     */
     $res = "Success";
 }
 print $res;
 exit;