Jump to content

maymann

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by maymann

  1. SOLVED... Got it working... finally... Here is my working multisite index.php: <head> </head> <script type="text/javascript"> function setOptions(chosen){ var selbox = document.formName.ip; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('No site selected',' '); } if (chosen == "1") { selbox.options[selbox.options.length] = new Option(' ',' '); selbox.options[selbox.options.length] = new Option('HOSTNAME1','IP1'); selbox.options[selbox.options.length] = new Option('HOSTNAME2','IP2'); } if (chosen == "2") { selbox.options[selbox.options.length] = new Option(' ',' '); selbox.options[selbox.options.length] = new Option('HOSTNAME3','IP3'); selbox.options[selbox.options.length] = new Option('HOSTNAME4','IP4'); } } </script> <form name="formName" method="post" action="polycom-reboot.php"> Conference Phone Reboot <select name="site" size="1" onchange="setOptions(document.formName.site.options[document.formName.site.selectedIndex].value);"> <option value=" " selected="selected"></option> <option value="1">Site1</option> <option value="2">Site2</option> </select> <select name="ip" size="1" method="post" action="polycom-reboot.php"> <option value=" " selected="selected">No phone selected</option> </select> <input type="submit" value="Reboot..."/> </form> </body> </html>
  2. Please, can anyone help with this...? ~maymann
  3. Kicken, anyone... Thanks in advance :-) !
  4. Hi kicken, Thanks for your kind reply - this sounds/looks just like what i need...:-) To answer your questions: 1. you are right: passing, was the right word... 2. yes: IP is the value of each phone how do I make array in php... and how does this work now from web/shell ? I'm a bit confused - sorry for my php/java-script ignorance... Would it perhaps be possible for you to show me how/where this is done in my 2 files - I don't know how/where to edit this, eventhough you gave a nice explanation. Thanks in advance :-) ! ~maymann
  5. Please... can anyone help with this...?
  6. Can anyone help with this, please... Thanks in advance :-) ! ~maymann
  7. Can anyone help with parsing this java-script variable->PHP. Thanks in advance :-) ! ~maymann
  8. My new index.php actually doesn't give me an error..., but just "refreshes" and doesn't take me to polycom-reboot.php script as my old index.php does (showing the ip of the booting phone and a return button to take me back to index.php)
  9. I would like the same functionality as in my old index.php in my new index.php but with site+phone dropdowns (phones available should be dependent on what site you choose in the first dropdown) which is why i though of making it in javascript. My new index.php is failing, and therefore not doing its purpose, which is to reboot a VoIP phone... so what the script is doing wrong is actually kind of my question I guess... but my best guess is I'm not parsing [iP] the right way... Hope this sums it up. br. ~maymann
  10. Hi Scootstah, Thanks for your reply. I have already put all my scripts and briefly described what they do in my initial post...: 1. old index.php = working = single-site-phone-reboot script 2. new index.php = not working = multi-site-phone-reboot script 3. polycom-reboot.php = the script used by index.php taken from http://code.google.com/p/php-sip/ I need to switch old->new index.php for testing as this is running in production and the polycom-reboot.php script has references to index.php... My guess is that I'm parsing the [iP] wrong in the multi-site script (which should be called in the javascript part i guess), which is in php in my single-site script... I can't remember the exact error message (posting from home), will post this tomorrow... or maybe you are able to catch my error even before that...:-) Thanks in advance :-) ! ~maymann
  11. Hi Haku, I have a working single-site-phone-reboot script, and would like to move to a multi-site-phone-reboot script (both listed above [old and new index.php] and using polycom-reboot.php script). My multi-site-phone-reboot script doesn't work, and I'm trying to figure out what is causing this (my guess is: parsing the [ip] from index.php->polycom-reboot.php ?). So input to what could be wrong with my multi-site-phone-reboot script (index.php) are much welcome... and my question could then be "what is wrong with my multi-site-reboot script/how do i make it work like my single-site-reboot script" ? Thanks in advance :-) ! ~maymann
  12. Thanks for that, already fixed this part though... (see polycom-reboot.php script below) now only parsing from java-script multiselect-menu in new index.php to polycom-reboot.php is my problem... Here are my scripts... I have a "old" working index.php script here - I would like to move away from this and replace it with the multiselect one below, that needs some editing somewhere... :-): --- <html> <body> <form action="polycom-reboot.php" method="post"> PolyCom Phone IP: <select name="ip"> <option value="IP1">IP1</option> <option value="IP2">IP2</option> </select><input type="submit" value="Reboot..."/> </form> </body> </html> --- I am trying to figure out how i can make a multi-dropdown index.php - here is what i got so far...: --- <html> <body> <script type="text/javascript"> function setOptions(chosen){ var selbox = document.formName.ip; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('No site selected',' '); } if (chosen == "1") { selbox.options[selbox.options.length] = new Option('IP1','IP1'); selbox.options[selbox.options.length] = new Option('IP2','IP2'); } if (chosen == "2") { selbox.options[selbox.options.length] = new Option('IP3','IP3'); selbox.options[selbox.options.length] = new Option('IP4','IP4'); } } </script> <form name="formName" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <select name="site" size="1" onchange="setOptions(document.formName.site.options[document.formName.site.selectedIndex].value);"> <option value=" " selected="selected"></option> <option value="1">SITE1</option> <option value="2">SITE2</option> </select> <select name="ip" size="1" method="post" action="polycom-reboot.php"> <option value=" " selected="selected">No phone selected</option> </select> <input type="submit" value="Reboot..."/> </form> </body> </html> --- Polycom-reboot.php script that is now working from both shell and web... :-): --- <html> <body> <form method="POST" action="index.php"> <input type="submit" value="Return" /> </form> <?php require_once('php-sip/PhpSIP.class.php'); /* Check if we are running from commandline or not */ if (isset($_SERVER['argc'])) { $postip = $argv[1]; } else { $postip = $_POST["ip"]; } echo "$postip: "; /* Sends check-sync to Polycom phone */ try { $api = new PhpSIP(); $api->setUsername('USR'); // authentication username $api->setPassword('PWD'); // authentication password // $api->setProxy('PROXY'); $api->addHeader('Event: check-sync'); $api->setMethod('NOTIFY'); $api->setFrom('sip:6000@DEST'); $api->setUri("sip:4000@$postip"); $res = $api->send(); echo "response: $res\n"; } catch (Exception $e) { echo $e; } ?> </body> </html> --- I don't know how to change my new multi-select dropdown index.php, so it parses the [ip] to polycom-reboot.php in the right way... and then making it multiselect... Thanks in advance :-) !
  13. Sorry for my miss-spelling - it is of-cause javascript...
  14. Hi sorry for this..., I am trying to figure out how i can make a multi-site-phone-reboot script - here is what i got so far... I have a single-site-phone-reboot script and am trying to get the multi-site-phone-reboot script working, but i don't seem to be able to parse the [ip] variable to polycom-reboot.php script like i do in my single-site-phone-reboot script. Thanks in advance :-) !
  15. I have a working single-site-phone-reboot script here: --- <html> <body> <form action="polycom-reboot.php" method="post"> PolyCom Phone IP: <select name="ip"> <option value="IP1">IP1</option> <option value="IP2">IP2</option> </select><input type="submit" value="Reboot..."/> </form> </body> </html> --- I am trying to figure out how i can make a multi-site-phone-reboot script - here is what i got so far...: --- <html> <body> <script type="text/javascript"> function setOptions(chosen){ var selbox = document.formName.ip; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('No site selected',' '); } if (chosen == "1") { selbox.options[selbox.options.length] = new Option('IP1','IP1'); selbox.options[selbox.options.length] = new Option('IP2','IP2'); } if (chosen == "2") { selbox.options[selbox.options.length] = new Option('IP3','IP3'); selbox.options[selbox.options.length] = new Option('IP4','IP4'); } } </script> <form name="formName" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <select name="site" size="1" onchange="setOptions(document.formName.site.options[document.formName.site.selectedIndex].value);"> <option value=" " selected="selected"></option> <option value="1">SITE1</option> <option value="2">SITE2</option> </select> <select name="ip" size="1" method="post" action="polycom-reboot.php"> <option value=" " selected="selected">No phone selected</option> </select> <input type="submit" value="Reboot..."/> </form> </body> </html> --- Polycom-reboot.php script... --- <html> <body> <form method="POST" action="index.php"> <input type="submit" value="Return" /> </form> <?php require_once('php-sip/PhpSIP.class.php'); /* Check if we are running from commandline or not */ if (isset($_SERVER['argc'])) { $postip = $argv[1]; } else { $postip = $_POST["ip"]; } echo "$postip: "; /* Sends check-sync to Polycom phone */ try { $api = new PhpSIP(); $api->setUsername('USR'); // authentication username $api->setPassword('PWD'); // authentication password // $api->setProxy('PROXY'); $api->addHeader('Event: check-sync'); $api->setMethod('NOTIFY'); $api->setFrom('sip:6000@DEST'); $api->setUri("sip:4000@$postip"); $res = $api->send(); echo "response: $res\n"; } catch (Exception $e) { echo $e; } ?> </body> </html> --- I think my problem is parsing the [ip] from index.php->polycom-reboot.php...? Br.
  16. Thanks, another question, now I have you...:-) I have a working single-site-phone-reboot script here: --- <html> <body> <form action="polycom-reboot.php" method="post"> PolyCom Phone IP: <select name="ip"> <option value="IP1">IP1</option> <option value="IP2">IP2</option> </select><input type="submit" value="Reboot..."/> </form> </body> </html> --- I am trying to figure out how i can make a multi-site-phone-reboot script - here is what i got so far...: --- <html> <body> <script type="text/javascript"> function setOptions(chosen){ var selbox = document.formName.ip; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('No site selected',' '); } if (chosen == "1") { selbox.options[selbox.options.length] = new Option('IP1','IP1'); selbox.options[selbox.options.length] = new Option('IP2','IP2'); } if (chosen == "2") { selbox.options[selbox.options.length] = new Option('IP3','IP3'); selbox.options[selbox.options.length] = new Option('IP4','IP4'); } } </script> <form name="formName" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <select name="site" size="1" onchange="setOptions(document.formName.site.options[document.formName.site.selectedIndex].value);"> <option value=" " selected="selected"></option> <option value="1">SITE1</option> <option value="2">SITE2</option> </select> <select name="ip" size="1" method="post" action="polycom-reboot.php"> <option value=" " selected="selected">No phone selected</option> </select> <input type="submit" value="Reboot..."/> </form> </body> </html> --- Polycom-reboot.php script... --- <html> <body> <form method="POST" action="index.php"> <input type="submit" value="Return" /> </form> <?php require_once('php-sip/PhpSIP.class.php'); /* Check if we are running from commandline or not */ if (isset($_SERVER['argc'])) { $postip = $argv[1]; } else { $postip = $_POST["ip"]; } echo "$postip: "; /* Sends check-sync to Polycom phone */ try { $api = new PhpSIP(); $api->setUsername('USR'); // authentication username $api->setPassword('PWD'); // authentication password // $api->setProxy('PROXY'); $api->addHeader('Event: check-sync'); $api->setMethod('NOTIFY'); $api->setFrom('sip:6000@DEST'); $api->setUri("sip:4000@$postip"); $res = $api->send(); echo "response: $res\n"; } catch (Exception $e) { echo $e; } ?> </body> </html> --- I think my problem is parsing the [iP] from index.php->polycom-reboot.php, but i might be wrong. BTW - the "$postip = $argv[1];" did it for me - works like a charm :-) ! Br.
  17. Hi thanks, it should come from my "php scriptname arg1" Br.
  18. Hi all, I don't know php, but i have a script i would like to be able to also run from shell, like: "php script arg1"... if (isset($_SERVER['argc'])) { $postip = $1; } else { $postip = $_POST["ip"]; } How do i assign $postip = $1; (or is it infact $2...) ? My script gives me this error now: PHP Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' Thanks in advance :-) !
×
×
  • 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.