mirror of
https://github.com/jsbin/jsbin.git
synced 2026-01-18 15:18:04 +00:00
Move php to own directory
This commit is contained in:
parent
82376e483a
commit
8564e0701e
11
php/app.php
11
php/app.php
@ -156,6 +156,7 @@ if (!$action) {
|
||||
$sql = sprintf('select * from ownership where name="%s"', mysql_real_escape_string($name));
|
||||
$result = mysql_query($sql);
|
||||
$ok = false;
|
||||
$created = false;
|
||||
|
||||
header('content-type: application/json');
|
||||
|
||||
@ -163,9 +164,11 @@ if (!$action) {
|
||||
// store and okay (note "key" is a reserved word - typical!)
|
||||
$key = $bcrypt->hash($key);
|
||||
$sql = sprintf('insert into ownership (`name`, `key`, `email`, `last_login`, `created`, `updated`) values ("%s", "%s", "%s", NOW(), NOW(), NOW())', mysql_real_escape_string($name), mysql_real_escape_string($key), mysql_real_escape_string($email));
|
||||
$ok = mysql_query($sql);
|
||||
if ($ok) {
|
||||
echo json_encode(array('ok' => true, 'created' => true));
|
||||
$result = mysql_query($sql);
|
||||
if ($result) {
|
||||
$ok = true;
|
||||
$created = true;
|
||||
// echo json_encode(array('ok' => true, 'created' => true));
|
||||
} else {
|
||||
echo json_encode(array('ok' => false, 'error' => mysql_error()));
|
||||
}
|
||||
@ -205,7 +208,7 @@ if (!$action) {
|
||||
)));
|
||||
$hash = session_hash($data);
|
||||
setcookie('session', $hash . $data, time() + 60 * 60 * 24 * 30, '/', null, false, true);
|
||||
echo json_encode(array('ok' => true, 'created' => false));
|
||||
echo json_encode(array('ok' => true, 'created' => $created));
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ echo $mustache->render($view, array(
|
||||
'home' => $home,
|
||||
'revision' => $revision,
|
||||
'code_id' => $code_id,
|
||||
'url' => $_SERVER['REQUEST_URI'],
|
||||
'code_id_path' => $code_id_path,
|
||||
'code_id_domain' => $code_id_domain,
|
||||
'json_template' => json_encode(array(
|
||||
@ -51,7 +52,7 @@ echo $mustache->render($view, array(
|
||||
'production?' => IS_PRODUCTION,
|
||||
'analytics_id' => ANALYTICS_ID,
|
||||
'embed' => $embed,
|
||||
'tips' => file_get_contents('tips.json'),
|
||||
'tips' => file_get_contents('../public/tips.json'),
|
||||
'list_history' => $embed ? '' : $list_history,
|
||||
'jsbin' => json_encode(array(
|
||||
'root' => ROOT,
|
||||
|
||||
@ -8,7 +8,9 @@ if ($pos !== false) $pos = strlen(PATH);
|
||||
|
||||
$request_uri = substr($_SERVER['REQUEST_URI'], $pos);
|
||||
$filePath = '/' . preg_replace('/\?.*/', '', $request_uri);
|
||||
|
||||
|
||||
chdir('../public');
|
||||
|
||||
// prepare sprocket
|
||||
$sprocket = new Sprocket($filePath, array(
|
||||
'contentType' => 'application/x-javascript',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user