Jump to content

drisate

Members
  • Content Count

    805
  • Joined

  • Last visited

Community Reputation

1 Neutral

About drisate

  • Rank
    Prolific Member

Profile Information

  • Gender
    Not Telling
  1. It's actually complicated ... we own the website but not the DB and that makes it hard for us to develop any new features. They want us to hire them ... Just trying to show my boss we can manage with out them lol
  2. Hey guys I am testing a query that returns: function is called Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes) now i know i can change the memory limit ... but I would prefer optimizing the query instead. select * from devices where hardware_id=(select hardware_id from (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME ='hardware_id' order by TABLE_NAME asc limit 1) as T where hardware_id!='' order by id asc limit 1) Is there a better way of searching for hardware_id in the first found table that contains them? I tryed adding the limit 1 param in both sub query's ... but that did not change the allowed memory error. I wish i had the database table structure but I am flying blind ... Thx in adavnce
  3. Hey guys, i have an XML file that looks like this: <?xml version="1.0" encoding="UTF-8"?> <data> <debug>1</debug> <db> <host>localhost</host> <user>***</user> <pass>***</pass> <name>***</name> </db> <config> <path_to_site>***:81</path_to_site> <path_to_movies>media</path_to_movies> <full_path_to_movies>/var/www/media/movies/</full_path_to_movies> <full_path_to_shows>/var/www/media/shows/</full_path_to_shows> <tmdb_api_key>***</tmdb_api_key> <lang_api_key>***</lang_api_key> <tvdb_api_key>***</tvdb_api_key> <allowed_movie_ext> <ext>mp4</ext> <ext>m4v</ext> </allowed_movie_ext> <delete_skiped>1</delete_skiped> <system>linux</system> <lastmovies>25</lastmovies> <language>en</language> <country>US</country> <debug>0</debug> <junk> <word>1080p</word> <word>BluRay</word> <word>x264</word> <word>YIFY</word> <word>YIFY</word> <word>BrRip</word> <word>BOKUTOX</word> <word>YIF</word> <word>bitloks</word> <word>deceit</word> <word>BrRip</word> <word> GAZ</word> <word>GAZ</word> <word>UNRATED</word> <word>ECE</word> <word>mkv</word> <word>DVDSCR</word> <word>XViD</word> <word>FRENCH</word> <word>TS</word> <word>MD</word> <word>SKuLL322</word> <word>DTS</word> <word>Multi</word> <word>bluray</word> <word>net</word> <word>torrentfrancais</word> <word>truefrench</word> <word>5.1</word> <word>\xb7</word> </junk> <user_lang> <lang>en</lang> <lang>fr</lang> <lang>es</lang> </user_lang> </config> <hdd> <path> <torrent_path>/var/Simflix/scripts/addons/torrent/</torrent_path> <temp_path>/var/Simflix/scripts/addons/temp/</temp_path> <save_path>/mnt/My Book 4/media/series temp/</save_path> </path> <path> <torrent_path>/var/Simflix/scripts/addons/rss_download/torrents/</torrent_path> <temp_path>/var/Simflix/scripts/addons/temp/</temp_path> <save_path>/mnt/My Book 4/media/movies temp/</save_path> </path> </hdd> </data> I use that XML data in my website like this: $config = simplexml_load_file('/var/Simflix/www/config.xml'); It working great but now i need to create a code that would edit that XML file ... So fare i manager to do this: function print_input($name, $value){ print (' <div class="formRow"> <label>'.ucfirst($name).': </label> <div class="formRight"> <input id="name" name="'.$name.'" value="'.$value.'" class="span input" type="text"/> </div> </div> '); } function print_input_array($name, $value, $title){ $rand = rand("999999999", "999999999999"); print (' <div class="formRow"> <label><span class="addmore" name="'.$name.'" rel="g'.$rand.'" style="cursor:pointer">(ADD)</span> '.ucfirst($title).': </label> <div id="g'.$rand.'" class="formRight"> <input id="name" name="'.$name.'[]" value="'.$value.'" class="span input" type="text"/> </div> </div> '); } $config_array = get_object_vars($config); foreach($config_array[db] as $name=>$value){ print_input($name, $value); } foreach($config_array[config] as $name=>$value){ if (is_array($value)){ foreach($value as $name1=>$value1){ print_input_array($name1, $value1, $name); } }else{ print_input($name, $value); } } But for some reason, the print_input_array() is not triggured when i get to the allowed_movie_ext, junk, user_lang [...] Is there a better way of making an HTML form from a XML object?
  4. Normaly "imagepng($dst,$dest_file);" replaces that and avoids uploading user content to the server in case the file is infected
  5. I need to upload 3 images and resize them as part of a forme but for some reason, the images does not end up in the server directory. What am i missing? The fille array looks like this: Array ( [file1] => Array ( [name] => s_casafolio.png [type] => image/png [tmp_name] => /tmp/phpENy7j4 [error] => 0 [size] => 2047496 ) [file2] => Array ( [name] => lawjournal.png [type] => image/png [tmp_name] => /tmp/phpT0fu1Y [error] => 0 [size] => 1139448 ) [file3] => Array ( [name] => s_mdj_2.png [type] => image/png [tmp_name] => /tmp/phpUsRk6W [error] => 0 [size] => 792873 ) ) And my processing looks like this: <?php $tmp = md5(md5(date("YmdHis"))); $img_quality = 70; $maxDim = 700; $dest_folder = "/home/user/public_html/userfiles/inscription_designer/"; $valid_mime_types_images = array( "image/gif", "image/png", "image/jpeg", "image/pjpeg", ); if (in_array($_FILES["file1"]["type"], $valid_mime_types_images)) { $ext = pathinfo($_FILES['file1']['name'], PATHINFO_EXTENSION); $dest_file = $dest_folder.$tmp.'1.'.$ext; $fn = $_FILES['file1']['tmp_name']; $size = getimagesize($fn); $ratio = $size[0]/$size[1]; // width/height if( $ratio > 1) { $width = $maxDim; $height = $maxDim/$ratio; } else { $width = $maxDim*$ratio; $height = $maxDim; } $src = imagecreatefromstring(file_get_contents($fn)); $dst = imagecreatetruecolor($width,$height); imagecopyresampled($dst,$src,0,0,0,0,$width,$height,$size[0],$size[1]); imagedestroy($src); imagepng($dst,$dest_file); // adjust format as needed imagedestroy($dst); }else{ $err .= "- Image 1 est invalide.<br />"; } if (in_array($_FILES["file2"]["type"], $valid_mime_types_images)) { $ext = pathinfo($_FILES['file2']['name'], PATHINFO_EXTENSION); $dest_file = $dest_folder.$tmp.'2.'.$ext; $fn = $_FILES['file2']['tmp_name']; $size = getimagesize($fn); $ratio = $size[0]/$size[1]; // width/height if( $ratio > 1) { $width = $maxDim; $height = $maxDim/$ratio; } else { $width = $maxDim*$ratio; $height = $maxDim; } $src = imagecreatefromstring(file_get_contents($fn)); $dst = imagecreatetruecolor($width,$height); imagecopyresampled($dst,$src,0,0,0,0,$width,$height,$size[0],$size[1]); imagedestroy($src); imagepng($dst,$dest_file); // adjust format as needed imagedestroy($dst); }else{ $err .= "- Image 2 est invalide.<br />"; } if (in_array($_FILES["file3"]["type"], $valid_mime_types_images)) { $ext = pathinfo($_FILES['file3']['name'], PATHINFO_EXTENSION); $dest_file = $dest_folder.$tmp.'3.'.$ext; $fn = $_FILES['file3']['tmp_name']; $size = getimagesize($fn); $ratio = $size[0]/$size[1]; // width/height if( $ratio > 1) { $width = $maxDim; $height = $maxDim/$ratio; } else { $width = $maxDim*$ratio; $height = $maxDim; } $src = imagecreatefromstring(file_get_contents($fn)); $dst = imagecreatetruecolor($width,$height); imagecopyresampled($dst,$src,0,0,0,0,$width,$height,$size[0],$size[1]); imagedestroy($src); imagepng($dst,$dest_file); // adjust format as needed imagedestroy($dst); }else{ $err .= "- Image 3 est invalide.<br />"; } ?>
  6. Ok well i am gething closser ... I decided to use the xpath querry to point at the correct table in the page. It will be alot easyer to pin-point the data this way. The dump looks like: http://eric.webiummedia.com/scrap.php Now what i need is from the $elements loop all the TD's and retrive the HTML inside
  7. Well as you can imagine, the dump of the $tr var is very big ... would be a lot easyer if you would just execute the provided code.
  8. You can do that from your script.js page. Inside the sucess part of the script, you can add something like: $("#todoList").load( "index.php #todoList"); In order for this to work, add an id attribute to the <ul class="todoList"> like this <ul class="todoList" id="todoList"> Then in the code i provided insert the URL of your totdo page at the place of index.php This will fetch the page, retreive the #todoList content and replace it and all that with out refreshing the users page ... only the content will change.
  9. Hey guys i need help with a CURL code. I need to retreive all the data in a table located at http://www.listenlive.nl/tvgenre.php?g=1&page=0 and parse the data to finish with an array that looks like this: $row[0][station_name] = '3BTV'; $row[0][stream_link] = '420'; $row[0][stream_type] = 'wma'; $row[0][country] = 'United Kingdom'; $row[0][genre][0] = 'Variety'; $row[0][genre][1] = 'Alternative'; $row[0][genre][2] = 'Culture'; $row[0][rating] = '1/5'; I need that for each rows of the table where the first array number would increment $row[1], $row[2] ... My PHP code is incomplete. I currently have a loop for all the TR's of the page ... and when i loop all the TD's inside the TR's it returns a load of crap ... I am unsure where to go from here. Any help would be apreciated thx This is my code: $ch = curl_init(); $categ[url] = 'http://www.listenlive.nl/tvgenre.php?g=1&page=0'; curl_setopt($ch, CURLOPT_URL, $categ[url]); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); curl_setopt($ch, CURLOPT_COOKIE, $cookies); curl_setopt($ch, CURLOPT_REFERER, $categ[url]); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, $nav); $data2 = curl_exec($ch); $dom2 = new DOMDocument(); libxml_use_internal_errors(true); $dom2->loadHTML($data2); $trs = $dom2->getElementsByTagName('tr'); foreach ($trs as $tr) { echo "<pre>"; print_r($tr); echo "</pre>"; }
×
×
  • Create New...

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.