Prevent E_NOTICE when game parameter is missing in queue cleanup
[stouyapi.git] / www / api / razer / session.php
1 <?php
2 /**
3  * Store the desired username during the login process
4  *
5  * It will be read by the Razer Forge TV when calling api/v1/gamers/me.
6  *
7  * @author Christian Weiske <cweiske@cweiske.de>
8  * @see    api/razer/session
9  * @see    api/v1/gamers/me
10  */
11
12 if (!isset($_POST['email'])) {
13     header('HTTP/1.0 400 Bad Request');
14     header('Content-type: application/json');
15     echo '{"error":{"message":"E-Mail missing","code": 2001}}' . "\n";
16     exit(1);
17 }
18 $email = $_POST['email'];
19
20 //we use the ouya username storage code here
21 // and simply use the part before the @ in the e-mail as username.
22 list($_POST['username']) = explode('@', $email);
23 require __DIR__ . '/../v1/sessions.php';