Jump to content

robindean

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

robindean's Achievements

Member

Member (2/5)

0

Reputation

  1. Is there a simple (but effective) way to determine if the .php url being requested is coming from an embedded flash document?
  2. Hi all. I'm trying to generate a "play button" using only php. Better explained, what I need is to generate a transparent png of an equilateral triangle (turned on it's side). I have no idea where to begin. I've done some php based opening and resizing of images but never this. The more you're comfortable contributing, code wise, the better off I'll be. Any takers?
  3. I think I found the problem. It was with my css / javascript file. From external .css and .js ... I'm supposed to go ahead and use plain old "&" in the url right? It's only for plain text / html that & is required? At any rate, the browser isn't showing the url related errors any more (iCab for mac shows when a url isn't encoded correctly).
  4. I get the following for http://localhost/index.php?display=img&w=1&h=1&c=5d2e23 ... array(4) { ["display"]=> string(3) "img" ["w"]=> string(1) "1" ["h"]=> string(1) "1" ["c"]=> string(6) "5d2e23" } display=img&w=1&h=1&c=5d2e23 and then when I type & in place of & for the address bar, I get ... array(4) { ["display"]=> string(3) "img" ["amp;w"]=> string(1) "1" ["amp;h"]=> string(1) "1" ["amp;c"]=> string(6) "5d2e23" } display=img&w=1&h=1&c=5d2e23
  5. That doesn't seem to have any effect. I believe my problem might be stemming from this part of my code (but I have NO idea where or why) ... $display = $_GET['display']; if ($display == 'img') { header("Content-type: image/png"); $f = $_GET['f']; $w = $_GET['w']; $h = $_GET['h']; if ($f != null) { $t = substr($f, 0, -4).'_'.$w.'x'.$h.'.png'; if (file_exists($t)) header('location: '.$t); else { list($wo, $ho) = getimagesize($f); $ip = imagecreatetruecolor($w, $h); $img = imagecreatefrompng($f); imagecopyresampled($ip, $img, 0, 0, 0, 0, $w, $h, $wo, $ho); imagepng($ip, $t, 9); imagepng($ip, null, 9); } } else { $c = strtolower($_GET['c']); if ($w == $h) $t = 'bg/bg_'.$c.'.png'; else if ($w < $h) $t = 'bg/bg_hr_'.$c.'.png'; else $t = 'bg/bg_vr_'.$c.'.png'; if (file_exists($t)) header('location: '.$t); else { $img = @imagecreate($w, $h); sscanf($c, "%2x%2x%2x", $r, $g, $b); $sc = ImageColorAllocate($img, $r, $g, $b); if ($w != $h) { $a = imagecolorallocatealpha($img, 0, 0, 0, 127); if ($w < $h) ImageSetPixel($img, 0, 1, $a); else if ($w > $h) ImageSetPixel($img, 1, 0, $a); } imagepng($img, $t, 9); imagepng($img, null, 9); } } } Anything standing out to you?
  6. Okay, well, my exact html (one example) reads as follows ... <div id="curtain" style="width:100%;height:100%;position:fixed;top:0;left:0;z-index:2;background:#5d2e23 url(index.php?display=img&w=1&h=1&c=5d2e23);"></div> ... if you look at the url() part for the style attributes ... where exactly am I going wrong with this code? How am I to correct it? I've read about htmlspecialchars() but not htmlentities() and couldn't really grasp what I was supposed to do (or where) with it. Please keep posting so that I might solve this issue
  7. It's a simple thing, really. HTML validation requires that url requests use "&" in place of "&". So, rather than going through a headache process of switching between the two, I simple grab the entire query string (via php on server side) and convert it for easier use. ACCEPT ... I don't know how to use it! I'm not convinced about explode, as it creates bunch of difficulty with becoming an array. I'd rather go about it by finding the variable we need the value for within the string and grabbing ONLY the value. So, if the string is "display=yes&tomorrow=100&you=helpful" ... and I want to grab the VALUE of tomorrow (100) from what is now a STRING (can't use $_GET anymore) ... how?
  8. Ampersands are causing chaos for my pages. If I don't use "&" in a url, my pages won't validate. If I do, php appends only the "amp;" part to each of my variables. So, I've devised a solution which is yet to be complete (I need help). Basically, I'm starting off with ... $query = str_replace('&', '&', $_SERVER['QUERY_STRING']); This grabs the entire query and replaces "&" with simply "&". I need a way to locate specific variable values within this, using a method similar to $_GET. Is there a $_GET method for strings? If not and a function is necessary, please guide me through it. The function call should work in a manner such as ... $myVariable = GetVarValue('Variable_Name'); How?
  9. Hello all. I'm in need of a simple script to replace color tones in a png image with another color. I've researched imagesetpixel and other methods but am unable to find something that will perfect the alpha transparencies. Assuming that my image is text, on a transparent background, grayscale and rendered with font smoothing active (creates alpha transparencies to soften edges) ... How might I go about doing this while maintaining visual quality?
  10. I've read a little about ajax but not enough to be anything but newb. My angle is to butter-up the earlier v3 browsers and let them slide gracefully into a "You're viewing this page through an unsupported browser" page. Object detection is great but I'm still getting errors. I was hoping PHP might save the day.
  11. Okay, Based on all of this, I can only assume that it is impossible to detect what version of javascript is supported via php and present content based on the results. If someone were to devise a way, I assume that one couldn't run it without getting error messages or alert dialog from older browsers. Am I right?
  12. But this requires javascript ... whereas I'm hoping to use php. Your link is appreciated, regardless
  13. I don't want to browser sniff ... just browser "whiff". Is there a way to determine what version of javascript is supported by a users browser? I'm trying to say "if you have javascript 1.5 or better, cool, otherwise we're in trouble".
  14. I got it working. Here's a scaled down rendering of what I came up with. Note that it makes use of layout elements the one likely wouldn't want on their site as opposed to my own ... <?php $date = date("Ymd"); <blogger>$post<blogdateheader><$blogdateheaderdate$></blogdateheader> = "<blogdateheader><$blogdateheaderdate$></blogdateheader>"; $date<blogdateheader><$blogdateheaderdate$></blogdateheader> = date("n.j.Y (l)",strtotime('<blogdateheader><$blogdateheaderdate$></blogdateheader>')); $body<blogdateheader><$blogdateheaderdate$></blogdateheader> = " - <$blogitemtitle$></b></span><br><span class=\"purple\"><$blogitembody$><br><br>"; $build<blogdateheader><$blogdateheaderdate$></blogdateheader> = $post<blogdateheader><$blogdateheaderdate$></blogdateheader>.$date<blogdateheader><$blogdateheaderdate$></blogdateheader>.$body<blogdateheader><$blogdateheaderdate$></blogdateheader>; </blogger>$array = array(<blogger>$build<blogdateheader><$blogdateheaderdate$></blogdateheader>, </blogger>null); sort($array); foreach ($array as $output) { print substr($output, ; } ?>
  15. Let's say I have 3 posts which I've published via blogger. That would convert this ... <?php $date = date("Ymd"); <blogger>if ($date <= <blogdateheader><$blogdateheaderdate$></blogdateheader>) { print ('<span class="blue"><b>'); print date("n.j.Y (l)",strtotime('<blogdateheader><$blogdateheaderdate$></blogdateheader>')); print (' - <$blogitemtitle$></b></span><br><$blogitembody$><br><br>'); } </blogger> ?> into this ... <?php $date = date("Ymd"); if ($date <= 20070318) { print ('<span class="blue"><b>'); print date("n.j.Y (l)",strtotime('20070318')); print (' - Live Performance @ Poopy Joe/'s Poop Shack</b></span><br>Be there or smell better</span><br><br>we/'re gonna have a poopy time<br><br>'); } if ($date <= 20070316) { print ('<span class="blue"><b>'); print date("n.j.Y (l)",strtotime('20070316')); print (' - Live Performance @ Bumb Spankers Hoo-Ha</b></span><br>Featuring Linda Lovelace</span><br><br>we/'re gonna have a bang<br><br>'); } if ($date <= 20070313) { print ('<span class="blue"><b>'); print date("n.j.Y (l)",strtotime('20070313')); print (' - Live Performance @ Yo Yo Ma/'s Mama/'s House</b></span><br>Featuring Yo Yo Ma on Cello and Skin Flute</span><br><br>Mama be bakin/'<br><br>'); } ?> Now, assuming that todays date is March 15th, only the first two posts will be displayed (be reminded, I'm posting with future dates because these are upcoming music performances). The reason, if not obvious, is because the third $dates is NOT greater than or equal to the date of the post. So, this much I have working and working nicely. The problem is that I don't want for viewers to see the last show on my schedule first. I want them to see the NEXT upcoming show FIRST. I need to rewrap everything which falls below/between $date = date("Ymd"); and ?> in chronological order by $date. My calculations on how to even start are foggy. Any help will just make me that much smarter.
×
×
  • 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.