Search the Community
Showing results for tags 'background'.
-
Hello, PHP Friends! I wonder if somebody knows how to post or I better say call some URL like http://192.168.0.1/out.cgi?out1=1 from valid IP domain (server sees lan url) in background with Button click using form? For example to turn some device ON or OFF... I have tried with only PHP and also cURL but no luck <? //Check for status of device from xml (1 is Off & 0 is On) if ($xml->out1 == 1) { echo "<tr><td>OUT1</td><td><img src='images/red.png' alt='RED' height='23' width='23'></td><td><form method='post' action='index.php'><input type='hidden' value='out1' name='out1'><input type='submit' value='TURNON' name='TURNON'></form></td></tr>"; } else { echo "<tr><td>OUT1</td><td><img src='images/green.png' alt='GREEN' height='23' width='23'></td><td><form method='post' action='index.php'><input type='hidden' value='out1' name='out1'><input type='submit' value='TURNOFF' name='TURNOFF'></form></td></tr>"; } //cURL function to call URL with parameters function post_to_url($url, $data) { $fields = ''; foreach($data as $key => $value) { $fields .= $key . '=' . $value . '&'; } rtrim($fields, '&'); $post = curl_init(); curl_setopt($post, CURLOPT_URL, $url); curl_setopt($post, CURLOPT_POST, count($data)); curl_setopt($post, CURLOPT_POSTFIELDS, $fields); curl_setopt($post, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($post); curl_close($post); } //device URL $url = 'http://192.168.0.1/out.cgi'; //Turn on device $on = $_POST['name'] . '=0'; //Turn off device $off = $_POST['name'] . '=1'; //Check for Button action on user Click if(isset($_POST['TURNON'])) { post_to_url($url,$on); }elseif(isset($_POST['TURNOFF'])){ post_to_url($url,$off); }else{} ?> If I should use any other method, way, function, shell_exec etc..? Any suggestions, help is very welcome. Thank you.
- 2 replies
-
- lan url
- button post
-
(and 1 more)
Tagged with:
-
I was curious about how to make text look like its pressed into a header(using text-shadow) on a gradient background. I tried a letter press tutorial with no luck. My test site is here http://shockwave-technology.webs.com/template.html On the left side of the example ad I am hoping to use css to make a title text look like it is pressed into the header. Any help is appreciated.
-
I'm building a basic photo gallery, and I'm having difficulties with the 'Categories' section. The plan is to display all the picture categories inside divs, and have them 'rotate' their background images through the pictures in the given category. For instance, the 'Nature' category div would change its background every few seconds to a random image in the Nature category. I've succeeded doing this, but the code wasn't very efficient. Basically, I've had a JavaScript file gather all the categories (through uniquely assigned IDs) and "$.post" them to a PHP file which polled images with the given category from a database, loaded them into an array and returned a random key. Then, using intervals it updated the background every couple of seconds. But I'm looking for a better way to do it. I'd prefer to poll the database only once, at the start of the page, and then just let the JS file reload the rand() function each time the interval is called; but I'm not sure how to pass the polled data to the file that call the random function. Any ideas how to do this? Obviously, I'm not expecting anybody to write the code for me, I just need some assistance. Also, sorry if all this is a little unclear, it's 4am here, and I'm falling asleep; if you need me to explain just let me know. Thanks.
- 3 replies
-
- javascript
- slidshow
-
(and 3 more)
Tagged with:
-
I'm building a basic photo gallery, and I'm having difficulties with the 'Categories' section. The plan is to display all the picture categories inside divs, and have them 'rotate' their background images through the pictures in the given category. For instance, the 'Nature' category div would change its background every few seconds to a random image in the Nature category. I've succeeded doing this, but the code wasn't very efficient. Basically, I've had a JavaScript file gather all the categories (through uniquely assigned IDs) and "$.post" them to a PHP file which polled images with the given category from a database, loaded them into an array and returned a random key. Then, using intervals it updated the background every couple of seconds. But I'm looking for a better way to do it. I'd prefer to poll the database only once, at the start of the page, and then just let the JS file reload the rand() function each time the interval is called; but I'm not sure how to pass the polled data to the file that call the random function. Any ideas how to do this? Obviously, I'm not expecting anybody to write the code for me, I just need some assistance. Also, sorry if all this is a little unclear, it's 4am here, and I'm falling asleep; if you need me to explain just let me know. Thanks.
- 1 reply
-
- javascript
- slidshow
-
(and 3 more)
Tagged with:
-
Hi, I'm just messing around with a website and I'm just wondering how would I make it so that it changes the background image to a random one? I was thinking something around this: Images = new Array Images[1] = "Background-1.jpg" Images[2] = "Background-2.jpg" Images[3] = "Background-3.jpg" Images[4] = "Background-4.jpg" But Instead of it just changing when you refresh the page every time, I was hoping to have a timer or something fixed to it? Would it be possible to have it so it gets the time of the server and if that time is equal it'll change? Help will be much appreciated
-
On my website Is like this: Cart Buttons Products So, i want my background image to "stick" with the buttons and products, any idea how I can do that ? I can manage to load the background and no repeat, but I really need it to stick together with the content because when my cart gets filled up.. everything on the site will drop down some PX.. That is why I need it to stick. - Also thanks for everyone that answers, you are helping a lot!