Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // Start PHP.
- // Database Connection Info.
- $servername = getenv('IP');
- $username = 'jackmoss';
- $password = '';
- $database = 'title';
- // This line of code connects us to the database.
- $db = new mysqli($servername, $username, $password, $database);
- // This now checks that we have connected to the database.
- // If we have an error, it will run the die statement.
- if($db->connect_error) {
- // This die statement displays to the user that there was an error.
- die("Connection failed due to error: " . $db->connect_error);
- }
- // If we connected to the database, our statement will continue here.
- // This statement creates our query which will get the page title header from the database
- // and then post it back.
- $sql = "UPDATE titleHeader SET title = '".$_POST["title"]."'";
- // We will now query and store this data.
- $result = $db->query($sql);
- // This if statement checks that the data we have collected is usable.
- // If this data is not usable, it will display an error.
- if(!$result)
- {
- error_log("Error updating title: ".$result->error);
- echo error_log;
- }
- // The page will now refresh and show the new header.
- echo "<SCRIPT type='text/javascript'>
- window.location.replace(\"cms.php\");
- </SCRIPT>";
- exit();
- ?> <!-- End PHP -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement