Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "USER";
- $password = "PASSW";
- $dbname = "db1";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if (isset($_GET['log']) && $_GET['log'] === 'show') {
- $sql = "SELECT * FROM `log`";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- print "<h1>Log</h1><pre>";
- while($row = $result->fetch_assoc()) {
- print_r($row);
- }
- print "</pre><h1>End</h1>";
- }
- } else {
- $sql = "INSERT INTO `log` (data, data2, data3, data4) VALUES ('" . $_SERVER['HTTP_CLIENT_IP'] . "', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $_SERVER['HTTP_X_FORWARDED_FOR'] . "', '" . $_SERVER['HTTP_REFERER'] . "');";
- if ($conn->query($sql) === TRUE) {
- echo "Loading...";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- $conn->close();
- header('Location: https://trexi.webnode.cz');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement