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
13
api.php
13
api.php
@ -69,19 +69,20 @@ switch($request[0]) {
|
|||||||
|
|
||||||
case "dates":
|
case "dates":
|
||||||
if($request[1]) {
|
if($request[1]) {
|
||||||
|
$cid=intval($request[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$cid=$_SESSION['conferences_id'];
|
||||||
|
|
||||||
$ret['status']="ok";
|
$ret['status']="ok";
|
||||||
$ret['dates']=array();
|
$ret['dates']=array();
|
||||||
$q=mysql_query("SELECT date,name,description FROM dates WHERE conferences_id='{$request[1]}' ORDER BY date");
|
$q=mysql_query("SELECT date,name,description FROM dates WHERE conferences_id='$cid' ORDER BY date");
|
||||||
$dates=array();
|
$dates=array();
|
||||||
while($r=mysql_fetch_assoc($q)) {
|
while($r=mysql_fetch_assoc($q)) {
|
||||||
$dates[]=$r;
|
$dates[]=$r;
|
||||||
}
|
}
|
||||||
|
$ret['conferences_id']=$cid;
|
||||||
$ret['dates']=$dates;
|
$ret['dates']=$dates;
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ret['status']="error";
|
|
||||||
$ret['error']="Conference ID is required";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "auth":
|
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…
x
Reference in New Issue
Block a user