I have a form to upload a new video file. When i am trying to add a new video from my end it uploads sucessfully. But the same code when tried by the client he is getting a user generated error say
'Unauthorized Request. Terminating Service'
This abive message is given by us (in update_add_video.php page) to avoid users typing the URL directly in the address bar rather than accessing the page via proper submission after providing relevant details.
The HTML part is in one page and the server side scripting is in another page. The page is submitted after performing validation in the Javascript
HTML code is (add_video.php)
<form name="addvideo" enctype="multipart/form-data" action="update_add_video.php" method="post" onSubmit="return validateAddVideoForm();">
<input type=hidden name=hidaddvideo value="y">
<tr class="thead">
<td align="right" height="30">Title</td>
<td align="left"><input type="text" id="title" name="title" maxlength="50" style="width:180px;" class="finput" value="<?=$POST["title"];?>"></td>
</tr>
<tr class="thead">
<td align="right" height="30">Location</td>
<td align="left">
<input type="file" id="flocation" name="flocation" size="30" style="width:180px;" class="finput" value="<?=$POST["location"];?>">
<input type="hidden" id="location" name="location">
</td>
</tr>
<tr class="thead">
<td align="center" colspan="2"><input type="image" src="images/btn_submit.gif"> <img src="images/btn_cancel.gif" alt=""">
</form></td>
</tr>
</form>
Server Side scripting is as (update_add_video.php)
if($_POST["hidaddvideo"] == 'y')
{
code to insert in the backend
}
else
{
echo 'Unauthorized Request. Terminating Service.';
echo phpinfo();
exit;
}
and the Javascript validation part is as
function validateAddVideoForm()
{
var err_str = '';
if(document.forms["addvideo"].title.value == '')
{
err_str += "Enter Video Title.\n";
document.forms["addvideo"].title.focus();
}
if(document.forms["addvideo"].flocation.value == '')
{
err_str += "Enter Video Location.\n";
document.forms["addvideo"].flocation.focus();
}
else
{
var data = document.forms["addvideo"].flocation.value;
var pos1=data.lastIndexOf('.')
var strExt=data.substring(pos1+1,data.length);
if(strExt.toLowerCase() != "avi" && strExt.toLowerCase() != "mpeg2" && strExt.toLowerCase() != "mpeg4" && strExt.toLowerCase() != "mpeg")
{
err_str += "Allows only [.avi/MPEG-2/MPEG-4 ] format.\n";
document.forms["addvideo"].flocation.focus();
}
else
{
document.forms["addvideo"].location.value=document.forms["addvideo"].flocation.value;
}
}
if(err_str.length > 0)
{
alert(err_str);
return false;
}
return true;
}
[/COLOR]
Can anyone tell me why the form element hidaddvideo is not set to value 'y' when submitting the form. Because of this only the client is getting that particular error.
FYI : The client is having same s/w configuration setup as I have it here.
Thanks in advance