Strip all symbols and other non a-z, 1-0 characters from a string using the handy-dandy ereg_replace.
<?php
$before= "First !@#$%^&*() Middle _+:?><|} Last";
$after= ereg_replace("[^A-Za-z0-9] ", "", $before);
echo $after
?>
And the output would be:
"First Middle Last"
---
This is very basic but I see a lot of people going about this the long way around with snippets that are 10-15 lines long (when they only need to be one)...
EDIT!:
Aken pointed out a mistake I made.
I had ereg_replace("[^A-Za-z0-9]", "", $before); when it should be ereg_replace("[^A-Za-z0-9] ", "", $before); (so that spaces are also not allowed). I have corrected the code above. I'm only human :/
Read More
For an example, visit SecretTweet.com and click in the textbox up top--the only textbox on the whole page. The captcha, tags field, language field, and submit button all are hidden until needed by the user.
<html>
<head>
<script type="text/JavaScript">
<!--
function showthetable(theTable)
{
if (document.getElementById(theTable).style.display == 'none')
{
document.getElementById(theTable).style.display = 'block';
}
}
//-->
</script>
</head>
<body>
<textarea name="whatever" cols="55" rows="2" onfocus="showthetable('TABLENAME');return true;"></textarea>
<div class="options">
<table border="0" cellpadding="0" cellspacing="0">
<tr id="TABLENAME" style="display: none;">
<td>
Hidden content until onfocus! Hooray!
</td>
</table>
</div>
Read More
I had thought it was impossible until now:
Here's a screenshot of the ad taken directly from the adwords panel:

And here's a screenshot of the ad showing up in my adsense:

So just to be sure someone hadn't magically used the exact same wording and punctuation as me, I click on my own ad (and another thing: I know google doesn't count your own clicks but do they penalize you? I'm often curious about where the ads on my site link to but don't want to click and risk google penalizing me somehow) and it takes me to my own site! WTF? Doesn't really bother me but this totally shouldn't be happening.
Read More