Freakout for PHP

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Freakout for PHP

Post 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
BERESHEIT
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Freakout for PHP

Post by netmaestro »

Added sound today. Sample updated in first post.
BERESHEIT
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Freakout for PHP

Post by idle »

that should be a standard :lol:
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: Freakout for PHP

Post by electrochrisso »

:lol: You should have the chook say: type something in the box you F****** idiot. cluck cluck.
PureBasic! Purely the best 8)
Post Reply