Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
CREATE DATABASE StudentDB; USE StudentDB; CREATE TABLE Students ( id INT AUTO_INC..
Decoded Output download
CREATE DATABASE StudentDB;
USE StudentDB;
CREATE TABLE Students (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
course VARCHAR(255) NOT NULL
);
<!DOCTYPE html>
<html>
<head>
<title>Student Registration</title>
</head>
<body>
<h1>Student Registration Form</h1>
<form action="process.php" method="post">
<label>Name:</label>
<input type="text" name="name" required><br><br>
<label>Email:</label>
<input type="email" name="email" required><br><br>
<label>Course:</label>
<input type="text" name="course" required><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
<?php
// Database connection settings
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "StudentDB";
// Create a connection to MySQL
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Retrieve form data
$name = $_POST['name'];
$email = $_POST['email'];
$course = $_POST['course'];
// Insert data into the Students table
$sql = "INSERT INTO Students (name, email, course) VALUES ('$name', '$email', '$course')";
if ($conn->query($sql) === TRUE) {
echo "Registration successful!";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
// Close the database connection
$conn->close();
?>
Did this file decode correctly?
Original Code
CREATE DATABASE StudentDB;
USE StudentDB;
CREATE TABLE Students (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
course VARCHAR(255) NOT NULL
);
<!DOCTYPE html>
<html>
<head>
<title>Student Registration</title>
</head>
<body>
<h1>Student Registration Form</h1>
<form action="process.php" method="post">
<label>Name:</label>
<input type="text" name="name" required><br><br>
<label>Email:</label>
<input type="email" name="email" required><br><br>
<label>Course:</label>
<input type="text" name="course" required><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
<?php
// Database connection settings
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "StudentDB";
// Create a connection to MySQL
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Retrieve form data
$name = $_POST['name'];
$email = $_POST['email'];
$course = $_POST['course'];
// Insert data into the Students table
$sql = "INSERT INTO Students (name, email, course) VALUES ('$name', '$email', '$course')";
if ($conn->query($sql) === TRUE) {
echo "Registration successful!";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
// Close the database connection
$conn->close();
?>
Function Calls
None |
Stats
MD5 | 019875a35e35d609c5b25970d8f32f13 |
Eval Count | 0 |
Decode Time | 55 ms |