Just getting my grounds with PHP and running into trouble with cookies/sessions.

[php]<?php
if (!empty($_POST[‘panic’])) { // added a ) here
setcookie(‘panic’,$_POST[‘panic’], time()+606024*30);
}
?>

Main

Welcome!


</head>
<body>

	
	<hr />
	<p>This website is <strong><i>currently</i></strong> under construction!</p>
	<br />
	Here is something I've been working on. Underneath each of the games on my website you will notice a 'Panic!' button. Normally what this button did was take you to Google, in-case your teacher was walking by it would allow you to hop off the website quickly. But now I've added the ability to change where the button takes you. So copy and paste the URL of a website your supposed to be on into the space below!
	<br />
	<form action='index.php' method='post'>
	<input type="text" name="panic" size="80"/>
	<input type="submit" value="Submit"/>
	</form>
	<br />
            <?php // <?= is a short echo, it can not be used as an opening tag

			// here we check if the url starts with http:// or https://, if not we add it
			$url = strpos($url, 'http://') || strpos($url, 'https://') ? $_COOKIE['panic'] : 'http://' . $_COOKIE['panic'];
			?>

			<a href="<?= $url; ?>">Here!</a>
			<a href="test.php">Here!</a>
            <br />
	<h4>In the mean time, here is patrick</h4>
	<iframe width="640" height="480" src="//www.youtube.com/embed/RbYb7rZUz-8" frameborder="0" allowfullscreen></iframe>
	
</body>
<footer><center>
	<hr />
	<!-- START OF HIT COUNTER CODE -->



Free web hostingWeb hosting

</center></footer>[/php]

[php]<?php

// here we check if the url starts with http:// or https://, if not we add it
$url = strpos($_COOKIE[‘panic’], ‘http://’) || strpos($_COOKIE[‘panic’], ‘https://’) ? $_COOKIE[‘panic’] : ‘http://’ . $_COOKIE[‘panic’];

?>

Here![/php]

I cant thank you enough for taking the time out of your day to work with dumb old me. XD If i could pay you for doing such a job i would but i cant so the most i can give you is my kindest of thanks.

I’m not here for the money :slight_smile: Glad I could help, hope you learned something today :slight_smile:

Then i will give you Karma… or what ever that thing dose under your name XD and i think i learned to read more carefully. Haha thank you!

Sponsor our Newsletter | Privacy Policy | Terms of Service