/** * Check whether the contest is registered * @param type $cid * @return type */ function is_contest_registered($cid) { global $login_uid; global $logged; if (!$logged) { return false; } $reg = new ContestRegistrationTbl(); return $reg->GetByFields(array('uid' => $login_uid, 'cid' => $cid)); }
/** * Get all the contests registered * @global type $login_uid * @global type $logged * @return type */ function get_contests_reg() { global $login_uid; global $logged; if (!$logged) { return FALSE; } $reg = new ContestRegistrationTbl(); if (!$reg->GetByField("uid", $login_uid)) { return array(); } $cidlist = array(); do { $cidlist[] = intval($reg->detail['cid']); } while ($reg->MoreRows()); return $cidlist; }
if (!$user->GetByField('username', $user->detail['username'])) { $user->detail['perm'] = $perm; $user->detail["reg_time"] = date("Y.m.d G:i:s"); $user->detail['password'] = md5($user->detail['password']); $id = $user->Add(); echo "New ID {$id}"; } else { $id = $user->detail['uid']; echo "User {$id} "; $olduser = new UserTbl($id); $olduser->update = $storage; $olduser->update['perm'] = $perm; $olduser->update['password'] = md5($storage['password']); $olduser->Update(); } $reg = new ContestRegistrationTbl(); if (!$reg->GetByFields(array("uid" => $id, "cid" => $cid))) { $reg->detail['uid'] = $id; $reg->detail['cid'] = $cid; $reg->Add(); echo " Added"; } else { echo " Already imported"; } } else { if ($user->GetByField('username', $user->detail['username'])) { echo "Exists"; } else { echo "Ok"; } }