Jump to content

scuff

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by scuff

  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
  14. Ok I have a code: <?php $array1 = array(); $array1[0] = "hey hey"; $array1[1] = "hey hey"; $counter = count($array1); for ($p = 0; $p < $counter; $p++) { $arraynew.$p = explode(" ", $array1[$p]); } ?> Basically what I want it to do is create a new array for each one of the array values. But the problem is that $arraynew.$p isn't working, it just sets the array to $p instead of what I want: arraynew0 then arraynew1 etc.. If you have any questions or anything just ask. thanks!
  15. I've already looked at this http://ca.php.net/manual/en/function.setcookie.php and the ways it says to do it aren't working for me
  16. Even if that's true I would still like to know how to do it..
  17. I've tried those and they didn't work. I also tried them again just incase and it still didn't work.
  18. I tried to do that but it wasn't working so could somehow tell me a code that works because the ones I tried in the first post didn't work...
  19. So how could I get it to not detect that cookie anymore... I'm using if(isset($_COOKIE['account'])) { to detect it.
  20. setcookie('account', $_POST['account']); It seems impossible to delete this cookie! I've tried many things like: setcookie("account", "", time()-20000, "/", "domain.com" ); setcookie("account", "", time()-20000); etc... could anyone tell me how to do this?
  21. Is something like this possible? //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.getElementById('test').innerHTML = ajaxRequest.responseText; } } var file = 'site'; ajaxRequest.open("GET", file, true); var params = "renewer=1"; ajaxRequest2.open('POST', 'site.html', true); ajaxRequest2.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxRequest2.setRequestHeader("Content-length", params.length); ajaxRequest2.setRequestHeader("Connection", "close"); ajaxRequest2.send(params); } I'm trying to get it to post something to a page and read a page at the same time.
×
×
  • 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.