Page 1 of 1

Freakout for PHP

Posted: Tue Feb 18, 2014 11:36 pm
by netmaestro
I made a version of the freakout gif that will repeat 3 times and stop. It is sized suitably for web pages and can be used fairly easily with php. Here is the php code for a simple test:

Code: Select all

<!DOCTYPE html>

<html>

<head>
<meta content="en-us" http-equiv="Content-Language">
<meta charset="utf-8">
<title>Freakout Test</title>
<script src="soundmanager2-nodebug-jsmin.js"></script>
<script>soundManager.setup({url:'swf',onready:function(){var mySound=soundManager.createSound({id:'aSound',url:'flustered.mp3',autoLoad:true,autoPlay:false});}});</script>
<style type="text/css">
div, p 		{text-align: center;}
.redclass 	{outline: thin red solid;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from none JavaScript Browsers 
Image1= new Image(95,95)
Image1.src = "freakout.gif"
Image2 = new Image(95,95)
Image2.src = "freakout-resting.gif"
// End Hiding -->
</SCRIPT>
</head>

<body>

<?php 
$cluck = "<script>soundManager.setup({url:'swf',onready:function(){var mySound=soundManager.createSound({id:'aSound',url:'flustered.mp3'});mySound.play();}});</script>";

if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
	$errorsfound = 0;
	if (empty($_POST['firstinput'])) {$errorsfound = 1; }
	}
?>

<form method="post">
<p>&nbsp;</p>
	<p style="color:red;">* All fields are required</p>
	<div>
		<span>Enter something:</span>&nbsp;<input name="firstinput" <?php echo ($errorsfound > 0) ? 'class="redclass"' : '' ?>  >&nbsp;<input type="submit" value="Submit"></div>
	<div>
		<?php echo ($errorsfound > 0) ? $cluck : ''?>
		<img alt="" height="95"  width="95" src=<?php echo ($errorsfound > 0) ? '"freakout.gif?='.rand(1,32000).'"' : '"freakout-resting.gif"'?>></div>
	<p>&nbsp;</p>
	<div style="text-align:center;">
	If you press 'submit' with the field left empty the chicken will point out your mistake.
</form>

</body>

</html>
And here is a link to see the code working: http://www.lloydsplace.com/freakout_test.php

Yours to use if you like it.

December 5, 2014: added sound. You can have the sound too: http://lloydsplace.com/flustered.mp3

Re: Freakout for PHP

Posted: Fri Dec 05, 2014 8:26 pm
by netmaestro
Added sound today. Sample updated in first post.

Re: Freakout for PHP

Posted: Fri Dec 05, 2014 8:32 pm
by idle
that should be a standard :lol:

Re: Freakout for PHP

Posted: Sat Dec 06, 2014 3:21 am
by electrochrisso
:lol: You should have the chook say: type something in the box you F****** idiot. cluck cluck.