Commit ff54775b authored by Srinivas's avatar Srinivas
Browse files

Update stureg.php

parent 0bd804bc
<?php <?php
session_start(); session_start();
include('connection.php');
$connection = getdb();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-ca"> <html lang="en-ca">
...@@ -174,8 +176,6 @@ if($_SESSION['username4']){ ...@@ -174,8 +176,6 @@ if($_SESSION['username4']){
<table> <table>
<?php <?php
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,'test');
if(isset($_POST['search'])) if(isset($_POST['search']))
{ {
...@@ -189,17 +189,16 @@ $password = $_POST['user_pass']; ...@@ -189,17 +189,16 @@ $password = $_POST['user_pass'];
$cpassword= $_POST['user_pass1']; $cpassword= $_POST['user_pass1'];
if ($cpassword==$password){ if ($cpassword==$password){
$conn = new mysqli('localhost','root','','test'); if($connection->connect_error){
if($conn->connect_error){ die('Connection Failed : '.$connection->connect_error);
die('Connection Failed : '.$conn->connect_error);
} }
else{ else{
$stmt = $conn->prepare("insert into student_login(username,Password) $stmt = $connection->prepare("insert into student_login(username,Password)
values(?,?)"); values(?,?)");
$stmt->bind_param("ss",$username,$password); $stmt->bind_param("ss",$username,$password);
$stmt->execute(); $stmt->execute();
$stmt->close(); $stmt->close();
$conn->close(); $connection->close();
} }
echo "<script>location.href='success.php'</script>"; echo "<script>location.href='success.php'</script>";
} }
...@@ -214,4 +213,4 @@ echo "<script>location.href='3.php'</script>"; ...@@ -214,4 +213,4 @@ echo "<script>location.href='3.php'</script>";
} }
?> ?>
</body> </body>
</html> </html>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment