web: prepared webpage for publishing

* renamed admin directory to php because adblocker blocked ajax
* don't refresh page when pressing enter
* improved english
* added db_config for live page
This commit is contained in:
Eberhard Graether
2015-05-27 12:24:18 +02:00
parent b0a5461316
commit f8d3f14cbd
6 changed files with 48 additions and 35 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
header('Content-type: application/json');
$response_array['status'] = 'error';
$email = $_POST["email"];
$regex = "/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/";
if (preg_match($regex, $email))
{
include("db_config.php");
$link = new mysqli($servername, $username, $password, $dbname);
if (mysqli_connect_errno())
{
exit();
}
$email = mysqli_real_escape_string($link, $email);
if (mysqli_query($link, "INSERT INTO " . $tabename . " (`id`, `mail`) VALUES (0, '$email')"))
{
$response_array['status'] = 'success';
}
$link->close();
}
else
{
$response_array['status'] = 'error_invalid_email';
}
echo(json_encode($response_array));
?>