php
php
H 1|Page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC
" crossorigin="anonymous">
<title>Master</title>
</head>
<body>
<!-- <form action="index.php" method="post"> //change method from post to get as per the use.
<label>User Id </label>
<label>Passwd </label>
</form> -->
</form> -->
2|Page
<!-- #Form - 3 -->
</form> -->
<!-- #Form - 4
<form action="index.php" method="post"> //change method from post to get as per the use.
<label>User Id </label><br>
<label>Passwd </label><br>
<label>E-mail</label><br>
<label>Age</label><br>
</form> -->
<!--
<label>Password </label><br>
</form> -->
3|Page
<?php
//$_GET request
//$_POST request
//String :-)
//Variables :-)
// $a = "Arthur";
// $b = null;
//If you want to add $ sign than use '\'. like \${Variable_name}
// $num1 = 4;
// $num2 = 3;
//#Form - 2
/*
$x = $_POST["x"];
4|Page
$total = null;
$total = abs($x);
$total = round($x);
echo $total;
*/
//#Form - 3
/*
$age = $_POST["age"];
else{
*/
//Loop
// for($i=1;$i<=10;$i++){
// }
//Array
//$arr = array('Rolex','Timex','Casio');
//echo count($arr);
5|Page
//array_pop($arr); //Delete from last.
//$arr = array_reverse($arr);
// foreach($arr as $ar){
// echo $ar."<br>";
// }
// echo "<br>".$arr[0];
#Form - 4
/*
if (isset($_POST["login"])) {
$password = $_POST["password"];
elseif (empty($username)) {
elseif (empty($password)) {
else {
6|Page
echo "your age is : $age";
*/
//Hasing
/*
$passwd = "Astrum420";
if(password_verify("Astrum420", $hash)){
else{
*/
//Database Connectivity ;)
/*
$db_server = "localhost";
$db_user = "root";
$db_pass = "";
$conn = "";
try{
7|Page
$conn = mysqli_connect($db_server, $db_user, $db_pass, $db_name);
catch(mysqli_sql_exception){
*/
//Check DB is Connected
/*
if($conn){
else{
*/
/*
$username = "Arthur";
$password = "Delta420";
values('$username','$hash')";
try{
mysqli_query($conn, $sql);
catch(mysqli_sql_exception){
8|Page
echo "Fail to Register User.";
*/
/*
if(mysqli_num_rows($table) > 0)
while($row = mysqli_fetch_assoc($table))
};
else
*/
//FORM - 5 //login
/*
if($_SERVER["REQUEST_METHOD"] == "POST"){
9|Page
$password = filter_input(INPUT_POST, "password", FILTER_SANITIZE_SPECIAL_CHARS);
elseif (empty($username)) {
elseif (empty($password)) {
else{
VALUES('$username', '$hash')";
try{
mysqli_query($conn, $sql);
catch(mysqli_sql_exception){
*/
//Close Database
/*
if(mysqli_close($conn))
10 | P a g e
echo "Database Close.";
*/
?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
</body>
</html>
<?php
?>
11 | P a g e