forked from science-ation/science-ation
Add a simple API test page for checking some api calls
Update /api/dates to use current conference id if one isnt specificed
This commit is contained in:
parent
6963b7104b
commit
959843d4c4
23
api.php
23
api.php
@ -69,19 +69,20 @@ switch($request[0]) {
|
||||
|
||||
case "dates":
|
||||
if($request[1]) {
|
||||
$ret['status']="ok";
|
||||
$ret['dates']=array();
|
||||
$q=mysql_query("SELECT date,name,description FROM dates WHERE conferences_id='{$request[1]}' ORDER BY date");
|
||||
$dates=array();
|
||||
while($r=mysql_fetch_assoc($q)) {
|
||||
$dates[]=$r;
|
||||
}
|
||||
$ret['dates']=$dates;
|
||||
$cid=intval($request[1]);
|
||||
}
|
||||
else {
|
||||
$ret['status']="error";
|
||||
$ret['error']="Conference ID is required";
|
||||
else
|
||||
$cid=$_SESSION['conferences_id'];
|
||||
|
||||
$ret['status']="ok";
|
||||
$ret['dates']=array();
|
||||
$q=mysql_query("SELECT date,name,description FROM dates WHERE conferences_id='$cid' ORDER BY date");
|
||||
$dates=array();
|
||||
while($r=mysql_fetch_assoc($q)) {
|
||||
$dates[]=$r;
|
||||
}
|
||||
$ret['conferences_id']=$cid;
|
||||
$ret['dates']=$dates;
|
||||
break;
|
||||
|
||||
case "auth":
|
||||
|
27
testapi.php
Normal file
27
testapi.php
Normal file
@ -0,0 +1,27 @@
|
||||
<html><body>
|
||||
|
||||
Login Check
|
||||
<form method="post" action="api/auth/login">
|
||||
<input type="text" name="username">
|
||||
<input type="password" name="password">
|
||||
<input type="submit" value="Login">
|
||||
</form>
|
||||
|
||||
Logout Check
|
||||
<form method="post" action="api/auth/logout">
|
||||
<input type="submit" value="Logout">
|
||||
</form>
|
||||
|
||||
<a href="api/conferences">Conference List</a><br />
|
||||
Switch Conference Check
|
||||
<form method="post" action="api/conferences/switch">
|
||||
<input type="text" size=2 name="conferences_id">
|
||||
<input type="submit" value="Switch Conference">
|
||||
</form>
|
||||
|
||||
<a href="api/dates">Dates List (current conference)</a><br />
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user