I am facing this error. The path of my file is "www/new/filename.html". What is the cause of error. Is the error is because of wrong code or due to configuration issue? I am trying to print the details of form on same file but i am getting error.
<html>
<body>
<?php
$name="";
$ne="";
if($_SERVER["$_REQUEST_METHOD"]=="POST")
{
$name=$_POST["nam"];
if(empty($name))
{
$ne="Error"
}
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Name: <input type="text" name="nam"><?php echo $ne;?>
Gender<input type="radio" name="gen" value="male">Male
<input type="radio" name="gen" value="female">female
<input type="submit" name="submit" value="Submit">
</form>
<?php
echo "<h1> Inputs </h1>";
echo "$name";
?>
</body>
</html>
Issue a sestatus to check if you have selinux enabled or not. Check web server logs as well to see if you get more details about the forbidden error
Related
I am trying to create a simple drag and drop page using php. When I click the "submit" button, I get an error: Notice: Undefined index: file in C:\xampp\htdocs\phpfiles\DragAndDrop\includes\gallery-upload.inc.php on line 13. Why is it not reading the "file" index from the htmlphp?
Here is the HTML and PHP code:
enter code here
<!--continuted from HTML page-->
</section>
<?php
$_SESSION['username'] = "Admin";
if (isset($_SESSION['username'])) {
echo '<div class="gallery-upload">
<form action="includes/gallery-upload.inc.php" method="post" enctype="mutipart/form-data">
<input type="text" name="filename" placeholder="File Name...">
<input type="text" name="filetitle" placeholder="Image Title...">
<input type="text" name="filedesc" placeholder="Image description...">
<input type="file" name="file">
<button type="submit" name="submit">Upload</button>
</form>
</div>';
}
?>
</main>
</body>
</html>
<!--and the php page-->
<?php
if (isset($_POST['submit'])) {//checks submit form and posts the info
$newFileName = $_POST['filename'];
if (empty($_POST['filename'])) { //if filename is emptly
$newFileName = "gallery"; //if filename is empty, generates name
} else {
$newFileName = strtolower(str_replace(" ", "-", $newFileName)); //if spaces are in the name, creates stringholder
}
$imageTitle = $_POST['filetitle'];
$imageDesc = $_POST['filedesc'];
$file = $_FILES['file'];
}
?>
You have a typo:
mutipart/form-data
Should be
multipart/form-data
I am working on implementing a FastLink2.0 Integration for aggregation in my application. I saw from this post that the interface needs to be called from an HTML form and not just a simple REST GET request.
I was able to get a simple html page to work and redirect to FastLink, but when I put the page into an iframe (as the documentation recommends), it says "An error occurred while processing the request or session is invalid"
<iframe src="fastlink.html"></iframe>
fastlink.html:
<html>
<head>
</head>
<body>
<div class='center processText'>Processing...</div>
<div style="visibility: hidden">
<form action='https://node.developer.yodlee.com/authenticate/restserver/' method='post' id='rsessionPost'>
RSession : <input type='text' name='rsession' placeholder='rsession'
value='<--user token-->'
id='rsession'/><br/>
FinappId : <input type='text' name='app' placeholder='FinappId' value='10003600' id='finappId'/><br/>
Redirect : <input type='text' name='redirectReq' placeholder='true/false' value='true'/><br/>
Token : <input type='text' name='token' placeholder='token'
value='<--authenticated token-->' id='token'/><br/>
Extra Params : <input type='text' name='extraParams' placeholer='Extra Params' value=''
id='extraParams'/><br/></form>
</div>
<script>document.getElementById('rsessionPost').submit();</script>
</body>
</html>
Anyone figure this out? Thanks in advance!
Please follow the steps-
Here is the simple example of how to invoke fastlink in an iframe:
In post.html
<div class='center processText'>Processing...</div>
<div>
<form action='https://node.developer.yodlee.com/authenticate/restserver/' method='post' id='rsessionPost'> RSession :
<input type='text' name='rsession' placeholder='rsession' value='08062013_0:829d770b5c7d29e300a7dabc42108383ecac552de57a9706ed4077c98acde1e29e874e676651813a95543b8fb5e2d5face054f300a03b34e7105976867dde3' id='rsession'/>
<br/> FinappId :
<input type='text' name='app' placeholder='FinappId' value='10003600' id='finappId'/>
<br/> Redirect :
<input type='text' name='redirectReq' placeholder='true/false' value='true'/>
<br/> Token :
<input type='text' name='token' placeholder='token' value='7346ddfb28f1eef2acdc4943695680337a3e5ea2ae9bb88c35d0ed58c702b6' id='token'/>
<br/> Extra Params :
<input type='text' name='extraParams' placeholer='Extra Params' value='' id='extraParams'/>
<br/>
</form>
</div>
<script>document.getElementById('rsessionPost').submit();
</script>
Then invoking this in iframe:
In test.html:
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<iframe src="post.html"></iframe>
</body>
</html>
Hope this helps.
Regards,
Krithik
I have a form on the only page within a directory that is password protected via cPanel. Such as...
www.site.com/directory/subdirectory/form.php
Once every twenty submits of the form (in the same session) I am redirected to:
www.site.com
and obviously the php form processing doesn't occur.
WHAT IS HAPPENING?
I have checked my redirects in cpanel and none are set. So I don-t even know why it goes to the index page!
NOTES
No question on SO mentions this problem and I have found nothing suitable in google. I'm not sure what the problem is so it's hard to 'google'.
Here is the form.php format
<?php
header('Content-Type: text/html; charset=utf-8');
session_start();
require 'functions.php';
connect();
/*“Æ” because UTF-8 encoding without BOM looks like ANSI*/
if(isset($_POST['newJob'])){
$jTDjobToDo = $_POST['jobToDo'];
$jTDwhenInfo = $_POST['whenInfo'];
$jTDwhenInfo = $jTDwhenInfo+ time();
$jTDinsertNewJob = $conn ->prepare ("INSERT INTO jobstodo (jobToDo,whenInfo) VALUES(:jobToDo,:whenInfo)");
$jTDinsertNewJob->bindParam(':jobToDo', $jTDjobToDo, PDO::PARAM_STR);
$jTDinsertNewJob->bindParam(':whenInfo', $jTDwhenInfo, PDO::PARAM_INT);
$jTDinsertNewJob->execute();
echo "New job added!<br/>";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>My page</title>
<LINK href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="newjobform">
ADD A NEW JOB
<form action="http://www.site.com/myPage.php" method="POST">
New Job To Do <input type="text" name="jobToDo" id="newJobToDo" ><br/>
When to do<br/>
<input type="radio" name="whenInfo" value="0" CHECKED>Now /
<input type="radio" name="whenInfo" value="86400"> 1 day
/ <input type="radio" name="whenInfo" value="172800"> 2 days
/ <input type="radio" name="whenInfo" value="345600">4 days<br/>
<input type="radio" name="whenInfo" value="604800">7 days
/ <input type="radio" name="whenInfo" value="1209600">14 days
/ <input type="radio" name="whenInfo" value="2073600">24 days
/ <input type="radio" name="whenInfo" value="3888000">45 days<br/>
<input type="submit" value="ADD" name="newJob"><br/>
</form>
</div>
</body>
</html>
The function php connects as so..
try {
$conn = new PDO("mysql:host=$hostdb; dbname=$namedb", $userdb, $passdb);
//echo 'Connected to database';
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
I have a form that will processing input.how to make it run continuos after i just click submit once?
I want to know the method.
say i have the code :
<form name="form1" action="" method="post">
<input type="text" name="tfcari" />
<input type="submit" name="btcari" />
</form>
<?php
if (isset($_POST['btcari'])) {
get(..);
?>
Thanks.
I want to run cgi in wamp. I followed the instructions in this link
http://www.chromicdesign.com/2009/05/setting-up-perl-for-wampp.html
Here is my html code
<HTML>
<BODY>
<FORM METHOD="POST" ACTION="./cgi-bin/myscript.cgi">
<PRE>
First Name <INPUT TYPE="text" NAME="fname" MAXLENGTH=15 SIZE=15>
Last Name <INPUT TYPE="text" NAME="lname" MAXLENGTH=20 SIZE=20>
E-Mail Addr <INPUT TYPE="text" NAME="email" MAXLENGTH=35 SIZE=35>
<INPUT TYPE="submit" VALUE="Send Mail!">
<INPUT TYPE="reset" value=" Clear-Form">
</PRE>
</FORM>
</BODY>
</HTML>
And my CGI script
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
#pairs=split(/&/,$temp);
foreach $item(#pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<BODY BGCOLOR=#FFFFFF>\n";
print "<CENTER>\n";
print "THANK YOU<BR>\n";
print "$fields{fname} $fields{lname}</BR>";
print "I will write<BR>\n";
print "you at<BR>\n";
print "$fields{email}<BR>\n";
print "</CENTER>\n";
print "</BODY></HTML>";
Whenever i run it gives INERNAL SERVER ERROR. I don't know what to do.
Please help me out
to understand what happened you should look into Apache error log. But here the problem is most probably that the shebang line in your script does not look at the actual perl installation