Wednesday, December 13, 2017

Top War Movie List (Collected)



  1. The Hurt Locker (2008)
  2. Blood Diamond (2006)
  3. Courage Under Fire (1996)
  4. Jarhead (2005)
  5. Green Zone (2010)
  6. Saving Private Ryan(1998) -8.6/10
  7. Hacksaw Ridge(2016)-8.2/10
  8. Pearl Harbor(2001)-6.1/10
  9. Enemy at the Gates(2002)-7.6/10
  10. Das Boot(1981)-8.4/10

Thursday, June 22, 2017

Laravel 5.4+ (Important Note)



  • Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine. https://getcomposer.org/

Monday, March 6, 2017

php4

 <?php  

 // Start the session
 session_start();
 ?>
 <!DOCTYPE html>
 <html>
 <head>
      <link rel="stylesheet" type="text/css" href="mystyle3.css">
 </head>
 <body>
      <div class="container">
           <header>
                <ul style="width: 100%">
  <li style="width: 80%;text-align:right"><a>Welcome To Sign In (Admin Account)</a></li>
  <li style="float:right"><a class="active" href="Assignment07.php">Login</a></li>
  <li style="float:right"><a class="active" href="Assignment07.php">Sign Up</a></li>
 </ul>
           </header>
           <!--<nav>
                <img src="a.png" style="max-height: 100% ; max-width: 100%">
           </nav>-->
           <article>
 <?php  
 $servername = "localhost";
 $username = "root";
 $password = "";
 $dbname = "shadhin";      
 // Create connection
 $conn = mysqli_connect($servername, $username, $password, $dbname);
 // Check connection
 if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
 }
 $sql = "SELECT * FROM register ";
 $result = mysqli_query($conn, $sql);
 //
 if($result = mysqli_query($conn, $sql)){
   if(mysqli_num_rows($result) > 0){
     echo "<table >";
       echo "<tr>";
         echo "<th>Full name</th>";
         echo "<th>Nick name</th>";
         echo "<th>Gender</th>";
               echo "<th>Email</th>";
         echo "<th>Phone</th>";
         echo "<th>Birthday</th>";
         echo "<th>Password</th>";
       echo "</tr>";
     while($row = mysqli_fetch_array($result)){
       echo "<tr>";
         echo "<td>" . $row['Full_name'] . "</td>";
         echo "<td>" . $row['Nick_name'] . "</td>";
         echo "<td>" . $row['Gender'] . "</td>";
                echo "<td>" . $row['Email'] . "</td>";
         echo "<td>" . $row['Phone'] . "</td>";
         echo "<td>" . $row['Birthday'] . "</td>";
         echo "<td>" . $row['Password'] . "</td>";
       echo "</tr>";
     }
     echo "</table>";
     // Free result set. mysqli_free_result() function frees the memory associated with the result.
     mysqli_free_result($result);
   } else{
     echo "No records Found";
   }
 } else{
   echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
 }                
 //
      mysqli_close($conn);
 ?>
           </article>
           <footer style="clear: both;">Copyright 2017 &copy; ShadhiN</footer>
      </div>
 </body>
 </html>

