## GET CONTENTS IN A DIRECTORY $theme_contents_all = array(); $theme_contents_files = array(); // Open a directory, and read its contents if (is_dir(MINI_USER_THEME_DIR)){ //check if exists, …
Read MorePHP
How to show YouTube vedio using youtube link in php
## GET YOUTUBE VEDIO <?php function getYoutubeEmbedUrl($url) { $shortUrlRegex = ‘/youtu.be\/([a-zA-Z0-9_]+)\??/i’; $longUrlRegex = ‘/youtube.com\/((?:embed)|(?:watch))((?:\?v\=)|(?:\/))(\w+)/i’; if (preg_match($longUrlRegex, $url, $matches)) { $youtube_id = $matches[count($matches) – 1]; } if (preg_match($shortUrlRegex, …
Read MoreSend email with attachment using PHP Mailer
$email = new PHPMailer(); $email->From = ‘you@example.com’; $email->FromName = ‘Your Name’; $email->Subject = ‘Message Subject’; $email->Body = $bodytext; $email->AddAddress( ‘destinationaddress@example.com’ ); $file_to_attach = ‘PATH_OF_YOUR_FILE_HERE’; $email->AddAttachment( …
Read MoreEmail with attachment
$file = $path.$filename; $content = file_get_contents( $file); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); // header $header = “From: “.$from_name.” <“.$from_mail.”>\r\n”; $header .= …
Read MoreSend Attachment using email
$filename = ‘myfile’; $path = ‘your path goes here’; $file = $path . “/” . $filename; $mailto = ‘mail@mail.com’; $subject = ‘Subject’; $message = ‘My …
Read MoreOn delete Cascade in php
## ON Delete Cascade: Cascade will work when you delete something on table Courses. Any record on table BookCourses that has reference to table Courses …
Read MoreGet email not send errors
How can I get the error message for the mail() function? You can use error_get_last()when mail() returns false. $success = mail(‘example@example.com’, ‘My Subject’, $message); if …
Read MorePDF open in div or html file
https://stackoverflow.com/questions/29941646/what-is-the-best-way-to-display-pdf-in-div-or-panel
Read MoreEmail Validation check in javascript
## Used To Validate Email In Javascript <script > function validateEmail(email) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; return emailReg.test( email ); …
Read MoreUpload image in php
#IMAGE UPLOAD if ($_FILES[‘list1’][‘name’] != “”) { $allowed_ext = array(“jpg”, “jpeg”, “png”, “gif”); $extension = explode(‘.’, $_FILES[“list1”][“name”]); $ext = strtolower(end($extension)); if (in_array($ext, $allowed_ext)) { $newname …
Read More