fixing some bugs
This commit is contained in:
@@ -2,4 +2,4 @@
|
|||||||
ngrok http 80 &
|
ngrok http 80 &
|
||||||
sleep 5
|
sleep 5
|
||||||
url=$(curl --silent --show-error http://127.0.0.1:4040/api/tunnels | sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p' )
|
url=$(curl --silent --show-error http://127.0.0.1:4040/api/tunnels | sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p' )
|
||||||
curl --silent "https://SYSTEM0_WEBSERVER_URL/system0/html/api/update_url.php?url=$url&id=ENTER_THE_ID_FOR_THIS_MACHINE_HERE&apikey=YOUR_SYSTEM0_APIKEY&octoapikey=OCTOPRINT_ADMIN_APIKEY"
|
curl --silent "https://SYSTEM0_WEBSERVER_URL/api/update_url.php?url=$url&id=ENTER_THE_ID_FOR_THIS_MACHINE_HERE&apikey=YOUR_SYSTEM0_APIKEY&octoapikey=OCTOPRINT_ADMIN_APIKEY"
|
||||||
|
|||||||
@@ -17,11 +17,9 @@ require_once "../waf/salt.php";
|
|||||||
require_once "keepmeloggedin.php";
|
require_once "keepmeloggedin.php";
|
||||||
include "../assets/components.php";
|
include "../assets/components.php";
|
||||||
$error=logmein($link);
|
$error=logmein($link);
|
||||||
|
|
||||||
if($error==="success")
|
if($error==="success")
|
||||||
{
|
{
|
||||||
header("LOCATION: /app/overview.php");
|
header("LOCATION: /app/overview.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define variables and initialize with empty values
|
// Define variables and initialize with empty values
|
||||||
@@ -83,7 +81,6 @@ if($_SERVER["REQUEST_METHOD"] == "POST" and $_GET["action"]=="login"){
|
|||||||
if($stmt = mysqli_prepare($link, $sql)){
|
if($stmt = mysqli_prepare($link, $sql)){
|
||||||
// Bind variables to the prepared statement as parameters
|
// Bind variables to the prepared statement as parameters
|
||||||
mysqli_stmt_bind_param($stmt, "s", $param_username);
|
mysqli_stmt_bind_param($stmt, "s", $param_username);
|
||||||
|
|
||||||
// Set parameters
|
// Set parameters
|
||||||
$param_username = htmlspecialchars($username);
|
$param_username = htmlspecialchars($username);
|
||||||
|
|
||||||
@@ -174,7 +171,6 @@ if($_SERVER["REQUEST_METHOD"] == "POST" and $_GET["action"]=="login"){
|
|||||||
}
|
}
|
||||||
// Processing form data when form is submitted and user wants to create new user
|
// Processing form data when form is submitted and user wants to create new user
|
||||||
if($_SERVER["REQUEST_METHOD"] == "POST" and $_GET["action"]=="create_user"){
|
if($_SERVER["REQUEST_METHOD"] == "POST" and $_GET["action"]=="create_user"){
|
||||||
|
|
||||||
// Validate username
|
// Validate username
|
||||||
if(empty(trim($_POST["username"]))){
|
if(empty(trim($_POST["username"]))){
|
||||||
$err = "Please enter a username.";
|
$err = "Please enter a username.";
|
||||||
@@ -190,12 +186,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST" and $_GET["action"]=="create_user"){
|
|||||||
|
|
||||||
// Set parameters
|
// Set parameters
|
||||||
$param_username = trim($_POST["username"]);
|
$param_username = trim($_POST["username"]);
|
||||||
|
|
||||||
// Attempt to execute the prepared statement
|
// Attempt to execute the prepared statement
|
||||||
if(mysqli_stmt_execute($stmt)){
|
if(mysqli_stmt_execute($stmt)){
|
||||||
/* store result */
|
/* store result */
|
||||||
mysqli_stmt_store_result($stmt);
|
mysqli_stmt_store_result($stmt);
|
||||||
|
|
||||||
if(mysqli_stmt_num_rows($stmt) == 1){
|
if(mysqli_stmt_num_rows($stmt) == 1){
|
||||||
$err = "This username is already taken.";
|
$err = "This username is already taken.";
|
||||||
} else{
|
} else{
|
||||||
|
|||||||
Reference in New Issue
Block a user