Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>SQL Test</title>
- <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <div class="container">
- <h2>SQL Test</h2>
- <?php
- function generateRandomString($length = 10) {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[rand(0, strlen($characters) - 1)];
- }
- return $randomString;
- }
- $con = mysqli_connect("mariadb","super","AXpbZ5XlkL8i1KT9","test");
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $randtxt = generateRandomString();
- $randint = rand(0, 2147483647);
- mysqli_query($con,"INSERT INTO table_1(col1, col2) VALUES ('$randtxt', $randint);");
- $result = mysqli_query($con,"SELECT * FROM table_1;");
- echo "<table class=\"table table-hover\">";
- echo "<tr><th>Text</th>";
- #echo "<th>B64 decode</th>";
- echo "<th>Number</th>";
- #echo "<th>Fraction</th></tr>";
- while($row = mysqli_fetch_array($result)) {
- echo "<tr>";
- echo "<td>" . $row['col1'] . "</td>";
- #echo "<td>" . base64_decode($row['col1']) . "</td>";
- echo "<td>" . $row['col2'] . "</td>";
- #echo "<td>" . $row['col2'] / 2147483647 . "</td>";
- echo "</tr>\n";
- }
- echo "</table>";
- mysqli_close($con);
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement