Work: February 2008 Archives

Free PHP Auto Form Mailer

| | Comments (2)

Auto Form Mailer is an easy to use and powerful PHP script that lets you manage even the most complex of HTML forms and have them mailed to your email address. This script assumes zero knowledge of PHP to have it working for you. It handles unlimited form fields, you can set which fields are required and which fields need to have email validation applied to them.

This auto form mailer script is pretty simple to use. All the required files are in the 'files' folder in the download package. You DO NOT have to worry about what is happening inside of the 'fm.php' script. If you are a PHP pro, then you can always fiddle around with the scrip itself, but otherwise you don't really need to.

Okay, so what you have to do is, make the right changes in your HTML form. A demo HTML form is included in the package but the following documentation helps you if you are a totally dumb human being like me:

In your HTML form, make sure the 'action' attribute is pointing to the 'fm.php' script and the post method of form submission is being used:

<form method="post" action="fm.php">

Along with that, make sure your form has the following four hidden form fields:

<input type="hidden" name="email_subject" value="Feedback from your website">
<input type="hidden" name="email_sender" value="webmaster@yoursite.com">
<input type="hidden" name="email_recipient" value="you@yoursite.com">
<input type="hidden" name="email_thanks_url" value="thanks.html">

The first one (email_subject) is the subject of the email message that you'll get when the form is submitted.

The second hidden field (email_sender) will have the email address that tells you from where the email is sent, usually its your site's email address such as webmaster@yoursite.com.

The third one is the email address where you want to actually receive the email message when the form is submitted. This should ideally be your own email address of course.

The final hidden field should be the url of the page that should be displayed once the form has been successfully submitted and emailed.


Additional Settings:

All the basic setup was done above but the Auto Form Mailer also provides additional functionality such as setting up required form fields and email validation fields.

To make sure a certain form field is required, prefix it with 'r_' in the name attribute like so:

<input type="text" name="r_Sender_Name" />

To implement the email validation field, where you need to make sure the person entered a valid email address, prefix the field with 'email_' and you're all good to go!

<input type="text" name="email_Sender_Email_Address" />


Download: www.thesocialgeek.com/afm.zip


Live Demo: http://www.thesocialgeek.com/afm/ 
(try leaving some of the initial fields empty to see the validation results)


More Help:

I have oversimplified this script so it can be used generically. You can alter it slightly to have it working within template systems such as smarty and others. If you need more help with this script, feel free to email me at kamran.usman at gmail dot com and I'll be glad to help.

Enjoy,
Kamran

php_5_advanced.jpg

I went to Saddar on Saturday and on my way back, me and my friend Saadi decided to check out Urdu bazaar as we had to look for some books related to our respective courses.

We did not find the course books we were looking for, but I saw this book titled 'PHP 5 Advanced' by Larry Ullman at Bismillah Book Shop in Urdu Bazaar. I took up the book, scanned through its contents and I thought I should buy it, so I did ;)

I have my plans to take the Zend certification exam sometime soon so I thought this might just be the right kind of book to have for the preparation. Plus, I think even without the certification, this book is worth buying.

Larry Ullman is one of my favorite authors. I have read another of his books before and I loved it! Luckily for me, this book (that I just purchased) is an ideal match to complement Larry's previous book that I read before. It takes you from where you were left in the previous book.

You can find the table of contents here to whet your appetite. I just bought the book so I am on chapter 1 right now, hopefully will finish this up soon and become a pro =P

Cheers,
Kami

OBJ Loader in OpenGL

| | Comments (5)

Our CG Course teacher Sir Fawad gave us an assignment for creating an OBJ File Reader in OpenGL. The OBJ format is an ASCII file format that represents 3D geometry. I was able to code a beautifully working OBJ Loader in a rather short time, showing a 25k+ faced tree model. It took some time to study how the OBJ Format is generally laid out and once I was done with that, that was just a matter of having to knock my brain and ask for some attention to C/C++ coding.

So, you can grab the OBJ Loader here (source file included):

http://www.thesocialgeek.com/ObjLoader.zip

Once I did that and emailed to Sir Fawad, he immediately replied back and appreciated what I did. But he asked if I can alter the code and implement the silhouette edges in this OBJ Loader. I made some use of my brain again to come up with the silhouette edges implementation of the same OBJ Loader:

http://www.thesocialgeek.com/ObjLoaderSilhouetteEdges.zip

* Please note that this second link only contains EXE and CPP file. The required OpenGL and OBJ files are in the first download link above.

I'm posting it here for some people might like to learn from it or heck use it for their own assignments straight away.

Cheers,
Kami

P.S. I've used GLUT as the windowing toolkit and C/C++ as the language. Sane troopers may use their skills to tailor it to other environments.