Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost:3306";
- $username = "root";
- $password = "";
- $dbname = "untold";
- // Create connection
- $conn = new mysqli($servername, $username, $password,$dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $nume = $_POST['Nume'];
- $prenume = $_POST['Prenume'];
- $varsta = $_POST['Varsta'];
- $cnp = $_POST['CNPa'];
- if($nume==='' || $prenume==='' || $varsta==='' || is_numeric($nume) || is_numeric($prenume) || !is_numeric($varsta) || !is_numeric($cnp) || strlen($cnp)!='13')
- trigger_error("VALORI INVALIDE", E_USER_ERROR);
- $sql= "Select CNP from Spectatori";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0)
- {
- while($row = mysqli_fetch_assoc($result)) {
- if($row["CNP"]===$cnp)
- trigger_error("CNP-ul exista deja inserat!", E_USER_ERROR);
- }
- }
- $sql = "INSERT INTO Spectatori (Nume, P_nume, Varsta,CNP)
- VALUES ('$nume', '$prenume', '$varsta','$cnp')";
- if (mysqli_query($conn, $sql)) {
- }
- else
- {
- echo "Error: " . $sql . "<br>" . mysqli_error($conn);
- }
- $sql="ALTER TABLE Spectatori DROP ID_spect";
- mysqli_query($conn, $sql);
- $sql="ALTER TABLE Spectatori AUTO_INCREMENT = 1";
- mysqli_query($conn, $sql);
- $sql="ALTER TABLE Spectatori ADD ID_spect int UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST";
- mysqli_query($conn, $sql);
- mysqli_close($conn);
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- body {
- background-image: url("untold-2017.jpg");
- background-size:cover;
- }
- poztit {
- position: fixed;
- left: 500px;
- top: 20px;
- }
- poz1 {
- position:fixed;
- left: 570px;
- top: 270px;
- }
- poz2 {
- position:fixed;
- top: 100px;
- left: 350px;
- }
- .btn {
- background: #3498db;
- background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
- background-image: -moz-linear-gradient(top, #3498db, #2980b9);
- background-image: -ms-linear-gradient(top, #3498db, #2980b9);
- background-image: -o-linear-gradient(top, #3498db, #2980b9);
- background-image: linear-gradient(to bottom, #3498db, #2980b9);
- -webkit-border-radius: 28;
- -moz-border-radius: 28;
- border-radius: 28px;
- font-family: Arial;
- color: #ffffff;
- font-size: 27px;
- padding: 10px 20px 10px 20px;
- text-decoration: none;
- }
- </style>
- </head>
- <head>
- <title>INSERT</title>
- </head>
- <body>
- <poztit>
- <div style="text-shadow:1px 1px 9px rgba(255,28,89,1);color:#9D28F7;font-size:70px;font-family:comic sans, comic sans ms, cursive, verdana, arial, sans-serif;">
- UNTOLD
- </div>
- </poztit>
- <poz2>
- <div style="text-shadow:1px 1px 9px rgba(255,28,89,1);color:#9D28F7;font-size:70px;text-align:center;font-family:comic sans, comic sans ms, cursive, verdana, arial, sans-serif;">
- Tabel Modificat!
- </div>
- </poz2>
- <poz1>
- <a href="meniu.php">
- <button class="btn">
- HOME
- </button>
- </a>
- </poz1>
- </body>
- </html>
Add Comment
Please, Sign In to add comment