Compare commits
No commits in common. "350ca288ff2afa91b19ba97ee71c9d002ddf209c" and "31f826e1cba79a4f83577430ffcdf7947c1ad8d4" have entirely different histories.
350ca288ff
...
31f826e1cb
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
include "../../config.php";
|
|
||||||
|
|
||||||
if (isset($_GET['token'])){
|
|
||||||
$sql = "SELECT * FROM tokens INNER JOIN users ON users.id=tokens.user WHERE token=?";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
$stmt->bindParam(1, $_GET['token']);
|
|
||||||
if ($stmt->execute()){
|
|
||||||
if ($stmt->rowCount() == 1){
|
|
||||||
if(isset($_POST['workout']) and isset($_POST['exercise']) and isset($_POST['amount']) and isset($_POST['sets'])){
|
|
||||||
$sql = "INSERT INTO `exercises_in_workout`(`workout_routine`, `workout_type`, `amount`, `sets`) VALUES (?,?,?,?)";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
$stmt->bindParam(1, $_POST['workout']);
|
|
||||||
$stmt->bindParam(2, $_POST['exercise']);
|
|
||||||
$stmt->bindParam(3, $_POST['amount']);
|
|
||||||
$stmt->bindParam(4, $_POST['sets']);
|
|
||||||
if ($stmt->execute()){
|
|
||||||
echo 'success';
|
|
||||||
}else{
|
|
||||||
var_dump($stmt->errorInfo());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
echo "missing parameters";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
echo 'login failed';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
include "../../config.php";
|
|
||||||
|
|
||||||
if (isset($_GET['token'])){
|
|
||||||
$sql = "SELECT * FROM tokens INNER JOIN users ON users.id=tokens.user WHERE token=?";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
$stmt->bindParam(1, $_GET['token']);
|
|
||||||
if ($stmt->execute()){
|
|
||||||
if ($stmt->rowCount() == 1){
|
|
||||||
$sql = "select user from tokens where token=?";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
$stmt->bindParam(1, $_GET['token']);
|
|
||||||
if ($stmt->execute()){
|
|
||||||
$uid = $stmt->fetchAll(PDO::FETCH_ASSOC)[0]['user'];
|
|
||||||
if (isset($_POST['name'])){
|
|
||||||
$sql = "INSERT INTO `workout_routines`(`creator`, `title`, `public`) VALUES (?,?,0)";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
$stmt->bindParam(1, $uid);
|
|
||||||
$stmt->bindParam(2, $_POST['name']);
|
|
||||||
if ($stmt->execute()){
|
|
||||||
echo 'sucess';
|
|
||||||
}else{
|
|
||||||
var_dump($stmt->errorInfo());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user