Jump to content

KingdomTubes

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by KingdomTubes

  1. Since I had no idea how to make a database I continued this way, and this is the result. I called this function "onerror" function ImgError(data) { xmlhttp.open("POST","missing_image.php",false); xmlhttp.send('src='+data.src); data.src = "../../images/brokenlink.jpg"; } created a missing_image.php with this the following code <?php $src = isset($_POST['src']) ? $_POST['src'] : NULL; if( is_null($src) ) exit; $file = file_get_contents('links.txt'); $pattern = '/<div[^>]+>\s<a[^>]+>\s<img src="'.preg_quote($src,'/').'"[^>]+>\s</a>\s</div>/'; if( preg_match($pattern,$file,$match) ) { $newfile = str_replace($match[0],'',$file); file_put_contents('links.txt',$newfile); } ?> Still not working.. Any idea? (Thanks to Derokorian for the codes)
  2. could you give me some hints where to search for please(if you understand my problem for sure)? This would help me a lot
  3. I'm a bit new in all of this.. I began doing websites three months ago and learning it all by myself. I didn't know the possibility of database, I'll search about it. Thanks
  4. Hello, I'm requesting your help here cause I'm really confused. I'm looking for deleting entries when an image doesn't load on my links test. I got all my links in a .txt file like this : links.txt = <div class="gallery"> <a href="http://www.website.com/page"> <img src="http://tc16.easythumbhost.com/image.jpg" onerror="ImgError(this)"/> </a> </div> #enddiv the "onerror" code in img src sends an "Image Missing" pic. What I'd want is to change the "onerror" function to open a php script which deletes all the lines of the div. This is the script I use to show the links on my page : $links = "links.txt"; $fd = fopen ($links, "r"); $content = fread ($fd,filesize ($links)); fclose ($fd); $delimiter = "#enddiv"; $splitcontent = explode($delimiter, $content); $output = array_slice($splitcontent, 0,100); foreach ( $output as $divs ) { echo "$divs"; } I've searched hours and tried lots of codes before posting Help would be very appreciated. Thanks.
×
×
  • 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.