PHP/MySQL Authentication
7
A proof of concept idea I had for implementing an aspect oriented framework in PHP (yes, I know about http://aophp.net, but it requires a module).
I thought it was neat, so I'm going to share it.
Hope someone likes it.
I thought it was neat, so I'm going to share it.
Hope someone likes it.
7
This function will reverse the affects of register_globals
5
This small snippet will not allow _POST requests from a 'foreign' domain. It relies on the HTTP_REFERER variable.
10
This simple function will check if a url is valid (going by parse_url()) and if it's 'online' - by seeing if it returns a 302, 301, or 200 status code.
6
This class is a MySQL database access wrapper. It can:
- Connect to a MySQL server
- Execute SQL queries and retrieve single value results or return result rows into arrays
- Return the last inserted table row identifier, the number of result rows and the number of affected rows
- Count the number of executed queries
- Lock and unlock tables
- Escape text literal values or like patterns
- Retrieve database access errors
- Connect to a MySQL server
- Execute SQL queries and retrieve single value results or return result rows into arrays
- Return the last inserted table row identifier, the number of result rows and the number of affected rows
- Count the number of executed queries
- Lock and unlock tables
- Escape text literal values or like patterns
- Retrieve database access errors
9
This PHP class allows you to send SMS to almost every country directly from your website. All you need is an account on www.tm4b.com and PHP 5.
Also required is either cURL or allow_url_fopen enabled in php.ini
Also required is either cURL or allow_url_fopen enabled in php.ini
2
The following script is a single interface for pre-validating any HTML form. It lets you validate your form data the way you want, while handling the rudimentary tasks itself.
1) Change just one variable to make it work with $_GET or $_POST or $_REQUEST.
2) Name which elements are 'required' all at once in a hidden HTML text input.
3) Easily provide field descriptions in hidden HTML text inputs that you can use to print error statements.
4) Call a single function to print out error statements that you can easily style with CSS.
5) It automatically checks if fields marked 'required' have been filled out.
Most of the pre-validation code is from PHP 5: Unleashed by Sams Publishing. I found it extremely useful for a recent project. Sharing it here, I removed some unnecessary functions, and tried to simplify some points.
All the comments are my own; hopefully I provided more than enough explanation.
1) Change just one variable to make it work with $_GET or $_POST or $_REQUEST.
2) Name which elements are 'required' all at once in a hidden HTML text input.
3) Easily provide field descriptions in hidden HTML text inputs that you can use to print error statements.
4) Call a single function to print out error statements that you can easily style with CSS.
5) It automatically checks if fields marked 'required' have been filled out.
Most of the pre-validation code is from PHP 5: Unleashed by Sams Publishing. I found it extremely useful for a recent project. Sharing it here, I removed some unnecessary functions, and tried to simplify some points.
All the comments are my own; hopefully I provided more than enough explanation.
7
A simple MySQL class for use in PHP.
Feel free to suggest improvements.
Feel free to suggest improvements.
12
Don't know if anyone will find this handly, but here's a CSS processor that I wrote that allows me to nest CSS Blocks, and various other things, making for an easier to maintain CSS file.
Warning: I'd recommend caching the results since I didn't have a need to optomize it for speed.
Things that it includes:
*Nested CSS Rules
*Removes Whitespace
*Allows for // comments
*Removes comments (so put them in at no cost)
Please let me know what you think
Warning: I'd recommend caching the results since I didn't have a need to optomize it for speed.
Things that it includes:
*Nested CSS Rules
*Removes Whitespace
*Allows for // comments
*Removes comments (so put them in at no cost)
Please let me know what you think
13
This is a simple function that resizes and image using the GD add on for PHP.
Just a disclaimer: I know its not perfect, but i figured i would post it because the only other one on here is way confusing to some new PHP developers. Hopefully this one will help you learn how to use GD, and then you can write a better one.
Just a disclaimer: I know its not perfect, but i figured i would post it because the only other one on here is way confusing to some new PHP developers. Hopefully this one will help you learn how to use GD, and then you can write a better one.









