Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Explain PHP code in details and please include comments. Your reply would be very much appriciated. session_start(); 1/29 in Code if(isset($_POST['submit'])){ $berr=false; if(!isset($_POST['user'])){ $berr=true; $err['user']=No

Explain PHP code in details and please include comments. Your reply would be very much appriciated.

image text in transcribed

session_start(); 1/29 in Code if(isset($_POST['submit'])){ $berr=false; if(!isset($_POST['user'])){ $berr=true; $err['user']="No Input"; } if(!isset($_POST['pass'])){ $berr=true; $err['pass']="No Password"; } include 'conf.php'; $db=mysqli_connect (DB_HOST, DB_USER, DB_PASS,DB); if ($db&&!$berr) { $sql="SELECT FROM `data WHERE username = '{$_POST['user']}'|| and `password ='{$_POST['pass']}';"; $result=mysqli_query($db, $sql); if (mysqli_num_rows($result)=-1){ $row=mysqli_fetch_array($result); $msg= "Level is {$row['level']}"; $_SESSION['level' ]=$row['level']; $_SESSION['id' ]=$row['id']; $_SESSION['fname' ]=$row[ 'name']." '. $row['surname']; header("refresh:1; url=index.php"); //This part is for Logging in!!! } else { $berr=true; $err['login']="
Username and Password did not match!!!
"; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

How would you rate Hsiehs leadership using the Leadership Grid?

Answered: 1 week ago

Question

Select suitable tools to analyze service problems.

Answered: 1 week ago