Jump to content

anoveskey

Members
  • Posts

    4
  • Joined

  • Last visited

anoveskey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah, nothing shows up on the screen, but when you hit ctrl+u in Firefox it shows the script source.
  2. Hello! I am attempting to put together a little 'login' of sorts, where a user inputs 4 numeric values into a form. The values are then compared to variables in a php script to see if the input matches. If the input matches, the php script should redirect to a new page. Problem is, when I hit the 'submit' button, the script itself is brought up, rather than a redirect. I'm trying to keep the values in the php script hidden as well so the user can't just ctrl+u and see what the script looks like. Any suggestions? Here is my form: <!-- Input Form --> <div> <form id="inputForm" name="inputForm" method="POST" action="code-login.php"> <p>Grab some coffee: <input type="text" name="input1" size="2" /> <input type="text" name="input2" size="2" /> <input type="text" name="input3" size="2" /> <input type="text" name="input4" size="2" /> <input type="submit" value="Crack the Code!" /> </p> </form> </div> and here is the php script: <?php $firstValue = $_POST['input1']; $secondValue = $_POST['input2']; $thirdValue = $_POST['input3']; $fourthValue = $_POST['input4']; if ((($firstValue === '##') && ($secondValue === '##')) && (($thirdValue === '##') && ($fourthValue === '##'))) { header('http://www.someotherpage.com/'); exit(); } else { echo "The code is incorrect."; } ?> BTW, the ##'s in the if statement are strictly there as place holders. Actual numbers will take their place in the real script. Thanks!
  3. I also just realized that the original was actually Javascript and not PHP. Still, the basic logic should be the same from one to the other. replace var with $ and it should be the same, right?
  4. I recently filled out a job application for a web developer position. In addition to the usual 'tell us about yourself' questions, I was presented with this one. After searching the web and hacking at it for nearly an hour. I just punched in 5. I'm sure it's wrong. Anyway, I was wondering if someone could give me some clarification on what is happening here: <?php /* What value should you replace the '?' with to make the output read 10? */ var x = 6; var y = 4; var a = function(b) { return function© { return y + b + c; } }; x = 2; y = 5; var fn = a(x); x = 1; y = 3; var unknown = ?; console.log(fn(unknown));* ?> Am I reading correctly that the value of var a is equal to the value returned by function(b) which is equal to the value returned by function© which is y + b + c? I concluded that the value of var a = 4 + 2b + 2c. But since var b and var c are not defined how would I go about getting a strictly numeric value as output? Pardon my ignorance, but I have faced questions like this for other job apps and I am tired of staring at the screen like an idiot! Any clarification would be greatly appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.