Current location: Hot Scripts Forums » Programming Languages » PHP » Multipurpose dropdown parser to phpscript


Multipurpose dropdown parser to phpscript

Reply
  #1 (permalink)  
Old 11-30-11, 08:17 AM
maymann76 maymann76 is offline
New Member
 
Join Date: Nov 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Multipurpose dropdown parser to phpscript

Hi Forum,

I'm trying to create a php page to reboot-phones remotely using a multiselect java dropdown...
Here is my index.php:
---
<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('second choice - option one','twoone');
selbox.options[selbox.options.length] = new Option('second choice - option two','twotwo');
selbox.options[selbox.options.length] = new Option('second choice - option three','twothree');
selbox.options[selbox.options.length] = new Option('second choice - option four','twofour');
}
if (chosen == "2") {
selbox.options[selbox.options.length] = new Option('second choice - option one','twoone');
selbox.options[selbox.options.length] = new Option('second choice - option two','twotwo');
selbox.options[selbox.options.length] = new Option('second choice - option three','twothree');
selbox.options[selbox.options.length] = new Option('second choice - option four','twofour');
}
}

</script>

<form name="formName" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="site" size="1" onchange="setOptions(document.formName.site.option s[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>
---

Here is my polycom-reboot.php:
---
<html>
<body>

<form method="POST" action="index.php">
<input type="submit" value="Return" />
</form>

<?php

$postip = $_POST["ip"];
echo "$postip: ";

require_once('php-sip/PhpSIP.class.php');

/* Sends NOTIFY to reset Polycom phone */

try
{
$api = new PhpSIP();
$api->setUsername('USR'); // authentication username
$api->setPassword('PWD'); // authentication password
// $api->setProxy('GW');
$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;
}

?>
---

1. Do any of you know what to do to get it working... or just how to get some errormessages to point me in the right direction...

If you have another example howto this it is highly appreciated.

2. Futhermore I would like the ability to also reboot phones from cron/linux shell using reboot-polycom.php with argument "ip". Or even better: site="site1"+ip="all" or site="site1"+ip="multiselected" wich will then reboot the "ip"s for this specific site... this functionality would be great also on webpage... :-)


Thanks in advance :-) !

Br
~Maymann
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Dropdown based on another Dropdown kaash1 PHP 3 08-28-10 03:25 AM
Wiki syntax parser FSX PHP 0 10-25-08 04:09 AM
2 multiple dropdown lists theighost Script Requests 1 08-26-08 08:21 AM


All times are GMT -5. The time now is 08:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.