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:
james 2010-09-02 18:53:48 +00:00
parent 6963b7104b
commit 959843d4c4
2 changed files with 39 additions and 11 deletions

13
api.php
View File

@ -69,19 +69,20 @@ switch($request[0]) {
case "dates":
if($request[1]) {
$cid=intval($request[1]);
}
else
$cid=$_SESSION['conferences_id'];
$ret['status']="ok";
$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();
while($r=mysql_fetch_assoc($q)) {
$dates[]=$r;
}
$ret['conferences_id']=$cid;
$ret['dates']=$dates;
}
else {
$ret['status']="error";
$ret['error']="Conference ID is required";
}
break;
case "auth":

27
testapi.php Normal file
View 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>