Jump to content

techker

Members
  • Content count

    777
  • Joined

  • Last visited

Community Reputation

0 Neutral

About techker

  • Rank
    Prolific Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. techker

    IMG Rotate And destroy

    Hey guy's i have a script i did a few months ago and now noticed that it is doing its job but keeps the old file ..so i got the image a few times but on a different angle... how can i optimize this code to delete the old image when doing the rotation? <?php session_start(); include_once 'dbconnect.php'; if (!isset($_SESSION['userSession'])) { header("Location: index.php"); } $degrees = -270; $path = $_GET['Folder']; $file =$_GET['Pic']; $fileid =$_GET['id']; $image = $path.'/'.$file; $imageN = $path.'/New_'.$file; //load the image $source = imagecreatefromjpeg($image); //rotate the image $rotate = imagerotate($source, $degrees, 0); $NewImg='New_'.$file ; //set the Content type //header('Content-type: image/jpeg'); //display the rotated image on the browser //imagejpeg($rotate); imagejpeg($rotate,$imageN,100); //free the memory imagedestroy($source); imagedestroy($rotate); $sql = "UPDATE Coupon_list SET product_image_thumb = '$NewImg' WHERE id = '$fileid'"; if (mysqli_query($DBcon, $sql)) { echo "Rotation ok"; echo('<script language="Javascript">opener.window.location.reload(false); window.close();</script>'); } else { echo "Error Rotating: " . mysqli_error($DBcon); } mysqli_close($DBcon); ?> <img src="gears.gif" alt="" />
  2. techker

    Search from 1 Database linked to another..

    ya i got it cause my AND was before the OR $teamQuery3=mysqli_query($DBcon,"SELECT* FROM MyAlbum LEFT JOIN Coupon_list ON MyAlbum.CouponID =Coupon_list.id WHERE product_cat LIKE '%" . $searchterms . "%' OR product_comp LIKE '%" . $searchterms ."%' OR product_rebate LIKE '%" . $searchterms ."%' OR MyAlbum.CouponID LIKE '%" . $searchterms ."%' AND MyAlbum.UserID = $Seesion"); cause i have a master table that conatains all the coupons. So the member scrolls all the coupons and if he has it he adds it to his album. before i was duplicating the info in the members album.. now what i do is store the id of the master coupon in the MyAlbum database with the qty names....
  3. techker

    Search from 1 Database linked to another..

    sorry, i only need 2 tables and search in my first that links the second to view the coupons by id
  4. Hey Guys im confused on this.. i have 2 tables 1 that is for the client that store the coupons and values 2 is the master list that has all the coupons So basically i show all the coupons from the master Databse and the members clicks add to his Album (Like a shopping cart) So database members MYID UserID CouponID DateIn Visible Precieux QTY_Visible QTY CName Barcode Rebate Exp Database Coupon_list id product_name product_desc product_code product_date_exp product_user product_image product_image_thumb product_status product_qty product_folder product_cat rop product_type product_month Recherche_Nom ImgType product_barcode master product_comp product_rebate IsEditable SO i linked the both together and i need to have a search .this is what i did if(preg_match("/^[0-9- a-zA-Z]+/", $_POST['name'])){ $name=$_POST['name']; $searchterms=preg_replace("/'/", "\'", $name); SELECT* FROM MyAlbum INNER JOIN Coupon_list ON MyAlbum.CouponID=Coupon_list.id WHERE MyAlbum.UserID = $Session AND product_cat LIKE '%" . $searchterms . "%' OR product_comp LIKE '%" . $searchterms ."%' OR product_rebate LIKE '%" . $searchterms ."%' OR id LIKE '%" . $searchterms ."%' But somehow i get all the Members results..not the members album... i need to show the members album results not all the members
  5. techker

    Hacked!!

    hey guy's anybody know why would i get hacked..removed all my users! Hacked By VandaTheGod Hacked By VandaTheGod
  6. techker

    Concat to Un concat?

    im using the concat instead of making a new entry for every coupon..but if its to much trouble..il revert.lol with this it works.but just not sure what il do with it yet..lol cause i need to fetch the info of each coupon id to get the details $C=$team['CouponsID']; $New=explode(",", $C); foreach($New as $item) { $NewI=$item; }
  7. techker

    Concat to Un concat?

    Hey guys im updating a table with values and using Concat to add the values. $sql = "UPDATE NouvellesEchanges SET CouponsID = CONCAT(CouponsID,'".",".$Coupon."') WHERE EID = '$EID'"; now how to i get the information from the CouponID and separate them? the table holds the the user info and couponID's 125,123,1234,333,33333 i want to show the coupons and remove the (,) so i can have only 125 123..... thx im looking at split(";*",$string); or explode
  8. techker

    Firebase create Topic

    will do!!Thx
  9. techker

    Firebase create Topic

    man..that was a simple fix..lol seen the error was my appid... how can i store the results in my db? i need to parse the json? string(142) "{"notification_key":"APA91bG-LwsEDQynKWH1bPPf5FQJL2D9R4Oi8XXXXXXXbJ4TebsJqRSRgRfwIey96BnDZEszWxk-6ne8bMgVA1KteNNle5WBZCndj2Y0w"}"
  10. techker

    Firebase create Topic

    Even by removing the 2 line i get no text to show? in the console in fidler i see i get a 200 back thats ok but no response output to show the topic key..
  11. techker

    Firebase create Topic

    Hey guy's im messing around with firebase for the first time..I got Send message is working retreive Tokens all good But im stuck on creating Topics for individual notifications.. i started in CURL ,Tried in postman and it works but to add it in php is a different story..What happens is i don't get the response.or any indications that it worked? $authToken = 'key=xxxxxxxxxxx-4-vd8IyE5Zg0D1tlAhLokD1vuZpUWODUSnZAPaVXYTBbEnqedNsHvAJdDwy2cVU9Si8MKNQ78SrNYMaA1vaX'; $project_id='246202749xxxxx'; $data = array( 'operation' => 'create', 'notification_key_name' => 'appUser-2xxxxxx', 'registration_ids' => 'dBkCkjbIGVg:APA91bHTzf5rQHEtLjAv_THs1Kv_KK0uHVj85nC6Qy39CtY3Xke_M2p4YxRLGKloFpuDraWRd5jSGEMMD8N2x3ROlajdSB_7FGnxWnP2K-HNQ-up1Rxxxxxxxxxxx' ); $data_string = json_encode($data); $ch = curl_init('https://android.googleapis.com/gcm/notification'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'project_id:'.$project_id, 'Authorization: '.$authToken, 'Content-Length: ' . strlen($data_string))); if($result === FALSE){ die('Error'); } return $result; $result = curl_exec($ch); $responseInfo = curl_getinfo($result); $httpResponseCode = $responseInfo['http_code']; ?>
  12. Hey guy's i have been messing arround with an image uploader that can reseize and insert in Mysql.. but i also get the fliped image with cell. i added and EXIF function but it does not seem to work i noticed that the untoched image rotates correctly but as soon as i touch it to reseize the image rotates... is there a way to fix this in this code? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Storing Images in DB</title> </head> <body> <h2>Basic upload of image to a database</h2> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data"> Select Image File: <input type="file" name="userfile" size="40"> <input type="file" name="userfile" size="40"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000"> <select name="image_ctgy"> <option value="animals">Animals</option> <option value="vegetables">Vegetables</option> <option value="minerals">Minerals</option> </select> <br /> <input type="submit" value="submit"> </form> <?php /*** check if a file was submitted ***/ if(!isset($_FILES['userfile'], $_POST['image_ctgy'])) { echo '<p>Please select a file</p>'; } else { try { upload(); /*** give praise and thanks to the php gods ***/ echo '<p>Thank you for submitting</p>'; } catch(PDOException $e) { echo '<h4>'.$e->getMessage().'</h4>'; } catch(Exception $e) { echo '<h4>'.$e->getMessage().'</h4>'; } } /** * * the upload function * * @access public * * @return void * */ function upload(){ /*** check if a file was uploaded ***/ if(is_uploaded_file($_FILES['userfile']['tmp_name']) && getimagesize($_FILES['userfile']['tmp_name']) != false) { /*** an array of allowed categories ***/ $cat_array = array("animals", "vegetables", "minerals"); if(filter_has_var(INPUT_POST, "notset") !== false || in_array($_POST['image_ctgy'], $cat_array) !== false) { $image_ctgy = filter_input(INPUT_POST, "image_ctgy", FILTER_SANITIZE_STRING); } else { throw new Exception("Invalid Category"); } /*** get the image info. ***/ $size = getimagesize($_FILES['userfile']['tmp_name']); /*** assign our variables ***/ $image_type = $size['mime']; $imgfp = fopen($_FILES['userfile']['tmp_name'], 'rb'); $image_width = $size[0]; $image_height = $size[1]; $image_size = $size[3]; $image_name = $_FILES['userfile']['name']; $maxsize = 99999999; $exif = exif_read_data($_FILES['userfile']['tmp_name']); if($exif!==false) { $ort=1; if(isset($exif['Orientation'])) { // orientation is usually here $ort=$exif['Orientation']; } elseif(isset($exif['IFD0']) && isset($exif['IFD0']['Orientation'])) { // but apparently it can be here sometimes? $ort=$exif['IFD0']['Orientation']; } switch($ort) { case 1: // nothing break; case 2: // horizontal flip $tmpImage=custImageFlip($tmpImage,2); break; case 3: // 180 rotate left $tmpImage=imagerotate($tmpImage,180,0); break; case 4: // vertical flip $tmpImage=custImageFlip($tmpImage,1); break; case 5: // vertical flip + 90 rotate right $tmpImage=custImageFlip($tmpImage,1); $tmpImage=imagerotate($tmpImage,-90,0); break; case 6: // 90 rotate right $tmpImage=imagerotate($tmpImage,-90,0); break; case 7: // horizontal flip + 90 rotate right $tmpImage=custImageFlip($tmpImage,2); $tmpImage=imagerotate($tmpImage,-90,0); break; case 8: // 90 rotate left $tmpImage=imagerotate($tmpImage,90,0); break; } } // ImageFlip from https://php.net/manual/en/function.imagecopy.php#89658 function custImageFlip($imgsrc,$mode) { $width=imagesx($imgsrc); $height=imagesy($imgsrc); $src_x=0; $src_y=0; $src_width=$width; $src_height=$height; switch ($mode) { case '1': //vertical $src_y=$height-1; $src_height=-$height; break; case '2': //horizontal $src_x=$width-1; $src_width=-$width; break; case '3': //both $src_x=$width-1; $src_y=$height-1; $src_width=-$width; $src_height=-$height; break; default: return $imgsrc; } $imgdest = imagecreatetruecolor ($width,$height); if(imagecopyresampled($imgdest, $imgsrc, 0, 0, $src_x, $src_y , $width, $height, $src_width, $src_height)){ return $imgdest; } return $imgsrc; } /*** check the file is less than the maximum file size ***/ if($imgsrc < $maxsize ) { /*** create a second variable for the thumbnail ***/ $thumb_data = $imgsrc; /*** get the aspect ratio (height / width) ***/ $aspectRatio=(float)($size[0] / $size[1]); /*** the height of the thumbnail ***/ $thumb_height = 100; /*** the thumb width is the thumb height/aspectratio ***/ $thumb_width = $thumb_height * $aspectRatio; /*** get the image source ***/ $src = ImageCreateFromjpeg($thumb_data); /*** create the destination image ***/ $destImage = ImageCreateTrueColor($thumb_width, $thumb_height); /*** copy and resize the src image to the dest image ***/ ImageCopyResampled($destImage, $src, 0,0,0,0, $thumb_width, $thumb_height, $size[0], $size[1]); /*** start output buffering ***/ ob_start(); /*** export the image ***/ imageJPEG($destImage); /*** stick the image content in a variable ***/ $image_thumb = ob_get_contents(); /*** clean up a little ***/ ob_end_clean(); /*** connect to db ***/ $dbh = new PDO("mysql:host=localhost;dbname=2", '2', '2'); /*** set the error mode ***/ $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); /*** prepare the sql ***/ $stmt = $dbh->prepare("INSERT INTO testblob (image_type ,image, image_height, image_width, image_thumb, thumb_height, thumb_width, image_ctgy, image_name) VALUES (? ,?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->bindParam(1, $image_type); $stmt->bindParam(2, $imgfp, PDO::PARAM_LOB); $stmt->bindParam(3, $image_height, PDO::PARAM_INT); $stmt->bindParam(4, $image_width, PDO::PARAM_INT); $stmt->bindParam(5, $image_thumb, PDO::PARAM_LOB); $stmt->bindParam(6, $thumb_height, PDO::PARAM_INT); $stmt->bindParam(7, $thumb_width, PDO::PARAM_INT); $stmt->bindParam(8, $image_ctgy); $stmt->bindParam(9, $image_name); /*** execute the query ***/ $stmt->execute(); } else { /*** throw an exception is image is not of type ***/ throw new Exception("File Size Error"); } } else { // if the file is not less than the maximum allowed, print an error throw new Exception("Unsupported Image Format!"); } } ?> </body> </html>
  13. techker

    Facebook API...

    Hey guy's im going nuts here trying to figure out how to make this login work...lol! i get : Response Exception: Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings. i added every combination URL possible in the section in the facebook dev app settings.. www no www / no / root site members site localhost...... and when i refresh i get SDK Exception: Cross-site request forgery validation failed. Required param "state" missing from persistent data. so i tried for state issue: in login $_SESSION['FBRLH_state']=$_GET['state']; require_once "config.php"; if (isset($_SESSION['access_token'])) { header('Location: index.php'); exit(); } $_SESSION['FBRLH_state']=$_GET['state']; $redirectURL = "https://".$_SERVER['SERVER_NAME']."/Meb/fb-callback.php"; $permissions = ['email']; $loginURL = $helper->getLoginUrl($redirectURL, $permissions); //echo $redirectURL; //die($_SESSION['FBRLH_' . 'state']); $accessToken = $helper->getAccessToken() My callback file: session_start(); require_once "config.php"; try { $accessToken = $helper->getAccessToken(); } catch (\Facebook\Exceptions\FacebookResponseException $e) { echo "Response Exception: " . $e->getMessage(); exit(); } catch (\Facebook\Exceptions\FacebookSDKException $e) { echo "SDK Exception: " . $e->getMessage(); exit(); } if (!$accessToken) { header('Location: login.php'); exit(); } $oAuth2Client = $FB->getOAuth2Client(); if (!$accessToken->isLongLived()) $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); $response = $FB->get("/me?fields=id,user_location, first_name, last_name, email, picture.type(large)", $accessToken); $userData = $response->getGraphNode()->asArray(); $_SESSION['userData'] = $userData; $_SESSION['access_token'] = (string) $accessToken; header('Location: index.php'); exit(); config: session_start(); require_once "Facebook/autoload.php"; $FB = new \Facebook\Facebook([ 'app_id' => 'MYID', 'app_secret' => 'MYSECRET', 'default_graph_version' => 'v2.11' ]); $helper = $FB->getRedirectLoginHelper();
  14. Hey guy's , I have been searching the net to find a solution to parse an M3u extended file and extract what i need.. i found a script that works only with m3u not the plus(ads Logo and more information this works great for : #EXTM3U #EXTINF:-1,A&E TV http://stb.2muchtv.xyz:25461/live/USER/PASS/775.ts but on m3u plus #EXTM3U #EXTINF:-1 tvg-id="aande.us" tvg-name="A&E TV" tvg-logo="http://www.reviewstl.com/wp-content/uploads/2009/08/A-E.jpg" group-title="USA ENTERTAINMENT",A&E TV http://stb.2muchtv.xyz:25461/live/USER/PASS/775.ts i get a long string.. TV" http://stb.2muchtv.xyz:25461/live/1/2/775.ts tvg-name="beIN tvg-logo="http://www.tvweeklynow.com/images/9073/RIcksPix/Logos/ABC%20logo%202015%20300.jpg" http://stb.2muchtv.xyz:25461/live/1/2/94.ts tvg-name="Zootopia Swim" http://stb.2muchtv.xyz:25461/live/1/2/772.ts tvg-name="ZNS (US)" http://stb.2muchtv.xyz:25461/live/1/2/168.ts tvg-name="You're HEROES http://stb.2muchtv.xyz:25461/live/1/2/167.ts tvg-name="You TV" http://stb.2muchtv.xyz:25461/live/1/2/19119.ts tvg-name="You America" error_reporting(E_ALL); /** * @desc Set the time limit (seconds) */ set_time_limit(15); class m3uParser { /* * Private Variables */ private $m3uFile; private $m3uFile_SongLengths; private $m3uFile_SongTitles; private $m3uFile_SongLocations; /** * @desc Load the M3u file and initiate it for parsing */ public function __construct($m3uFile) { /** * @desc Load the file into an array **/ if(file_exists($m3uFile)) $this -> m3uFile = file($m3uFile); else die("Unable to locate '$m3uFile'"); /** * @desc "Loosely" check that the file is an m3u file **/ if(strtoupper(trim($this -> m3uFile[0])) != "#EXTM3U") die("The file specified {$this -> m3uFileLocation} is not a valid M3U playlist."); /** * @desc Remove extra empty lines */ $buffer = array(); foreach($this -> m3uFile as $line) { if($line != "\n" || $line != "\r" || $line != "\r\n" || $line != "\n\r") $buffer[] = $line; } $this -> m3uFile = $buffer; /** * @desc Shift the first line "#EXTM3U" off the array **/ array_shift($this -> m3uFile); /** * @desc Start parsing the m3u file */ $this -> _init(); } /** * @desc Hopefully free some memory (though not yet proven to work as thought) */ public function __destruct() { unset($this); } /** * @desc Initiate each array storing the Song Lengths, Titles and Locations */ private function _init() { foreach($this -> m3uFile as $key => $line) { if(strtoupper(substr($line, 0, ) == "#EXTINF:") { $line = substr_replace($line, "", 0, ; $line = explode(",", $line, 4); $this -> m3uFile_SongLengths[] = $line[0]; $this -> m3uFile_SongTitles[] = $line[1]; $this -> m3uFile_SongLocations[] = $this -> m3uFile[$key + 1]; } } } /** * @desc Single or Multi case[in]sensitive searching * @return array Returns array such as ["search string"] => "result[s]" */ public function searchTitles($search, $caseSensitive = false) { $results = array(); if(is_array($search)) { foreach($search as $terms) { foreach($this -> m3uFile_SongTitles as $songTitle) { $_search = $caseSensitive ? strstr($songTitle, $terms) : stristr($songTitle, $terms); if($_search) $results[$terms][] = $songTitle; } } } else { foreach($this -> m3uFile_SongTitles as $songTitle) { $_search = $caseSensitive ? strstr($songTitle, $search) : stristr($songTitle, $search); if($_search) $results[] = $songTitle; } } return $results; } /** * @desc Single or Multi case[in]sensitive searching * @return array Returns array such as ["search string"] => "result[s]" */ public function searchLocations($search, $ignoreDirectorySeperator = true, $caseSensitive = false) { $results = array(); if(is_array($search)) { foreach($search as $terms) { foreach($this -> m3uFile_SongLocations as $songLocation) { if($ignoreDirectorySeperator) $_search = $caseSensitive ? strstr(str_replace(array("/", "\\"), "", $songLocation), $terms) : stristr(str_replace(array("/", "\\"), "", $songLocation), $terms); else $_search = $caseSensitive ? strstr($songLocation, $terms) : stristr($songLocation, $terms); if($_search) $results[$terms][] = $songLocation; } } } else { foreach($this -> m3uFile_SongLocations as $songLocation) { if($ignoreDirectorySeperator) $_search = $caseSensitive ? strstr(str_replace(array("/", "\\"), "", $songLocation), $search) : stristr(str_replace(array("/", "\\"), "", $songLocation), $search); else $_search = $caseSensitive ? strstr($songLocation, $terms) : stristr($songLocation, $terms); if($_search) $results[] = $songLocation; } } return $results; } /** * @desc Search song lengths by equal length, less than length, less than or equal to length, greater than length, greater than or equal to length or in between [start, end]. * @return array Returns array such as ["length"] => "title[s]" */ public function searchLengths($type, $start, $end = null) { $results = array(); foreach($this -> m3uFile_SongLengths as $key => $length) { switch($type) { // Find lengths that equal to $start case 0: { if(!is_array($start)) { if($length == $start) $results[] = array($length => $this -> m3uFile_SongTitles[$key]); } else { foreach($start as $sLength) { if($sLength == $length) $results[] = array($sLength => $this -> m3uFile_SongTitles[$key]); } } } break; // Find lengths that are less than $start case 1: { if(!is_array($start)) { if($start < $length) $results[] = array($length => $this -> m3uFile_SongTitles[$key]); } else { foreach($start as $length) { if($sLength < $sLength) $results[] = array($sLength => $this -> m3uFile_SongTitles[$key]); } } } break; // Find lengths that are less than or equal to $start case 2: { if(!is_array($start)) { if($start <= $length) $results[] = array($length => $this -> m3uFile_SongTitles[$key]); } else { foreach($start as $sLength) { if($sLength <= $length) $results[] = array($sLength => $this -> m3uFile_SongTitles[$key]); } } } break; // Find lengths that are longer than $start case 3: { if(!is_array($start)) { if($start > $length) $results[] = array($length => $this -> m3uFile_SongTitles[$key]); } else { foreach($start as $sLength) { if($sLength > $length) $results[] = array($sLength => $this -> m3uFile_SongTitles[$key]); } } } break; // Find lengths that are longer or equal to $start case 4: { if(!is_array($start)) { if($start >= $length) $results[] = array($length => $this -> m3uFile_SongTitles[$key]); } else { foreach($start as $sLength) { if($sLength >= $length) $results[] = array($sLength => $this -> m3uFile_SongTitles[$key]); } } } break; // Find lengths between $start and $end case 5: { if(!is_array($start) && !is_array($end)) { if($length >= $start && $length <= $end) $results[] = array($length => $this -> m3uFile_SongTitles[$key]); } else { foreach($start as $sLength) { if($sLength >= $start[$key] && $sLength <= $end[$key]) $results[] = array($sLength => $this -> m3uFile_SongTitles[$key]); } } } break; } } return $results; } /** * @desc Output the m3u in a human-readable format (includes table-output) * @return string The buffer for output */ public function prettyOutput($sortWhat = "songTitle", $sortDirection = "asc", $drawTable = false, $tableWidth = 700, $table_cellSpacing = 0, $table_cellPadding = 0, $table_tableBorder = 0, $table_params = null) { $buffer = ""; // Get statistics $totalSongs = number_format(count($this -> m3uFile_SongTitles)); $totalPlayTime = 0; foreach($this -> m3uFile_SongLengths as $length) $totalPlayTime += $length; $totalPlayTime = $this -> formatPlayTime($totalPlayTime); // Output if($drawTable) { $buffer .= "<table width=\"{$tableWidth}\" cellspacing=\"{$table_cellSpacing}\" cellpadding=\"{$table_cellPadding}\" border=\"{$table_tableBorder}\" {$table_params}>\n"; $buffer .= "<tr>\n"; if($sortWhat == "songTitle") { if($sortDirection == "asc") $buffer .= " <td align=\"center\" {$table_params}>[ASC] <u><strong>Title</strong></u></td>\n"; else $buffer .= " <td align=\"center\" {$table_params}>[DESC] <u><strong>Title</strong></u></td>\n"; } else { $buffer .= " <td align=\"center\" {$table_params}><strong>Title</strong></td>\n"; } if($sortWhat == "songLocation") { if($sortDirection == "asc") $buffer .= " <td align=\"center\" {$table_params}>[ASC] <u><strong>Location</strong></u></td>\n"; else $buffer .= " <td align=\"center\" {$table_params}>[DESC] <u><strong>Location</strong></u></td>\n"; } else { $buffer .= " <td align=\"center\" {$table_params}><strong>Location</strong></td>\n"; } if($sortWhat == "songLength") { if($sortDirection == "asc") $buffer .= " <td align=\"center\" {$table_params}>[ASC] <u><strong>Length (secs)</strong></u></td>\n"; else $buffer .= " <td align=\"center\" {$table_params}>[DESC] <u><strong>Length (secs)</strong></u></td>\n"; } else { $buffer .= " <td align=\"center\" {$table_params}><strong>Length (secs)</strong></td>\n"; } $buffer .= "</tr>\n"; switch($sortWhat) { // Sort by song title (using $sortDirection) -- this is the default sorting method case "songTitle": { $songTitles = $this -> m3uFile_SongTitles; natcasesort($songTitles); if($sortDirection == "desc") $songTitles = array_reverse($songTitles); foreach($songTitles as $key => $title) { $title = trim($title); $location = trim($this -> m3uFile_SongLocations[$key]); $length = trim($this -> m3uFile_SongLengths[$key]); $buffer .= "<tr>\n"; $buffer .= " <td {$table_params}>{$title}</td>\n"; $buffer .= " <td {$table_params}>{$location}</td>\n"; $buffer .= " <td {$table_params}>{$length}</td>\n"; $buffer .= "</tr>\n"; } } break; // Sort by song location (using $sortDirection) case "songLocation": { $songLocations = $this -> m3uFile_SongLocations; natcasesort($songLocations); if($sortDirection == "desc") $songLocations = array_reverse($songLocations); foreach($songLocations as $key => $location) { $title = trim($this -> m3uFile_SongTitles[$key]); $location = trim($location); $length = trim($this -> m3uFile_SongLengths[$key]); $buffer .= "<tr>\n"; $buffer .= " <td {$table_params}>{$title}</td>\n"; $buffer .= " <td {$table_params}>{$location}</td>\n"; $buffer .= " <td {$table_params}>{$length}</td>\n"; $buffer .= "</tr>\n"; } } break; // Sort by song length (using $sortDirection) case "songLength": { $songLengths = $this -> m3uFile_SongLengths; natsort($songLengths); if($sortDirection == "desc") $songLengths = array_reverse($songLengths); foreach($songLengths as $key => $length) { $title = trim($this -> m3uFile_SongTitles[$key]); $location = trim($this -> m3uFile_SongLocations[$key]); $length = trim($length); $buffer .= "<tr>\n"; $buffer .= " <td {$table_params}>{$title}</td>\n"; $buffer .= " <td {$table_params}>{$location}</td>\n"; $buffer .= " <td {$table_params}>{$length}</td>\n"; $buffer .= "</tr>\n"; } } break; } // Vertical table Break $buffer .= "<tr>\n"; $buffer .= " <td colspan=\"3\" {$table_params}> </td>\n"; $buffer .= "</tr>\n"; // Stats $buffer .= "<tr>\n"; $buffer .= " <td colspan=\"3\" align=\"center\" {$table_params}>There are {$totalSongs} songs</td>\n"; $buffer .= "</tr>\n"; $buffer .= "<tr>\n"; $buffer .= " <td colspan=\"3\" align=\"center\" {$table_params}>Combined play time of {$totalPlayTime}.</td>\n"; $buffer .= "</tr>\n"; $buffer .= "</table>\n"; } else { foreach($this -> m3uFile_SongTitles as $key => $title) { $location = $this -> m3uFile_SongLocations[$key]; $length = $this -> m3uFile_SongLengths[$key]; $buffer .= "Song Title: {$title} - Song Location: {$location} - Song Length: {$length} seconds\n<br />\n"; } $buffer .= "There are a total of {$totalSongs} with a combined play time of {$totalPlayTime}."; } return $buffer; } /** * @desc Format a human-readable length time * @return string Returns a formatted, human-readable play time length */ public function formatPlayTime($seconds) { $return = ""; $hours = intval(intval($seconds) / 3600); if($hours > 0) $return .= "$hours hours, "; $minutes = (intval($seconds) / 60) % 60; if($hours > 0 || $minutes > 0) $return .= "$minutes minutes, and "; $seconds = intval($seconds) % 60; $return .= "$seconds seconds"; return $return; } /** * @desc Prints each array (Song Lengths, Song Titles, Song Locations) */ public function debug() { echo "<pre>"; print_r($this -> m3uFile_SongLengths); print_r($this -> m3uFile_SongTitles); print_r($this -> m3uFile_SongLocations); echo "</pre>"; } } # Initiate the m3u parser class using "Skillet.m3u" $m3uParser = new m3uParser("tv_channels_M.m3u"); # Debug/print all records (Song lengths, Song Titles, Song Locations) # Note: Each element in an array will be the same key across all three arrays #$m3uParser -> debug(); # Output m3u information in a human-readable format # Acceptable parameter for 1st parameter: "songTitle" "songLocation" and "songLength" # Acceptable parameter for 2nd parameter: "asc" or "desc" - lowercase echo $m3uParser -> prettyOutput("songLength", "desc", true, "100%", 5, 5, 1, "center", "style=\"border: 1px solid #000;border-collapse: collapse;\""); # Search titles for (string)"STRING" or (array)array("string1", "string2", "string3", "etc") #print_r($m3uParser -> searchTitles(array("s", "k", "omg"))); # Search locations for (string)"STRING" or (array)array("string1", "string2", "string3", "etc") #print_r($m3uParser -> searchLocations(array("DEMO", "mu"))); # Search song lengths less than, less than or equal to, greater than, greater than or equal to, in between $start and $end #print_r($m3uParser -> searchLengths(0, array(331, 293, 271)));
  15. techker

    image uploader issue...

    ok cool i will check on my server.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.