Пример #1
0
function dup_text( $dc1, $dc2, $text_id ) {
	$text = read_text( $dc1, $text_id );
	$id = write_text( $dc2, $text );
	return $id;
}
Пример #2
0
 public function register_participant(array $dbarray)
 {
     $dbhandle = $this->connection;
     $default_perm = 0;
     function read_text($instr)
     {
         $instr = trim($instr);
         $instr = stripslashes($instr);
         $instr = htmlspecialchars($instr);
         return $instr;
     }
     $dbarray['name'] = read_text($dbarray['name']);
     $dbarray['number'] = read_text($dbarray['number']);
     $dbarray['college_id'] = read_text($dbarray['college_id']);
     $dbarray['event_id'] = read_text($dbarray['event_id']);
     $qry = $dbhandle->prepare("INSERT INTO `users` (`name`,`eid`,`cid`,`phone`,`permission`) VALUES(?,?,?,?,?)");
     $qry->bind_param("sssss", $dbarray['name'], $dbarray['event_id'], $dbarray['college_id'], $dbarray['number'], $default_perm);
     $qry->execute();
     $qry->close();
     return 0;
 }
Пример #3
0
 public function college_register(array $dbarray)
 {
     $dbhandle = $this->connection;
     function read_text($instr)
     {
         $instr = trim($instr);
         $instr = stripslashes($instr);
         $instr = htmlspecialchars($instr);
         return $instr;
     }
     $id = 0;
     $dbarray['college_name'] = read_text($dbarray['college_name']);
     $dbarray['contact_email'] = read_text($dbarray['contact_email']);
     $dbarray['college_code'] = read_text($dbarray['college_code']);
     if ($dbarray['college_name'] != '' && $dbarray['contact_email'] != '' && $dbarray['college_code'] != '') {
         $dbhandle = new mysqli($this->db_addr, $this->db_user, $this->db_pw, $this->db_name);
         if ($dbhandle->connect_error) {
             die("Connection Failed: " . $dbhandle->connect_error);
         } else {
             $q = "SELECT * FROM `college` WHERE `email` ='" . $dbarray['contact_email'] . "' LIMIT 1";
             $result = $dbhandle->query($q);
             if (!$result->num_rows) {
                 $qry = "INSERT INTO `college` (`college_name`,`email`,`code`) VALUES('" . $dbarray['college_name'] . "','" . $dbarray['contact_email'] . "','" . $dbarray['college_code'] . "')";
                 $dbhandle->query($qry);
                 $_SESSION['college_registeration'] = 1;
                 $_SESSION['college_name'] = $dbarray['college_name'];
                 $_SESSION['college_code'] = $dbarray['college_code'];
                 $id = $dbhandle->insert_id;
             }
         }
         return $id;
     } else {
         return -1;
     }
 }
Пример #4
0
 public function register_participant(array $dbarray)
 {
     $dbhandle = $this->connection;
     $default_perm = 1;
     function read_text($instr)
     {
         $instr = trim($instr);
         $instr = stripslashes($instr);
         $instr = htmlspecialchars($instr);
         return $instr;
     }
     $dbarray['name'] = read_text($dbarray['name']);
     $dbarray['number'] = read_text($dbarray['number']);
     $dbarray['college_id'] = read_text($dbarray['college_id']);
     $dbarray['event_id'] = read_text($dbarray['event_id']);
     if ($dbarray['name'] != '') {
         $qry = "INSERT INTO `users` (`name`,`eid`,`cid`,`phone`,`permission`) VALUES('" . $dbarray['name'] . "'," . $dbarray['event_id'] . "," . $dbarray['college_id'] . ",'" . $dbarray['number'] . "'," . $default_perm . ")";
         $dbhandle->query($qry);
     }
     return 0;
 }