if (isset($_GET['s']) && empty($_GET['s'])) { ...etc... } else { ...etc...}
exec ("say ".$_GET['s'], $output, $status);
if ($status===false) { echo "Sorry, the 'say' program crashed!"; }
you end up screwing everything up, although going around saying you "can makes websites".
your style of coding is pure RUBBISH.about, by improvising. But in a malformed manner. Hint: functions @title.
I'm sorry, but if you really want to learn something, I'm extremely confident there is enough material on the web to get you started. But there are a couple of threads here which show the exact opposite, so there are plenty of reasons to be rude and extremely condescending.A little rude and extremely condescending.
Good for you, because I find it hard to learn PHP, SQL and JS from the web, I bought two books to get me started, couldn't be more satisfied.I learnt everything I know from the web (and trial and error!). You don't need books, but if it's your preferred format then go ahead.
The web is the greatest source of knowledge for the web! All the articles written by web designers, for web designers are a godsend!
A good/bad thing is that PHP won't run if it is malformed, but HTML will, so watch out for that!
Also, PHP will run the same in every browser, but make sure you view your HTML in every browsers. Safari is pretty tolerant of errors, but IE isn't (and doesn't obey standards either).
Just imagine a world without IE![]()
Code:?s=Oops!%3b%20rm%20-r%20%2f*
The old code looked fine in IE and so does the new codeJust imagine a world without IE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>What do you want to say?</title>
</head>
<body>
<h1>What do you want to say?</h1><!-- more of the interface -->
<form action="index.php" method="get">
<input type="text" name="s" />
<input type="submit" />
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Saying: is my html valid</title>
</head>
<body>
<h1>The computer just said: is my html valid</h1>
<br /><br />
<a href="index.php"> To say something else click here </a><a href="rec/ismyhtmlvalid.aiff" > Download ismyhtmlvalid.aiff</a> <br/> <iframe src= "rec/ismyhtmlvalid.aiff" height="20" frameborder="0" /><!-- more of the interface -->
<form action="index.php" method="get">
<input type="text" name="s" />
<input type="submit" />
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
#Security Measures:
$_GET['s']=preg_replace('/[^0-9a-z , \' . -]+/i', '', $_GET['s']);
#Filename Fix
$filename = $_GET['s'];
$filename=preg_replace('/[^0-9a-z]+/i', '', $filename);
#remove old recordings
// Define the folder to clean
// (keep trailing slashes)
$captchaFolder = 'rec/';
// Filetypes to check (you can also use *.*)
$fileTypes = '*.aiff';
// Here you can define after how many
// minutes the files should get deleted
$expire_time = 20;
// Find all files of the given file type
foreach (glob($captchaFolder . $fileTypes) as $deleterFilename) {
// Read file creation time
$FileCreationTime = filectime($Filename);
// Calculate file age in seconds
$FileAge = time() - $FileCreationTime;
// Is the file older than the given time span?
if ($FileAge > ($expire_time * 60)){
// Now do something with the olders files...
#print "The file $deleterFilename is older than $expire_time minutes\n";
if ( $deleterFilename == '' ) ;{
$fdel = 'none';
}}
else ;
{
// For example deleting files:
unlink($deleterFilename);
}
}
#The interface
if ($_GET['s'] == ''){
echo "<head><title>What do you want to say?</title>
</head>
<body>
<h1>What do you want to say?</h1>";
}else{
echo "
<head>
<title>Saying: ".$_GET['s']."</title>
</head>
<body>
<h1>The computer just said: ".$_GET['s']."</h1>
<br /><br />
<a href=\"index.php\"> To say something else click here </a>";
# The Text to Speech engine
exec ('touch rec/'.$filename.'.aiff');
exec ('say -o ./rec/'.$filename.'.aiff '.$_GET['s']);
echo ('<a href="rec/'.$filename.'.aiff" > Download '.$filename.'.aiff</a> <br/>
<iframe src= "rec/'.$filename.'.aiff" height="20" frameborder="0" />') ;} ?>
<!-- more of the interface -->
<form action="index.php" method="get">
<input type="text" name="s" />
<input type="submit" />
</form>
</body>
</html>
A little rude and extremely condescending.
While trying to give him a reading on Writing Beautiful HTML Code, I found and bookmarked this. It's awesome for a beginner!
The coding style he shows is very good, and the text is not important, but the actual code. Which really is well-written and he also explains (very briefly) the separation between presentation and content at the end.Seriously? You found that slideshow useful? I thought it was badly made (several slides had the words cut off at the top and bottom), painful to sit through, and I was slightly insulted by the way the author chose to repeat statements for emphasis.
repeat statements for emphasis.
repeat statements for emphasis.
To each his/her own I guess.