php 2

 <html>  

 <?php
 session_start();
 ?>
 <head>
      <link rel="stylesheet" type="text/css" href="mystyle3.css">
 </head>
 <?php
 // Date in the past
 header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
 header( "Cache-Control: no-cache" );
 header( "Pragma: no-cache" );
 ?>
 <body>
      <div class="container">
           <header>
                <ul style="width: 100%">
  <li style="width: 80%;text-align:right"><a>Welcome To Our Home</a></li>
  <li style="float:right"><a class="active" href="Assignment07.php">Login</a></li>
  <li style="float:right"><a class="active" href="Assignment07.php">Sign Up</a></li>
 </ul>
           </header>
           <!--<nav>
                <img src="a.png" style="max-height: 100% ; max-width: 100%">
           </nav>-->
           <article>
      <h1 style="color: red; width: 100% ;text-align: center ;border: 2px solid green">Welcome to My World You have successfully Create Your Account</h1>
      <h2 style="color: #897AE5; width: 100% ;text-align: center ;border: 2px solid green">Your Input: Using File with Array</h2>
      <?php
      $myfile = fopen( "newfile.txt", "r" )or die( "Unable to open file!" );
      $cars = file( "newfile.txt" );
      echo "First Name :" . $cars[ 0 ] . "<br>";
      echo "Last Name :" . $cars[ 1 ] . "<br>";
      echo "Gender:" . $cars[ 2 ] . "<br>";
      echo "Your email address is:" . $cars[ 3 ] . "<br>";
      echo "Phone Number : " . $cars[ 4 ] . "<br>";
      echo "Birthday : " . $cars[ 5 ] . "<br>";
      echo "Password : " . $cars[ 6 ] . "<br>";
      ?>
      <h2 style="color: #897AE5; width: 100% ;text-align: center ;border: 2px solid green">Your Input: Using SessioN </h2> First Name :
      <?php echo $_SESSION['firstname']; ?><br> Last Name :
      <?php echo $_SESSION['lastname']; ?><br> Gender:
      <?php echo $_SESSION['gender'] ;?><br> Your email address is:
      <?php echo $_SESSION['email22'] ; ?><br> Phone Number :
      <?php echo $_SESSION['telphone'] ;?><br> Birthday :
      <?php echo $_SESSION['Birth_day'] ;?><br> Password :
      <?php echo $_SESSION['pass2'] ;?><br>
      <h2 style="color: #897AE5; width: 100% ;text-align: center ;border: 2px solid green">DATA BASE COnnection </h2>
      <?php
 //data insert
      $pfull_name=$_SESSION['firstname'];
      $pNick_name=$_SESSION['lastname'];
      $pGender=$_SESSION['gender'] ;
      $pEmail=$_SESSION['email22'];
      $pPhone=$_SESSION['telphone'];
      $pBirthday= $_SESSION['Birth_day'];
      $ppassword=$_SESSION['pass2'];
 $servername = "localhost";
 $username = "root";
 $password = "";
 $dbname = "shadhin";
 //$ami="paru";
 // Create connection
 $conn = mysqli_connect($servername, $username, $password,$dbname);
 // Check connection
 if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
 }
 echo "Connected successfully";
      /*$sql = "INSERT INTO register (Full_name, Nick_name, Gender,Email,Phone,Birthday,Password) VALUES ($pfull_name,$pNick_name, $pGender,$pEmail,$pPhone,$pBirthday,$ppassword)";*/
      $sql ="INSERT INTO register (Full_name, Nick_name, Gender,Email,Phone,Birthday,Password) VALUES ('$pfull_name','$pNick_name', '$pGender','$pEmail','$pPhone','$pBirthday','$ppassword');";
      if (mysqli_query($conn, $sql)) {
   echo "New record created successfully";
 } else {
   echo "Error: " . $sql . "<br>" . mysqli_error($conn);
 }
      // Close connection
 mysqli_close($conn);
      ?>
      <h2 style="color: #897AE5; width: 100% ;text-align: center ;border: 2px solid green">Your Input: Using File </h2>
      <?php
      $myfile = fopen( "newfile.txt", "a+" )or die( "Unable to open file!" );
      // Output one character until end-of-file
      while ( !feof( $myfile ) ) {
           echo "<br>";
           echo fgets( $myfile );
      }
      $cars = file( "newfile.txt" );
      fclose( $myfile );
      ?>
      <h2 style="color: #897AE5; width: 100% ;text-align: center ;border: 2px solid green">Your Input: Using File Just print Array </h2>
      <?php
      print_r( file( "newfile.txt" ) );
      ?>
      <?php session_destroy(); ?>
           </article>
           <footer style="clear: both;">Copyright 2017 &copy; ShadhiN</footer>
      </div>
 </body>
 </html>

php

<?php

// Start the session
session_start();
?>

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

