Jump to content

ElectricShaka

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ElectricShaka's Achievements

Member

Member (2/5)

0

Reputation

  1. I believe I figured it out with Fang's help. This was the method I ended up using: function swapStyleSheet(id, cssfileName) { var ss=document.getElementById(id); var parent=document.getElementsByTagName('head')[0]; parent.removeChild(ss) var o = document.createElement('link'); o.setAttribute('type', 'text/css'); o.href = cssfileName; o.setAttribute('rel', 'StyleSheet'); o.id = id; parent.appendChild(o); } Thanks Fang.
  2. I'm trying to do a client side include of dynamic css pages with javascript. My code on my main page looks like this: <style type="text/css" id="layout_color_css"> </style> And then the function I'm using on an external javascript page is: function clientSideInclude(id, url) { var req = false; // For Safari, Firefox, and other non-MS browsers if (window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch (e) { req = false; } } else if (window.ActiveXObject) { // For Internet Explorer on Windows try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { req = false; } } } var element = document.getElementById(id); if (!element) { alert("Bad id " + id + "passed to clientSideInclude." + "You need a div or span element " + "with this id in your page."); return; } if (req) { // Synchronous request, wait till we have it all req.open('GET', url, false); req.send(null); element.innerHTML = req.responseText; } else { element.innerHTML = "Sorry, your browser does not support " + "XMLHTTPRequest objects. This page requires " + "Internet Explorer 5 or better for Windows, " + "or Firefox for any system, or Safari. Other " + "compatible browsers may also exist."; } } I'm calling the function when a user clicks on an image on the page with code like this: <span class="layout" onclick="clientSideInclude('layout_color_css', 'land/land1.css');"><img src="elements/layout/1click/layout_3.gif" width="52" height="41" alt="" /></span> This works in firefox...the external css is called when the button is clicked and everything looks fine. It does NOT work in internet explorer though. Any help is greatly appreciated.
  3. Does anyone know how to correctly set permissions on a Windows 2003 Server running xammplite to allow a php script to use the exec() function to run an .exe file much like you would from command line?
  4. Ok I've been reading any documentation I can find on this stuff. I'm now trying the following 2 things and neither are working. <?php $title = $_GET[title]; $title = str_replace(" ","%20",$title); $name = $_GET[name]; $command = '/webshotcmd.exe /url "http://www.myurl.com/preview.php?prev='.$title.'" /out "images/'.$name.'" /width "300" /height "240" /bwidth "768" /bheight "1024"'; exec($command, $output, $return); print_r($output); print_r($return); which give me this when I run the page: Array ( ) 1 and then: $path = "C:/xampplite/htdocs/WebShot/"; $exe = "webshotcmd.exe"; $args = '/url "http://www.myurl.com/preview.php?prev='.$title.'" /out "images/'.$name.'" /width "300" /height "240" /bwidth "768" /bheight "1024"'; function execInBackground($path, $exe, $args = "") { global $conf; if (file_exists($path . $exe)) { chdir($path); if (substr(php_uname(), 0, 7) == "Windows") { pclose(popen("start \"bla\" \"" . $exe . "\" " . escapeshellarg($args), "r")); } else { exec("./" . $exe . " " . escapeshellarg($args) . " > /dev/null &"); } } else { echo "File didn't exist"; } } execInBackground($path, $exe, $args); I've tried modifying some permissions on my home server (running Xampplite) but I'm not sure if I did it correctly. The program still refuses to launch. Any help is greatly appreciated.
  5. Yes I suppose it does. It opens a status window which stays open for the length of the execution...perhaps 5 seconds? Then it creates an image file.
  6. I fixed that other variable and checked that safe mode is not turned on. The program still doesn't run. I even tried adding the path of the .exe to the environment variable's Path. Still no luck. ???
  7. Thanks again 8ball that fixed the Variable error but it's still not working. The code in the exec() is identical to code I would put in my command line on the windows computer to run that program and output the correct file but it doesn't do it I have the monitor up on the other computer and everything. I don't see the program even open up like it would if I manually put it in the command line.
  8. Thanks 8ball, Now I'm getting Parse error: syntax error, unexpected T_VARIABLE in C:\xampplite\htdocs\takeScreen.php on line 7 Here is the top of my updated code: <?php $title = $_GET[title]; $title = str_replace(" ","%20",$title); $name = $_GET[name]; exec('webshotcmd.exe /url "http://www.myurl.com/preview.php?prev='.$title.'" /out "images/$name" /width "300" /height "240" /bwidth "768" /bheight "1024"')
  9. I have a spare computer with xampplite installed. I'm using this computer as a server. I have a program installed on this server computer which I'm trying to run with the exec function in a php page. This is my first time using exec() so I'm sure I have something wrong with my code because the program does not run at all. If anyone could offer me some advice I'd greatly appreciate it. exec(webshotcmd.exe /url "http://www.myurl.com/preview.php?prev=$title" /out "images/$name" /width "300" /height "240" /bwidth "768" /bheight "1024");
  10. I've been through those...unfortunately no free ones that do command line...or any even under $40 for that matter. SnagIt does minimal command-line that they shouldn't even mention because it's so limited.
  11. I'm looking for a server side program that can take screenshots of websites. The only one I've come across that looks good is WebShot http://www.websitescreenshots.com/ but the server edition is $110 which is a little bit expensive for a student like myself. Do any of you guys know of anything like this? Any advice is appreciated.
  12. I am using the following code to download images from the web to my server. $url = 'http://www.whateverurl.com/img.jpg'; $destination=fopen("myupload/newfile.jpg","w"); $source=fopen($url,"r"); while ($a=fread($source,1024)) fwrite($destination,$a); fclose($source); fclose($destination); This works perfectly when the image is on my site. But for any image anywhere else on the web it just ends up giving me a blank image on my ftp. Can you not use the fopen if it's a different URL or something? Is there a different function I should be using? My allow_url_fopen is enabled. Any help you can offer is greatly appreciated. ???
  13. I have css code that contains image links in it. What I would like to do have these images downloaded to my ftp. Can anyone point me in the right direction on this? Is there any sort of function that will pass through the code and recognize image files and download them to a specific directory? Any help is appreciated. ???
×
×
  • 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.