Hi,
I'm total php newbie and probably have trivial problem.
I have following two scripts. First creates web form and should run second
script with two arguments. But those two arguments don't get to second
script, cause this line
print "Please enter both phone number
and name!";
is always executed and incoming arguments are empty.
What is wrong ?
Thanks in advance,
regards,
Rob.
== cid-form.php ==
<html>
<head>
<title>Asterisk Caller ID form</title>
</head>
<body>
<h1>Asterisk phone book</h1>
<form name="EntryForm" action="cid-store.php" method=POST>
<table cellpadding=2>
<tr>
<td>Phone number:</td>
<td><input name="PhoneNumber" size=30></td>
</tr>
<tr>
<td>Name:</td>
<td><input name="PhoneName" size=30></td>
</tr>
<tr>
<td></td>
<td><div align=right>
<input type=submit value="Save">
</div></td>
</tr>
</table>
</form>
</body>
</html>
== cid-store.php ==
<HTML>
<HEAD>
<TITLE>Storing Asterisk CID data</TITLE>
</HEAD>
<BODY>
<h1>Asterisk phone book</h1>
<?php
set_time_limit(5);
if ($PhoneNumber <> "" && $PhoneName <> "") {
// Note: this PHP script runs as user "apache"!
// system("whoami > /tmp/info");
system("sudo /usr/sbin/asterisk -rx " . escapeshellarg("database put
cidname $PhoneNumber \"$PhoneName\"") . " &> /tmp/error");
print "Successfully stored <b>$PhoneNumber</b> as
<b>$PhoneName</b>.";
} else {
print "Please enter both phone number and name!";
}
?>
</BODY>
</HTML>