Help with WAMP and PHP

Okay , so i wrote some html-php code , and when i try to run it in browser , WAMP goes to http://localhost/<?php and says :
Forbidden
You don’t have permission to access /< on this server.
I dont know what to do . Is it somehing with privileges , or the code …
The html file i placed is a a test . My first one , actually . The code is a joke . Well , it has internet jokes …
But that is besides the point . I cant run it and i dont know what to do . Up until i wrote the php in it it worked fine . Please advise .

[php]

<?php $nameErr = $genderErr = $dickErr = $countryErr = "" ; $name = $gender = $dick = $country = "" ;

function test_input($data) {
$data = trim($data) ;
$data = stripslashes($data) ;
$data = htmlspecialchars ($data) ;
?>

Hey u suck dick ?



html { color: white; background-color: #5e8617; text-align: center; font-family: comic sans; }
body { width: 1250px; margin: 0 auto 0 auto; text-align: left; padding: 5px; background-color: #5e8617; color: white; }
header, footer { width: 1250px; display: table; background-color: #586E30; text-align: center; font-family: comic sans;}
nav {height: 800px; width: 200px; float: left; display: table; background-color: #586E30; }
article { width: 1040px; display: table; background-color: #7E9E45; }
footer { text-align: center; background-color: #586E30; font-size: 300%}
.c {color: red; font-family: comic sans;}
.tits {display: table; background-color: #586E30; text-align: center; font-family: comic sans; width: 1040px; height: 50px;}


Harambe mah lawv

  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
  • Hey u suck dick ?
    NEW !!!
    		</ul>
    	</nav>
    	<article>
    		<h1>Hey u suck dick ?</h1>
    		<div class="tits"><h2>Give information, Do it for Harambe</h2></div>
    		<form method="post" action=<?php echoaction=<?php echo htmlspecialchars ($_SERVER["PHP_SELF"])?>>
    		<p><b> Name ;</b> <input type="text" name="name" size="35" value=""> <span class="error">*<?php echo $nameErr ; ?> </span>
    		<p> <b> Gender ; </b>Gaaaaay<input type="radio" name="gender" value="Attack Helicopter"><span class="error">*<?php echo $genderErr ; ?> </span> 		
    								 Ceral First Denier<input type="radio" name="gender" value="Ceral First Denier"> 
    								 Attack Helicopter Ceral First Denier<input type="radio" name="gender" value="Attack Helicopter Ceral First Denier"> 
    								
    								 <br>
    		<p><b>Hey U Suck Dick ? ; </b>Yas!<input type="radio" name="dick" size="35" value="Yes"><span class="error">*<?php echo $dickErr ; ?> </span>
    										No, Am Str8, M8."<input type="radio" name="dick" size="35" value="No">
    									
    										<br>
    <p><b> Country ;</b><select name="country"><span class="error">*<?php echo $countryErr ; ?> </span>
        <option value="None selected">Please select below</option>
        <option value="Idontgive">I don't give a shit LOL</option>
        <option value="Nope">Nope</option>
    	<input name="xXxthatsfuckingayxXx" type="submit" value="submit"
    </select><p></form>
    <iframe width="560" height="315" src="https://www.youtube.com/embed/OJw3MmL-Omk" frameborder="0" allowfullscreen></iframe>
    	</article>
    
      <?php
    

    if ($_SERVER[“REQUEST_METHOD”] == “POST”) {
    if (empty($_POST[“name”])) {
    $nameErr = “Name is required!” ;
    } else {
    $name = test_input($_POST[“name”]) ; }
    }

    if ($_SERVER [“REQUEST_METHOD”] == “POST”) {
    if (empty($_POST[“gender”])) {
    $genderErr = “Gender is required!” ;
    } else {
    $gender = test_input($_POST[“gender”]) ;
    }
    }

    if ($_SERVER [“REQUEST_METHOD”] == “POST” ) {
    if (empty($_POST[“dick”])) {
    $dickErr = “Gayness is required!”
    } else {
    $dick = test_input($_POST[“dick”]) ;
    }
    }

    if ($_SERVER [“REQUEST_METHOD”] == “POST”) {
    if (empty($_POST[“country”]) {
    $countryErr = “Country of origin is required!”
    } else {
    $country test_input($_POST[“country”]) ;
    }
    }
    ?>
    Welcome <?php echo $_POST["name"] ;?>

    Your gender is <?php echo $_POST ["gender"] ;?>

    You is gay , right ? <?php echo $_POST ["dick"] ; ?>

    You are so goddamn country <?php echo $_POST ["country"] ; ?>


    		8=====D
    		
    		</p>
    	</footer>
    </body> 
    
    [/php]

First thought is why are you mixing the two like that?

Place the php at the top of the page, and the html at the bottom. Echoing variables in the html is one thing, but you are just randomly dropping php where it makes no sense.

http://localhost/<?php

Is that verbatim what is displayed in the browser url? not a page name like index.php?

1 ,This is a joke thing , but you are right , it is randomly placed , and i organised it better . Now it looks better too .
2. Yes , that is what shows up .

Oh , and i wrote some php before , and i didnt have a problem , i didnt change anything in wamp and the browser and PHPadmin , so it must be some code’s fault .

If you cleaned up the code why don’t you show the new code, if you’re still having problems?

Here . Problem is still there .


Joke test.txt (3.76 KB)

Post the code in code tags, not a file, please.

There

[code]

<?php $nameErr = $genderErr = $dickErr = $countryErr = "" ; $name = $gender = $dick = $country = "" ;

function test_input($data) {
$data = trim($data) ;
$data = stripslashes($data) ;
$data = htmlspecialchars ($data) ;
?>
<?php
if ($_SERVER[“REQUEST_METHOD”] == “POST”) {
if (empty($_POST[“name”])) {
$nameErr = “Name is required!” ;
} else {
$name = test_input($_POST[“name”]) ; }
}

if ($_SERVER [“REQUEST_METHOD”] == “POST”) {
if (empty($_POST[“gender”])) {
$genderErr = “Gender is required!” ;
} else {
$gender = test_input($_POST[“gender”]) ;
}
}

if ($_SERVER [“REQUEST_METHOD”] == “POST” ) {
if (empty($_POST[“dick”])) {
$dickErr = “Gayness is required!”
} else {
$dick = test_input($_POST[“dick”]) ;
}
}

if ($_SERVER [“REQUEST_METHOD”] == “POST”) {
if (empty($_POST[“country”]) {
$countryErr = “Country of origin is required!”
} else {
$country test_input($_POST[“country”]) ;
}
}
?>


Hey u suck dick ?



html { color: white; background-color: #5e8617; text-align: center; font-family: comic sans; }
body { width: 1250px; margin: 0 auto 0 auto; text-align: left; padding: 5px; background-color: #5e8617; color: white; }
header, footer { width: 1250px; display: table; background-color: #586E30; text-align: center; font-family: comic sans;}
nav {height: 800px; width: 200px; float: left; display: table; background-color: #586E30; }
article { width: 1040px; display: table; background-color: #7E9E45; }
footer { text-align: center; background-color: #586E30; font-size: 300%}
.c {color: red; font-family: comic sans;}
.tits {display: table; background-color: #586E30; text-align: center; font-family: comic sans; width: 1040px; height: 50px;}


Harambe mah lawv

	<article>
		<h1>Hey u suck dick ?</h1>
		<div class="tits"><h2>Give information, Do it for Harambe</h2></div>
		<form method="post" action=<?php echoaction=<?php echo htmlspecialchars ($_SERVER["PHP_SELF"])?>>
		<p><b> Name ;</b> <input type="text" name="name" size="35" value=""> <span class="error">*<?php echo $nameErr ; ?> </span>
		<p> <b> Gender ; </b>Gaaaaay<input type="radio" name="gender" value="Attack Helicopter"><span class="error">*<?php echo $genderErr ; ?> </span> 		
								 Ceral First Denier<input type="radio" name="gender" value="Ceral First Denier"> 
								 Attack Helicopter Ceral First Denier<input type="radio" name="gender" value="Attack Helicopter Ceral First Denier"> 
								
								 <br>
		<p><b>Hey U Suck Dick ? ; </b>Yas!<input type="radio" name="dick" size="35" value="Yes"><span class="error">*<?php echo $dickErr ; ?> </span>
										No, Am Str8, M8."<input type="radio" name="dick" size="35" value="No">
									
										<br>
<p><b> Country ;</b><select name="country"><span class="error">*<?php echo $countryErr ; ?> </span>
    <option value="None selected">Please select below</option> 
    <option value="Idontgive">I don't give a shit LOL</option>
    <option value="Nope">Nope</option>
	<input name="xXxthatsfuckingayxXx" type="submit" value="submit"
</select><p></form>
<iframe width="560" height="315" src="https://www.youtube.com/embed/OJw3MmL-Omk" frameborder="0" allowfullscreen></iframe>
	</article>	

?>
Welcome <?php echo $_POST["name"] ;?>

Your gender is <?php echo $_POST ["gender"] ;?>

You is gay , right ? <?php echo $_POST ["dick"] ; ?>

You are so … <?php echo $_POST ["country"] ; ?>


		8=====D
		
		</p>
	</footer>
</body> 
[/code]

For starters, your HTML is wrong in many places. You cant have inputs, spans, and closing tags [ that start outside of ] in form controls.

[php]<?php echoaction=<?php[/php] is completely wrong.

oh , wow . I deleted something , and didnt notice the remains , thanks for pointing that out . But the error is still there . Is there something i can do with permissions in php.ini or something to fix this ? And the html , dont bother with it . It is just a test . I will re-read it after i deal with the error .

so, where are you currently in progress?

Nowhere , as i cant run php because of the goddamn privileges . I wrote some php before , it worked fine . I wrote a line of code , and it stopped working . I kept deleting lines , checking if they work , and paste-ing them back . I cant find the problem . Maybe i am too dumb (probably am) but still , cant do crap . And its not just a syntax error or such , because WAMP would tell me . This is different .

Here is something to play with:

[php]<?php

if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’) {
if ( strlen( trim( $_POST[‘entered_name’] ) ) == 0 ) {
$error = ‘Name is required’;
} else {
$output = "Hello, " . htmlentities($_POST[‘entered_name’]);
}
}
?>

Bootstrap Example
<?php echo isset($output) ? $output : ''; ?>
<form method="post">
    <h2>Enter your name.</h2>
    <?php if ( isset($error) ): ?>
        <div class="form-group alert alert-danger">
            * <?php echo isset($error) ? $error : ''; ?>
        </div>
    <?php endif; ?>
    <div class="form-group">
        <input class="form-control" type="text" name="entered_name">
    </div>
    <div class="form-group ">
        <input type="submit" value="Submit">
    </div>
</form>

[/php]

Thanks , it is quite cool . And it works fine . But what do these 2 scripts do ? (the ajax and the bootstrap) Anyway , thanks .

And i still dont know why my script has privilege problems .

Bootstrap is a layout framework for mobile first websites.
There is no ajax in there, but bootstrap requires jQuery.

I don’t think you have a permission issue. Your script just had errors, that because of things being unorganized were difficult to figure out without fixing the organization first.

bootstrap requires jQuery.

No it doesnt. Only the plugins listed on the javascript page.

http://getbootstrap.com/javascript/

Sponsor our Newsletter | Privacy Policy | Terms of Service