CrankBerry Blog Title

PHP Postings

2009


(87) Comments

Secure PHP login without database

Categories :: PHP, Web Security

Although not recommended but maybe for some reason you need to create a PHP login without the use of any database (SQL). For some reason you maybe scared to approach, but here I made a script that is fairly secure without utilizing any database at all. It allows users to login and stay logged in. If you are one of those people then here's the script for you.

2009


(4) Comments

In page popup with faded background – in PHP

Categories :: CSS, HTML, PHP

Sometimes you may be required to have popup windows on your website. They're obtrusive and hard to style with your site, in summary – nasty. What I've seen is other websites fade out their background and have an in page popup. I came up with a script that does the same thing in PHP and it looks exactly like the image below. Jump to the next page for the script.

2009


No Comments

PHP Simple Email Validation

Categories :: PHP, Scripts and Programming

When having having forms on your website one of the most common form fields is usually the user's email. To ensure you're receiving quality information and not receiving bogus spams you should validate the email to be of a real one or close enough to. Here's a quick free email validation script for those PHP lovers.

2009


(1) Comment

PHP Image Verification aka Captcha (Basic)

Categories :: PHP, Scripts and Programming

You're making your website and you have forms. Here you are thinking, what if spam bots found my form? What if somebody submitted to my form from their own script? What should I do? Well, there's many things you can do to mitigate your worries but one of the simpler things you could do is having an image verification field in your form. Here's a basic script to generate a random code in image that bots can't read.

image verification

2009


(2) Comments

Setting PHP cron job with crontab

Categories :: PHP, Web Hosting

So you've created a PHP script that does something like clean your tables or compiles a report on some data. You want it to run it every 2 hours but you don't want to go to your computer every 2 hours. What should you do? Cron job using crontab is what you should do. Cron job is basically setting a timer on your server to run the script at a certain time that you please. Sounds easy enough, but how do you do it? Lets find out!

2009


(1) Comment

Random code and password generator in PHP

Categories :: PHP

Sometimes when you're interacting with users you need to generate a random string of code or password. For example, a user is signing up for a service and you decided to give them some random password to start with, that's what I'm talking about. Here I have a quick script which allows you to generate random code with a defined length.

2009


(5) Comments

Simple dynamic PHP sliding pagination

Categories :: PHP

The other day I was working on a website drawing out a content well over 400 rows of data. Displaying the data all on one page is a lot of stress for the user so I made a quick pagination script. By displaying 20 results per page would end up with 20 separate pages. Imaging laying out 1 to 20 across your website (ugly eh?) well it gets worst. Imagine this database doubles! Yes! We're now laying 1 to 40 across our website. So I made this simple dynamic slider in which it only displays a certain amount of pages to choose from and as you travel further it will list more pages.