This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** | |
* This function will generate a thumbnail in png format for a pdf document using | |
* ImageMagick - http://php.net/imagick | |
* Ghostscript - https://sourceforge.net/projects/ghostscript/ | |
* @param $source - string - relative path to the source pdf (for example : ./originals/lorem-ipsum.pdf ) | |
* @param $destination - string - relative path to the directory where you want to place the generated thumbnail (for example : './thumnails') | |
* @param $fileName - string - file name of the thumbnail with out extension (for example : pdfthumbdemo ) | |
* @param width - number - width of the thumbnail | |
* @param height - number - height of the thumbnail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// - current year (for example : 2018) | |
$year=date('Y'); | |
// - current month (for example : 12) | |
$month=date('m'); | |
// directory path | |
$directory="./{$year}/{$month}/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['submit'])){ | |
function countUploadedFiles($name){ | |
/* | |
if a user submits the form | |
with out selecting any files | |
*/ | |
if($_FILES[$name]['size'][0]==0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> | |
<title>Count File Uploads</title> | |
</head> | |
<body> | |
<form method="post" action="./countfiles.php" enctype="multipart/form-data"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Human{ | |
public function laugh() { | |
echo "<br />"; | |
echo "Lmao"; | |
} | |
public function cry(){ | |
echo "<br />"; | |
echo "I'm crying"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sayHello($name){ | |
echo "Hello {$name}"; | |
} | |
call_user_func("sayHello","John"); // Hello John | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function doubleIt($num){ | |
echo 2*$num; | |
} | |
$functionName="doubleIt"; | |
$functionName(7); // 14 | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> Javascript prevent default form submit </title> | |
</head> | |
<body> | |
<form id="form" action="home.php" method="post"> | |
<label for="username">User name</label> | |
<input name="username" type="text" id="username" /> | |
<button type="submit">Submit</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> Javascript prevent default form submit </title> | |
</head> | |
<body> | |
<form id="form" action="home.php" method="post"> | |
<label for="username">User name</label> | |
<input name="username" type="text" id="username" /> | |
<button type="submit">Submit</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require './php-jwt/BeforeValidException.php'; | |
require './php-jwt/ExpiredException.php'; | |
require './php-jwt/JWT.php'; | |
require './php-jwt/SignatureInvalidException.php'; | |
use \Firebase\JWT\JWT; | |
$data=[ |
NewerOlder