<body>
<?php
    if($_POST)                         // if form is submitted
    {
       
$firstNameErr = $lastNmeErr = $email1Err = $email2Err = $genderErr = $telErr = $passErr2= $passErr1="";
$firstName = $lastName = $email1 = $email2 =$gender = $comment = $tel = $pass01 = $pass02 = "";
        $errors = array();

        //start validation
     
// first name check
$fName = test_input( $_POST[ "firstname" ] );
if (strlen($fName)<2) {
$errors['Name10'] = "Minimum 2 charecter";
}
else{
          $fName = $_POST[ "firstname"];
}
$fName = test_input( $_POST[ "firstname" ] );
if ( !preg_match("/^[a-zA-Z ]*$/", $fName ) ) {
$errors['Name11'] = "Only letters and white space allowed";
}
else{
          $fName = $_POST[ "firstname"];
}
$fName = test_input( $_POST[ "firstname" ] );
        if(strlen($_POST['firstname']) < 2)
        {
            $errors['Name12'] = "Your Full Name must be atleast 2 characters long";
        }
else{
          $fName = $_POST[ "firstname"];
}
$fName = test_input( $_POST[ "firstname" ] );
if(strlen($_POST['firstname']) > 20)
        {
            $errors['Name13'] = "Your Full Name must be less than 20 characters long";
        }
else{
          $fName = $_POST[ "firstname"];
}
// surname name check
$lName = test_input( $_POST["lastname"] );
if (strlen($lName)<2){
$errors['Name20'] = "Minimum 2 charecter";
}else{
          $lName = $_POST[ "lastname"];
}
$lName = test_input( $_POST[ "lastname" ] );
if ( !preg_match( "/^[a-zA-Z]*$/", $lName ) ) {
$errors['Name21'] = "Only letters and white space allowed";
}else{
          $lName = $_POST[ "lastname"];
}

        if(strlen($_POST['lastname']) < 2)
        {
            $errors['Name22'] = "Your nick name must be atleast 2 characters long";
        } else{
          $lName = $_POST[ "lastname"];
}
if(strlen($_POST['lastname']) > 20)
        {
            $errors['Name23'] = "Your Nick name must be less than 20 characters long";
        }else{
          $lName = $_POST[ "lastname"];
}
// gender check

if ( empty( $_POST[ "gender" ] ) ) {
$errors['gender'] = "Gender is required";
}
else{
          $gName = $_POST[ "gender"];
}
// email  check
if ( strcmp( $_POST["email11"], $_POST["email22"] )!=0 ) {
$errors['email'] ="Email Not match";
}
else{
          $eemail = $_POST[ "email22"];
}
//email recheck

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "shadhin";
$eemail2 = $_POST[ "email22"];
$eemailcheck;

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
   // die("Connection failed: " . mysqli_connect_error());
$errors['emailechek01'] ="Connection failed";
}

$sql = "SELECT Email FROM register WHERE Email ='$eemail2'";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
   $errors['emailechek02'] ="Already Have Account";
mysqli_close($conn);
    }
 else {
 $eemail = $_POST[ "email22"];
    mysqli_close($conn);
}



// password check
             $mystring = $_POST["pass2"];

if (preg_match('/\s/', $mystring)) {
$errors['pnew'] = "space not allow";
}else{
          $pname = $_POST[ "pass2"];
}
if ( strcmp( $_POST["pass1"], $_POST["pass2"] )!=0 ) {
$errors['password'] = "password Not match";
}else{
          $pname = $_POST[ "pass2"];
}
     
        if(strlen($_POST['pass1']) < 8)
        {
            $errors['password11'] = "Password must be atlest 8 characters long";
        }else{
          $pname = $_POST[ "pass2"];
}

if(strlen($_POST['pass1']) > 20)
        {
            $errors['password12'] = "Password must be less than 20 characters long";
        }else{
          $pname = $_POST[ "pass2"];
}
if(strlen($_POST['pass2']) < 8)
        {
            $errors['password21'] = "Password must be atlest 8 characters long";
        }else{
          $pname = $_POST[ "pass2"];
}

