Password Protected Directory intermittent fail - passwords

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();
}
}

Related

Using both .isDisplayed and .isEnabled?

Intro: I'm making automated tests with appium and I'm fairly new to it.
Newbie question: Is there any point making double assertions for elements using is.Displayed and .isEnabled?
Assertion .isEnabled means that the element is not disabled, to clarify this here is sample code:
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
Enabled: <input type="text" name="fname"><br>
Disabled: <input type="text" name="lname" disabled><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
First input is enabled and second is disabled, but both of them are displayed. But it could be also like this:
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
Not displayed and enabled: <input type="text" name="fname" style = "display: none"><br>
Displayed and enabled: <input type="text" name="fname" style = "display: inline-block"><br>
Not displayed and disabled: <input type="text" name="lname" disabled style = "display: none"><br>
Displayed and disabled: <input type="text" name="lname" disabled style = "display: inline-block"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Therefore there are different assertions for Selenium for different test cases. If you want a combination of both .isDisplayed and .isEnabled, use .elementToBeClickable. More information in documentation(JAVA)

Unable to use vanilla JS for AWS Cognito, and get AmazonCognitoIdentity is not defined

I follow the instructions from https://github.com/aws/aws-amplify/tree/master/packages/amazon-cognito-identity-js
Here is my html code:
<html>
<head>
<title>Testing AWS Cognito</title>
<script src="/js/aws/aws-cognito-sdk.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.211.1.min.js"></script>
</head>
<body>
<div>
<input type="text" id="email" name="email" placeholder="email"> <br/>
<input type="text" id="username" name="username" placeholder="username"><br/>
<input type="text" id="phone" name="phone" placeholder="phone"><br/>
<input type="text" id="password" name="password" placeholder="password"><br/>
<button id="signup" onClick="register()" >Register</button>
</div>
<script>
const register = function() {
console.log("onclick loading now");
var CognitoUserPool = AmazonCognitoIdentity.CognitoUserPool;
}
</script>
</body>
</html>
But when I run it, it gives me:
"signup_aws_test.html:32 Uncaught ReferenceError:
AmazonCognitoIdentity is not defined"
I am very sure both files are loaded before I click the button.
in the aws-cognito-sdk.js, I can see that AmazonCognitoIdentity exists and exports. It doesn't seems like it is in the global namespace though.
Do i need to run something else to "Load" it?
Problem solved.
The file name MUST BE
"amazon-cognito-identity.min.js"
although the content the same, the filename matters.
Once I change it to amazon-cognito-identity.min.js, it works.

Remove content from input

can someone help me out with this script. I am trying to do a Formular for submit a recipe.
I want to do a dynamic ingredient formular, where i can add and remove ingredients.
Unfortunately it doesn´t work as I want. My removing function is always removing the first ingredient. How can I remove the the igredient I want to.
Here is my code so far:
function copy(objButton)
{
if(objButton.parentNode)
{
hinzufg=objButton.parentNode.cloneNode(true);
objButton.form.appendChild(hinzufg);
for(j=0;j<objButton.form.lastChild.childNodes.length;++j)
{
if(objButton.form.lastChild.childNodes[j].type=='text')
{
objButton.form.lastChild.childNodes[j].value='';
break;
}
}
}
}
function remove(objButton)
{
var entf = document.getElementById('ingredients');
entf.parentNode.removeChild(entf);
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Recipe</title>
</head>
<form action="">
<h2>Recipes</h2>
<strong>Name</strong> <br />
<input type="text" size="50" > <br /><br />
<strong>Ingredients</strong> <br />
<div id="ingredients">
<input type="text" id="AmountIngredients" name="zutatMenge1[]"> ...
<input type ="text" id="zutat" name="firstIngredient[]">
<input type="button" value="+" onclick="copy(this)">
<input type="button" value="X" onclick="remove(this)">
</div>
</form>
<body>
</body>
</html>

Yodlee FastLink "An error occurred while processing the request or session is invalid"

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

You don't have permission to access /new/< on this server

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