OneCompiler

car

136

Htmlfile

<!DOCTYPEhtml> <html> <head> <titl e>Login</ti tle> <scriptsrc=https: //ajax. googleapis. com/ajax/li bs/jquery/3. 5.1/jquery. min.js></scri <script> $(document).ready(functi on(){ $(“#logi n-form”). submit(functi Event.preventDefaul on(event){ t(); Varusername=$(“#username”).val (); pt> Varpassword=$(“#password”).val (); $.ajax({ url:‘ check_logi type:‘ post’, n.php’ , data:{username:username,password:password}, success:functi on(response){ if(response==“val id”){ window.locati on.href=“dashboard.php”; //redi recttodashboard }); }); </scri pt> </head> <body> <h2>Login</h2> <formid=”logi } Else{ } } }); n-form”method=”post”> <label>Username: </label > Alert(“I nvalidusernameorpassword”); <inputtype=”text”name=”username”i d=”username”><br><br> <label>Password: </label > <inputtype=”password”name=”password”i <inputtype=”submi t”value=”Logi </form> </body> d=”password”><br><br> n”> </html> Phpfileascheck_logi n.php <?php //Establi shdatabaseconnection $conn=mysqli_connect(‘ If(!$conn){ Die(‘ Connectionfail localhost’ ,‘username’ ,‘password’ ,‘database_name’ ed:‘.mysqli_connect_error()); } //GetusernameandpasswordfromAJAXrequest $username=$_POST[‘username’ ]; $password=$_POST[‘password’ ]; //Querytheuserstablefortheenteredusernameandpassword ); $sql=“SELECT*FROMusersWHEREusername=‘$username’ANDpassword=‘$password’”; $result=mysqli_query($conn,$sql ); If(mysqli _num_rows($result)>0){ Echo“valid”; }else{ Echo“invali d”; } //Closedatabaseconnection Mysqli_cl ose($conn); ?>

Fromsklearn.l
inear_modelimportLi
Mileage=[[10],[
20],[30]
Price=[24,19,17,13,10,7,5,2]
Reg=LinearRegression().
Print(‘
Intercept:
’,reg.
Print(‘
Coeffici
ent:’
intercept_)
,reg.coef_[
New_mileage=[[25],[45],[
Predicted_pri
nearRegressi
on
,[40],[
50],[60]
,[70],[
fit(mi
leage,pri
0])
65]]
ce=reg.predict(new_mi
Print(‘
Predictedpri
ces:’
leage)
,predicted_pri
ce