if(strlen($_POST['pass2']) > 20)
        {
            $errors['password22'] = "Password must be less than 20 characters long";
        }else{
          $pname = $_POST[ "pass2"];
}
// tel check


     
        if(strlen($_POST['telphone']) < 8)
        {
            $errors['telphone1'] = "telphone must be atlest 8 characters long";
        }else{
          $Phone = $_POST[ "telphone"];
}

if(strlen($_POST['telphone']) > 20)
        {
            $errors['telphone2'] = "telphone must be less than 20 characters long";
        }else{
          $Phone = $_POST[ "telphone"];
}
$Phone = test_input( $_POST[ "telphone" ] );

           if ( !preg_match( "/[0-9]/", $Phone ) ) {
$errors['telphone3'] = "Only number is allow";
}else{
          $Phone = $_POST[ "telphone"];
}
$telErr = test_input( $_POST[ "telphone" ] );

           if ( preg_match( "/^[a-zA-Z ]*$/", $telErr ) ) {
$errors['telphone4'] = "Only number is allow";
}else{
          $Phone = $_POST[ "telphone"];
}
//birthday checkdate
$Bname = test_input( $_POST[ "Birth_day" ] );
if ( !empty($Bname) ) {
$Bname = $_POST[ "Birth_day"];
}



        //check errors
        if(count($errors) == 0)
        {
            //redirect to success pages


              $_SESSION['firstname'] = $fName;
 $_SESSION['lastname'] = $lName;
 $_SESSION['gender'] = $gName;
 $_SESSION['email22'] = $eemail;
 $_SESSION['telphone']=$Phone;
 $_SESSION['Birth_day'] = $Bname;
 $_SESSION['pass2'] = $pname;


$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");

$ok=" ".PHP_EOL;

              fwrite($myfile, $fName);
 fwrite($myfile, $ok);
 fwrite($myfile, $lName);
  fwrite($myfile, $ok);
 fwrite($myfile, $gName);
fwrite($myfile, $ok);
 fwrite($myfile, $eemail);
fwrite($myfile, $ok);
 fwrite($myfile, $Phone);
fwrite($myfile, $ok);
 fwrite($myfile, $Bname);
fwrite($myfile, $ok);
 fwrite($myfile, $pname);
fclose($myfile);


           header("Location: Assignment07createAccountSuccess2.php");
            //header("Location: Assignment07createAccountSuccess.php");

            exit();
        }
    }
function test_input( $data ) {
$data = trim( $data );
$data = stripslashes( $data );
$data = htmlspecialchars( $data );
return $data;
}
?>


<div class="container">

<header>
<h4>Welcome To Sign Up</h4>
</header>

<nav>
<img src="a.png" style="max-height: 100% ; max-width: 100%">
</nav>
<article>

<h1 style="text-align: center">Create a new account</h1>
<div style="margin-right:50px;margin-left:50px">
<form method="post" target="_self" autocomplete="on" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<!--<label for="fname">First Name </label>-->
<span class="error">
<?php if(isset($errors['Name10'])) echo $errors['Name10'];?>
</span>

<span class="error">
<?php if(isset($errors['Name11'])) echo $errors['Name11'];?>
</span>
<span class="error">
<?php if(isset($errors['Name12'])) echo $errors['Name12'];?>
</span>
<span class="error">
<?php if(isset($errors['Name13'])) echo $errors['Name13'];?>
</span>


<input type="text" name="firstname" value="<?php if(isset($_POST['firstname'])) echo $_POST['firstname']; ?>" placeholder="Full Name (Character Min:2 Max:20)" min="2" max="20" autofocus required>

<!-- <br><label for="lname">Last Name</label>-->
<span class="error">
<?php if(isset($errors['Name20'])) echo $errors['Name20'];?>
</span>
<span class="error">
<?php if(isset($errors['Name21'])) echo $errors['Name21'];?>
</span>
<span class="error">
<?php if(isset($errors['Name22'])) echo $errors['Name22'];?>
</span>
<span class="error">
<?php if(isset($errors['Name23'])) echo $errors['Name23'];?>
</span>
<input type="text" name="lastname" value="<?php if(isset($_POST['lastname'])) echo $_POST['lastname']; ?>" placeholder="Nick Name (Character Min:2 Max:20)" required>

