getButterfly Logo getButterfly

1. Use a redirect function in PHP without header/location stuff:

[php]
function redirect($page,$time) {
echo ‘<meta http-equiv=”refresh” content=”‘.$time.’; url=’.$page.'” />’;
}
[/php]

Now use:

[php]
redirect(‘index.php’,3);
[/php]

in order to redirect to index.php after 3 seconds.

2. Generate 3 characters salt strings:

[php]
// Salt Generator
function generate_salt() {
// Declare $salt
$salt = ”;
// And create it with random chars
for ($i = 0; $i < 3; $i++) {
$salt .= chr(rand(35, 126));
}
return $salt;
}
[/php]

Change $i < 3 with more characters, as suited to your needs.

3. Clean up user input:

[php]
$name = ucwords(strtolower($name)); // Transforms “heLLO wOrLD” into “Hello World”
[/php]


Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.



If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply