Jump to content

scuff

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

scuff's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a php generated image: (number.txt contains a number 1 or 2) pic.php <?php // Set the content-type header('Content-type: image/bmp'); // Create the image $im = imagecreatetruecolor(80, 80); $count_my_page = ("number.txt"); $hits = file($count_my_page); if ($hits[0] == 1) { $im = imagecreatefrompng("image1.png"); $hits[0] ++; $fp = fopen($count_my_page , "w"); fputs($fp , "$hits[0]"); fclose($fp); }else{ $im = imagecreatefrompng("image2.png"); $hits[0] --; $fp = fopen($count_my_page , "w"); fputs($fp , "$hits[0]"); fclose($fp); } // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 1, 1, 1); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> And I have another page index.html <img src="pic.php"> <img src="pic.php"> Basically, I need one of the images on the index page to be image1 and then the second image to be image2, but it must be contained within the php file because I am unable to edit index.html. Is there anyway to do this? The method I have now where it reads a file to see if it's value is 1 or 2 doesn't seem to compute each time the image is generated. I have tried header("Cache-Control: no-cache"); header("Pragma: no-cache"); in the image code to force it not to cache but to no avail. Can anyone solve this?
  2. javascript.js function page2() { intervalID = window.setInterval(page2scroll, 15); } var dist = 0; function page2scroll() { dist += 10; window.scrollTo(dist, 0); if (dist>1440) { clearinterval(intervalID); } } index.phtml <html> <head> <script src="javascripts.js" type="text/javascript"></script> <link rel="stylesheet" href="formats.css" type="text/css"> </head> <body id="bodyid"> <div class="page1"> Hello <br> <a href="list.php">List all files in directory?</a> <a onclick="page2();" href="javascript:void(0);">2nd page?</a> </div> <div class="page2"> page 2 </div> </body> </html> When you click on <a onclick="page2();" href="javascript:void(0);">2nd page?</a> it is supposed to make your browser scroll over to another part of the site. It works wonderfully in firefox, chrome but not IE (v 7). I've looked up workarounds but none seem to work can anyone get this to work in ie? The problem in the javascript lies in window.scrollTo(dist, 0);. Thanks!
  3. Google Chrome 8.0.552.224 (Official Build 68599) <html> <body> <a href="http://google.ca" onclick="if ( !confirm ('GO?') ) { return false; }"> <img border="0" src="http://www.google.ca/intl/en_com/images/srpr/logo1w.png"> </a> </body> </html> when you put this javascript code into the address bar: javascript: window.document.getElementsByTagName('a')[0].click(); it does not work however it works in IE are there any workarounds to this? (the click function works if there is no confirm there)
  4. lol good just making sure for security reasons on my site I'm trying to disable every possible way of redirecting
  5. I tried putting <meta http-equiv="refresh" content="0;url=http://example"> on page2.php but it didn't work, so basically you can't redirect from img src, right?
  6. Is it possible to do something like this: page 1: <img src="page2.php"> page2.php: <?php header("Location: http://www.example.com/"); ?> Basically I want to know if page1 can redirect to a page specified by page 2 using img src. Is that possible?
  7. thanks a lot! it seems to be working in ie and i'll test in other browsers later
  8. so I have this code that uses ajax to update every second and because internet caches I need to use urls with random queries on the end like this var randomnumber = Math.floor(Math.random()*1000001) var file = 'serverTime.php?dummy='+randomnumber; ajaxRequest.open("GET", file, true); ajaxRequest.send(null); but the problem is, is that it creates a lot of files in the temporary internet files folder, so if they are on the page for along time it makes a lot of files and takes up room on their hard drive. Is there any way to do this without creating thousands of temporary files?
  9. the Cpanel X - file manager or sometimes Notepad
  10. I don't want it to indent after I save the code and go to the site, I want it to already be indenting when I'm editing by inserting one character instead of like 10 spaces. But I can't use tab because I'm not editing my files with Microsoft Word and that HTML stuff won't work either because I want it to be indented even if I view the source etc.... I could just copy the indent from Microsoft Word and paste it into my text, but I was wondering if you could do that with an alt code or something
  11. In PHP I would like to indent, but I can't find a way to do it (I can't find an alt code to do the indent like in Microsoft Word) Does anyone know the alt code to do it?
  12. Please explain why this sometimes outputs nothing: <?php $morecharacters = "1234567890abcedefghijklmnopqrstuvwxyz"; echo $morecharacters[mt_rand(0, strlen($morecharacters))-1]; ?>
  13. Thanks both of you, but I think I will use thorpes since it's shorter
×
×
  • 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.