<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php echo "<h1>Hello, PHP!</h1>\n"; ?> </body> </html>
<?php if(!isset($_SESSION['js'])||$_SESSION['js']==""){ echo "<noscript><meta http-equiv='refresh' content='0;url=/get-javascript-status.php&js=0'> </noscript>"; $js = true; }elseif(isset($_SESSION['js'])&& $_SESSION['js']=="0"){ $js = false; $_SESSION['js']=""; }elseif(isset($_SESSION['js'])&& $_SESSION['js']=="1"){ $js = true; $_SESSION['js']=""; } if ($js) { echo 'Javascript is enabled'; } else { echo 'Javascript is disabled'; } ?>
<?php //echo "Your User Agent is :" . $_SERVER ['HTTP_USER_AGENT']; echo"<br>"; $current_file_name = basename($_SERVER['PHP_SELF']); echo "$current_file_name"; ?>
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php echo "<h1>Halo Bandung!</h1>\n"; ?> </body> </html>
<?php ob_start(); session_start(); ?> <? // error_reporting(E_ALL); // ini_set("display_errors", 1); ?> <html lang = "en"> <head> <title>Tutorialspoint.com</title> <link href = "css/bootstrap.min.css" rel = "stylesheet"> <style> body { padding-top: 40px; padding-bottom: 40px; background-color: #ADABAB; } .form-signin { max-width: 330px; padding: 15px; margin: 0 auto; color: #017572; } .form-signin .form-signin-heading, .form-signin .checkbox { margin-bottom: 10px; } .form-signin .checkbox { font-weight: normal; } .form-signin .form-control { position: relative; height: auto; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 10px; font-size: 16px; } .form-signin .form-control:focus { z-index: 2; } .form-signin input[type="email"] { margin-bottom: -1px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-color:#017572; } .form-signin input[type="password"] { margin-bottom: 10px; border-top-left-radius: 0; border-top-right-radius: 0; border-color:#017572; } h2{ text-align: center; color: #017572; } </style> </head> <body> <h2>Enter Username and Password</h2> <div class = "container form-signin"> <?php $msg = ''; if (isset($_POST['login']) && !empty($_POST['username']) && !empty($_POST['password'])) { if ($_POST['username'] == 'tutorialspoint' && $_POST['password'] == '1234') { $_SESSION['valid'] = true; $_SESSION['timeout'] = time(); $_SESSION['username'] = 'tutorialspoint'; echo 'You have entered valid use name and password'; }else { $msg = 'Wrong username or password'; } } ?> </div> <!-- /container --> <div class = "container"> <form class = "form-signin" role = "form" action = "<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method = "post"> <h4 class = "form-signin-heading"><?php echo $msg; ?></h4> <input type = "text" class = "form-control" name = "username" placeholder = "username = tutorialspoint" required autofocus></br> <input type = "password" class = "form-control" name = "password" placeholder = "password = 1234" required> <button class = "btn btn-lg btn-primary btn-block" type = "submit" name = "login">Login</button> </form> Click here to clean <a href = "logout.php" tite = "Logout">Session. </div> </body> </html>
<html> <head> <title>Passing Argument by Reference</title> </head> <body> <?php function addFive($num) { $num += 5; } function addSix(&$num) { $num += 6; } $orignum = 10; addFive( $orignum ); echo "Original Value is $orignum<br />"; addSix( $orignum ); echo "Original Value is $orignum<br />"; ?> </body> </html>
<?php if(isset($_FILES['image'])){ $errors= array(); $file_name = $_FILES['image']['name']; $file_size =$_FILES['image']['size']; $file_tmp =$_FILES['image']['tmp_name']; $file_type=$_FILES['image']['type']; $file_ext=strtolower(end(explode('.',$_FILES['image']['name']))); $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false){ $errors[]="extension not allowed, please choose a JPEG or PNG file."; } if($file_size > 2097152){ $errors[]='File size must be excately 2 MB'; } if(empty($errors)==true){ move_uploaded_file($file_tmp,"images/".$file_name); echo "Success"; }else{ print_r($errors); } } ?> <html> <body> <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="image" /> <input type="submit"/> </form> </body> </html>
<?php session_start(); if (isset($_SESSION['counter'])) { $_SESSION['counter']++; } else { $_SESSION['counter'] = 1; } $msg = "You have visited this page ". $_SESSION['counter']; $msg .= "in this session."; echo ( $msg ); ?> <p> To continue click following link <br /> <a href = "nextpage.php?<?php echo htmlspecialchars(SID); ?>"> </p>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more