<br> Gender:
<input type="radio" name="gender" <?php if (isset($gender) && $gender=="female" ) ;?> value="female" required >Female
<input type="radio" name="gender" <?php if (isset($gender) && $gender=="male" ) ;?> value="male" required >Male
<span class="error">
<font size="2">
<?php if(isset($errors['gender'])) echo $errors['gender'];?>
</font>
</span>
<input type="email" id="fname" value="<?php if(isset($_POST['email11'])) echo $_POST['email11']; ?>" name="email11" placeholder="Email" required>

<input type="email" id="fname" name="email22" value="<?php if(isset($_POST['email22'])) echo $_POST['email22']; ?>" placeholder="Re-enter Email" required>
<span class="error">
<font size="2">
<?php if(isset($errors['email'])) echo $errors['email'];?>
</font>
</span>


<span class="error">
<font size="2">
<?php if(isset($errors['emailechek02'])) echo $errors['emailechek02'];?>
</font>
</span>

<input type="number" id="lname"  name="telphone" value="<?php if(isset($_POST['telphone'])) echo $_POST['telphone']; ?>" placeholder="Phone Number with Country Code (Min:8 Max:20)" required><br>
<span class="error">
<font size="2">
<?php if(isset($errors['telphone1'])) echo " ".$errors['telphone1'];?>
</font>
</span>
<span class="error">
<font size="2">
<?php if(isset($errors['telphone2']))  echo " ".$errors['telphone2'];?>
</font>
</span>
<span class="error">
<font size="2">
<?php if(isset($errors['telphone3']))  echo " ".$errors['telphone3'];?>
</font>
</span>
<span class="error">
<font size="2">
<?php if(isset($errors['telphone4']))  echo " ".$errors['telphone4'];?>
</font>
</span>

<label for="lname">Birth Day</label>
<input type="date" id="lname" placeholder="YYYY/MM/DD" name="Birth_day" required>
<input type="password" id="fname" name="pass1" placeholder="Password character(Min:8 max:20)" required>

<span class="error">
<font size="2">
<?php if(isset($errors['password11']))  echo " ".$errors['password11'];?>
</font>
</span>

<span class="error">
<font size="2">
<?php if(isset($errors['password12']))  echo "".$errors['password12'];?>
</font>
</span>
<input type="password" id="fname" name="pass2" placeholder="Re-type Password character(Min:8 max:20)" required>

<span class="error">
<?php if(isset($errors['pnew'])) echo $errors['pnew'];?>
</span>

</span>
<span class="error">
<font size="2">
<?php if(isset($errors['password']))  echo " ".$errors['password'];?>
</font>
</span>
</span>
<span class="error">
<font size="2">
<?php if(isset($errors['password21']))  echo " ".$errors['password21'];?>
</font>
</span>
</span>
<span class="error">
<font size="2">
<?php if(isset($errors['password22']))  echo " ".$errors['password22'];?>
</font>
</span>
<div class="shadhin"><input type="radio" name="i" required> I agree to ShadhiN terms</div>
<div style=" width: 100%">
<div class="shadhin" style="float:left ; width: 50%"><input type="reset" value="Reset all">
</div>
<div class="shadhin" style="float:right; width: 50%"><input type="submit" value="Create an account">
</div>
</div>
<div style="; margin-bottom:5px; margin-top:5px;border: 2px solid black; width: 100% ; clear:both"></div>

</form>
<a href="Assignment07Login.php" target="_self"><button class="button"><span>User Login</span></button>
</a>
<a href="Assignment07LoginAdmin.php" target="_self"><button class="button"><span>Admin Login</span></button>
</a>
</div>

</article>
<?php

?>
<footer style="clear: both;">Copyright 2017 &copy; F</footer>
</div>
</body>

</html>