
MetalSmith
Members-
Posts
64 -
Joined
-
Last visited
Never
Everything posted by MetalSmith
-
I think I understand. Thanks Man!
-
Thanks for the help Jcbones. Sorry for the noob questions but I have one more How come the this piece of code automatically fills the $a array? What is it about the [] on the $a & $x that makes it fill up? $a = array(); while ($x = mysql_fetch_array($query_name,MYSQL_NUM)) { $a[] = $x[0]; } echo ($a[0]);
-
This works seems like. $a = array(); while ($x = mysql_fetch_array($query_name,MYSQL_NUM)) { $a[] = $x[0]; } echo ($a[0]);
-
Man this is really driving me nuts. I can see my array values with echo inside the loop but outside nothing is shown. What am I missing here? If anything it should show the last value in the loop. while ($x = mysql_fetch_array($query_name,MYSQL_NUM)) { echo $x[0]; } echo $x[0];
-
Well I want just the name, but now the value is a key + name. Now if I need the name then I have to strip off the Array ( [0] => if front of the name is all. Thanks.
-
How can I stop that ?
-
Anyone know why I get this from my mysql query?It adds an extra key for some reason. $types = array(); while ($row = mysql_fetch_array($query_name,MYSQL_NUM)) { $types[] = $row; } print_r ($types); Array ( [0] => Array ( [0] => Matt ) [1] => Array ( [0] => Larissa ) [2] => Array ( [0] => Braden ) [3] => Array ( [0] => Tom ) )
-
It was a permissions thing on the folder
-
Hi all, I like to write scripts for my Aastra IP phone. 480i. I have done all my scripts with Apache on windows. I thought I would try it on Linux with the AsteriskNOW FreePBX 1.4 load. Phone system software for those that do not know. So my code is below something very simple to display on the screen. Ignore the $textmenu code that works fine. The problem is it does not open a file and do something then write the file. On my Windows / Apache box the screen will display on the phone and open the file and do whatever. On my Linux box it will display the screen fine but will not open that file. Why would it be ingnoreing those PHP file commands? Any ideas? It file commands work if I run it with php script.php but not when I use my phone to launch that script. Now keep in mind Windows/Apache is fine no problem. I thought maybe it was a php.ini setting on the linux box? <?php $textmenu = "<AastraIPPhoneTextMenu style = \"numbered\">\n"; $textmenu .= "<Title>------- Test -------</Title>\n"; $textmenu .= "<MenuItem>\n"; $textmenu .= "<Prompt>Applications</Prompt>\n"; $textmenu .= "<URI>http://65.205.71.13/xml/menu/menu.php?source=all</URI>\n"; $textmenu .= "</MenuItem>\n"; $textmenu .= "<SoftKey index = \"1\">\n"; $textmenu .= "<Label>Select</Label>\n"; $textmenu .= "<URI>SoftKey:Select</URI>\n"; $textmenu .= "</SoftKey>\n"; $textmenu .= "<SoftKey index = \"6\">\n"; $textmenu .= "<Label>Exit</Label>\n"; $textmenu .= "<URI>SoftKey:Exit</URI>\n"; $textmenu .= "</SoftKey>\n"; $textmenu .= "</AastraIPPhoneTextMenu>\n"; echo $textmenu; $fp=fopen("/var/www/html/aastra/awa-det/conference/test.txt","w+"); fwrite($fp); fclose($fp); ?>
-
Hi all, Is there a simple way to log the command output of a linux console? This command locks up my screen. It is a screen on an Aastra IP phone. $command = 'logsave /var/www/html/aastra/test.log ls'; shell_exec($command); Thanks!
-
That worked!! Why does that work? Thanks!
-
Hi all! The $bridge variable is not getting passed while it is contained in the line below: Maybe I don't have the right brackets around it? I want the result to say Bridge1 I think it's because its a WshShell command. Any ideas? $bridge = 1; if ($refresh == 1) { $WshShell = new COM("WScript.Shell"); $WshShell->Run('"C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\aastra\putty.exe" -load "Bridge$bridge" -l root -pw password -m "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\aastra\list-56201.sh"'); sleep(2); }
-
Yea it does I got it to pass them. HEHE Thanks!
-
Aagin thanks for all the help! One quick follow up question. Can you pass variables with a header? header("Refresh: 15; url=http://192.168.1.102/aastra/details.php?bridge=1"); I have a GET command on the page as well: $bridge = "{$_GET['bridge']}";
-
HAHA STUPID!!! I got it to work! There is a space after the url= which breaks it LOL dumb!! header("Refresh: 5; url= http://XXX.XXX.XXX.XXX/this-page.php"); // No good header("Refresh: 5; url=http://XXX.XXX.XXX.XXX/this-page.php"); // This works Thanks for all the help though!!!
-
Well the menu is just an example not to give out to much detail of the real page to be refreshed. The timeout is how often the page is refreshed and not how long it takes to refresh the page. The page loads instantly its just a tiny amount of text. The phone has a default timeout of 45 seconds on all XML pages. I just wanted the user to get to a certain page and have it refresh until he is done with it and then he has to manually close it. The phone manual does not give any examples on how to use it so I am kinda stuck and because its a phone and not a browser this makes things more difficult for posting on forums hehehe.
-
That quote was a typo I have replaced it with " and same results. My phone display will try to update after 5 seconds but the picture just comes back as an Page Load Error Cannot Display. Going to look at the meta refresh thing now.
-
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 480i IP desk phone. The code below the header line displays a menu on my phone. That works fine so no need to look at that. I am having trouble getting the refresh line to work. How would I make a header for this script with the header line being used below? The header line is in the correct format but I don't know how to apply it. <?php header("Refresh: 5; url= http://XXX.XXX.XXX.XXX/this-page.php”); $textmenu = "<AastraIPPhoneTextMenu style = \"numbered\">\n"; $textmenu .= "<Title>------- Menu -------</Title>\n"; $textmenu .= "<MenuItem>\n"; $textmenu .= "<Prompt>Directory</Prompt>\n"; $textmenu .= "<URI>http://192.168.1.102/aastra/directory.php</URI>\n"; $textmenu .= "</MenuItem>\n"; $textmenu .= "<SoftKey index = \"1\">\n"; $textmenu .= "<Label>Select</Label>\n"; $textmenu .= "<URI>SoftKey:Select</URI>\n"; $textmenu .= "</SoftKey>\n"; $textmenu .= "<SoftKey index = \"6\">\n"; $textmenu .= "<Label>Exit</Label>\n"; $textmenu .= "<URI>SoftKey:Exit</URI>\n"; $textmenu .= "</SoftKey>\n"; $textmenu .= "</AastraIPPhoneTextMenu>\n"; echo $textmenu; ?>
-
Ok I used you code and got it to work with replacing $value with $d Is $return a global variable? Hows does $return spit out $c? $x = array("a"=>"Dog","b"=>"Cat","c"=>"Horse"); function search_array($value) { $a = "Horse"; $b = "Horse"; if ($a == $b) { $c = 56201; return $c; } } $d = array_walk($x,"search_array"); $return = search_array($d); echo "$return";
-
Well that is not giving me what I want either lol. All I want is to walk through each array value and compare the value with a string. If they are equal then give me a result. Maybe the array_walk is not the right choice. Functions are hard to understand for me for some reason.
-
I simplified things for testing. Where am I going wrong with getting $c out of this function? It keeps returning the number 1 $x = array("a"=>"Dog","b"=>"Cat","c"=>"Horse"); function search_array($value) { $a = "Horse"; $b = substr($value,0,5); if ($a == $b) { $c = 56201; echo ($c); return ($c); } } $d = array_walk($x,"search_array"); echo ($d);
-
The string comparison does work becuase if I put echo $c; after $c = 56201; I see 56201 on my screen. So for some reason I am not extracting the result $c out of that function correctly.
-
That is not working either.
-
Hi all! How can I get the result of $c out of this function? I know the code is odd looking but it does mean something I just need result $c. Thanks! <?php $extensions_file = (file("extensions_additional.conf")); function search_array($value) { $a = "exten => 56201,n,GotoIf(\$[x\${PIN} = x"; $b = substr($value,0,37); if ($a == $b) { $c = 56201; return ($c); } } #array_walk($extensions_file,"search_array"); echo ($c); ?>
-
Great thanks for the help!