Monday, July 14th, 2008
Would you like to display an email address on a web page, but need a way to protect it from spammers? This tip is for you.
Displaying your email address on your web site is an important part of good customer service. However, the fear of spam robots harvesting email addresses prevents many webmasters from doing so.
If you would like to display your email address within your web pages and not worry about it being harvested, you can protect yourself. Instead of displaying the usual mailto:you@yourdomain.com, use the following code within your HTML:
<A HREF=”mailto:you@yourdomain.com”>Contact Us</A>
When clicked on, it will display your email address correctly.
Tags: address, clicked, Contact Us, correctly, Display, Email, mailto, Protect, robots, Web Page, webmasters
Posted in web designing | No Comments »
Monday, June 30th, 2008
I came to a point where I needed to filter the user input (not just tell the user something like : “The username isn’t in the right format” or “Please choose a valid name for your username”), I mean let him to input in the form anything he wanted too but in the end what we store in the database is his processed input (only A-Z, a-z and 0-9).
I had the Visual Basic and C++ thinking .. I must do that and that and that to get rid of unwanted characters. It was a little time consuming and I was in hurry so I googled and I reached the ereg_replace help page on PHP.net website. Suddenly all became much much easier :D, just write a regular expression (ohh, by the way .. if someone asks I can write a small tutorial on regular expressions) like this : “[^A-Za-z0-9]” and that was it :).
Below is a small example on how to filter (remove all characters except uppercase/lowercase letters and numbers)
1. <?php
2. //our string
3. $str = “nek#$#hbet|20&&07″;
4. $filtered = ereg_replace(”[^A-Za-z0-9]“, “”, $str);
5. print $filtered; // will print ‘nekhbet2007′
6. ?>
PHP is a strong language with a lot of functions that help us to decrease the development time. So before thinking how to do a certain thing just take a look first at www.php.net and see if what you need isn’t already done
Tags: anything, C, characters, Data, database, functions, googled, name, PHP, Protect, user input, username, valid, your
Posted in PHP | No Comments »
Saturday, June 28th, 2008
<?
$username = “someuser”;
$password = “somepassword”;
if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {?>
<h1>Login</h1>
<form name=”form” method=”post” action=”<?php echo $_SERVER['PHP_SELF']; ?>”>
<p><label for=”txtUsername”>Username:</label>
<br><input type=”text” title=”Enter your Username” name=”txtUsername”></p>
<p><label for=”txtpassword”>Password:</label>
<br><input type=”password” title=”Enter your password” name=”txtPassword”></p>
<p><input type=”submit” name=”Submit” value=”Login”></p>
</form>
<?} else {?>
<p>This is the protected page. Your private content goes here.</p>
<?}?>
Tags: $_POST, content, else, label, password, PHP, Private, Protect, username, Webpage
Posted in PHP | No Comments »
Tuesday, June 17th, 2008
You may want to consider having more than one e-mail address: use one address whenever you sign up for anything on the Web, and give your other address only to people you know.
When you do get spam mail, never reply or click a link offering to remove you from their mailing list. This will only confirm your address is real and you will then get even more spam.
Never sign up for any spam e-mail opt-out lists, these are just another attempt to get your email address or money.
It is important that you have up-to-date anti-virus software. If a virus infects your PC it may try to use your address book to spread itself through e-mail spam to all your contacts.
Visit www.getsafeonline.org for more advice about spam prevention and security online.
Tags: e-mail address, Protect, security online, spam e-mail, spam prevention, up-to-date anti-virus software, virus infects your PC
Posted in Uncategorized | No Comments »
Monday, June 16th, 2008
One of the most annoying problem for every blog or website owner is how to protect your hosted images and files on your website, If you usually have lots of images on your site you may noticed that some people start linking (Hotlinking) to these images and this of course will increase your bandwidth usage.
So it’s very important that you protect files and images on your site to save your bandwidth, the way to do this is by using the htaccess on your host to protect your files and images.
Tags: bandwidth, bandwidth usage, files, htaccess, images, linking, Protect
Posted in htaccess | No Comments »