2022-08-08 11:43:57 +00:00
< ? php
2022-08-07 11:57:13 +00:00
/*
2022-08-08 11:43:57 +00:00
|-------------------------------------------------------------
| Edit Author
|-------------------------------------------------------------
| If this has security problems I ' m so fucked
|-------------------------------------------------------------
2022-08-07 11:57:13 +00:00
*/
2022-08-08 11:43:57 +00:00
session_start ();
// Include server connection
include " ../server/conn.php " ;
2022-08-07 11:57:13 +00:00
2022-08-08 11:43:57 +00:00
if ( isset ( $_POST [ 'submit' ])) {
// If user has the ID of 1
if ( $_SESSION [ 'id' ] == 1 ) {
// getting ready forSQL asky asky
$sql = " UPDATE swag_table SET author=? WHERE id=? " ;
2022-08-07 11:57:13 +00:00
2022-08-08 11:43:57 +00:00
// Checking if databse is doing ok
if ( $stmt = mysqli_prepare ( $conn , $sql )) {
mysqli_stmt_bind_param ( $stmt , " si " , $param_author , $param_id );
2022-08-07 11:57:13 +00:00
2022-08-08 11:43:57 +00:00
// Setting parameters
$param_author = $_POST [ 'input' ];
$param_id = $_POST [ " id " ];
2022-08-07 11:57:13 +00:00
2022-08-08 11:43:57 +00:00
// Attempt to execute the prepared statement
if ( mysqli_stmt_execute ( $stmt )) {
?>
< script >
sniffleAdd ( 'Success!!!' , 'The Author has been updated successfully! You may need to refresh the page to see the new information.' , 'var(--green)' , '<?php echo $root_dir; ?>assets/icons/check.svg' );
flyoutClose ();
</ script >
< ? php
} else {
?>
< script >
sniffleAdd ( 'Oopsie....' , 'An error occured on the servers' , 'var(--red)' , '<?php echo $root_dir; ?>assets/icons/cross.svg' );
flyoutClose ();
</ script >
< ? php
}
2022-08-07 11:57:13 +00:00
}
2022-08-08 11:43:57 +00:00
} else {
?>
< script >
sniffleAdd ( 'Denied' , 'Sussy wussy.' , 'var(--red)' , '<?php echo $root_dir; ?>assets/icons/cross.svg' );
flyoutClose ();
</ script >
< ? php
2022-08-07 11:57:13 +00:00
}
}