Seripets Development Forum
|
| | PHP Developer Position Application | |
| | Author | Message |
---|
vibramental Programmer
Posts : 8 Join date : 2010-11-23
| Subject: PHP Developer Position Application Tue Nov 23, 2010 7:12 pm | |
| Hello all, I am applying for your available position of PHP Developer. My name is Carl, however my alias is usually nobackseat or vibramental. I have been an avid developer for a little over four years now, yet everyday is a learning experience of new functions, and efficiency techniques. Below I have provided a snippet of code that I wrote for Philonova. The site was started by superturtle but then shut down soon after, unfortunately. I have removed some core functionality to prevent theft, but most if it is below. It is an elaborate site registration system that features Juddster's Database Class. It includes fool proof checks, CAPTCHA and a complex password hashing algorithm. Unfortunately, this forum doesn't have a specific PHP BBCode tag, which would syntax highlight the code to render it easier to read. - Code:
-
<?php
/* * register.php * * Author: vibramental * Date: 03/13/10 * Purpose: Registration for Philonova. * */ $pageTitle = "Registration";
include( 'inc/header.php' );
if ( isset( $_SESSION[ 'UID' ] ) && isset( $_SESSION[ 'TOKEN' ] ) ) { echo "You are already logged in."; } // logged in, then don't show registration form
else {
if ( isset( $_POST[ 'submit' ] ) ) { $errors; if ( empty( $_POST[ 'username' ] ) || empty( $_POST[ 'password' ] ) || empty( $_POST[ 'password2' ] ) || empty( $_POST[ 'email' ] ) || empty( $_POST[ 'email2' ] ) || empty( $_POST[ 'month' ] ) || empty( $_POST[ 'day' ] ) || empty( $_POST[ 'year' ] ) || empty( $_POST[ 'country' ] ) || empty( $_POST[ 'comment' ] ) || empty( $_POST[ 'ref' ] ) ) {
$errors .= "Fill in all the fields. ";
} // If any required fields are empty $bd = $month . "/" . $day . "/" . $year; // Format birthday
// COPPA check $age = floor( ( time() - strtotime( $bd ) ) / 31556926 );
if ( $age < 13 ) {
$coppa = 1;
} // If user is less than 13, mark them // reCAPTCHA check require_once( 'support/recaptchalib.php' ); $privatekey = "-- RECAPTCHA KEY --"; $resp = recaptcha_check_answer( $privatekey, $_SERVER[ "REMOTE_ADDR" ], $_POST[ "recaptcha_challenge_field" ], $_POST[ "recaptcha_response_field" ] ); if ( !$resp->is_valid ) {
$errors .= "The reCAPTCHA wasn't entered correctly. ";
} // reCAPTCHA is invalid $username_length = strlen( $_POST['username'] );
if ( $username_length > 14 || $username_length < 4 ) {
$errors .= "Username is not the correct length. ";
} // Bad username length if ( $_POST[ username ] != preg_replace( '/[^w]/', '', $_POST[ username ] ) ) {
$errors .= "Username may only contain alphanumeric and underscore characters.<br>";
} // Invalid characters in username. $username_exists = $db->query( "SELECT `ID` FROM `users` WHERE `username` = %s", $_POST[ 'username' ] );
if ( $db->numRows( $username_exists ) > 0 ) {
$errors .= $_POST[ 'username' ] . " is already taken. ";
} // Username is used by another user $password_length = strlen( $_POST['password'] );
if ( $password_length > 14 || $password_length < 6 ) {
$errors .= "Password is not the correct length. ";
} // Bad password length if ( $_POST[ 'password' ] !== $_POST[ 'password2' ] ) {
$errors .= "Passwords do not match. ";
} // If 'Confirm Password' and 'Password' fields are not identical if ( $_POST[ 'email' ] !== $_POST[ 'email2' ] ) {
$errors .= "E-mails do not match. ";
} // If 'Confirm Email' and 'Email' fields are not identical $email_exists = $db->query( "SELECT `ID` FROM `users` WHERE `email` = %s", $_POST[ 'email' ] ); if ( $db->numRows( $email_exists ) > 0 ) {
$errors .= "Email is already in use. ";
} // Email is used by another user if ( !checkdate( $_POST['month'] . "," . $_POST['day'] . "," . $_POST['year'] ) ) {
$errors .= "Date of Birth is not valid. ";
} // Is date valid? No February 30! if ( $_POST[ 'terms' ] !== "agree" ) {
$errors .= "You did not agree to the Terms of Service. ";
} // not in agreement with terms if ( !empty( $errors ) ) {
echo "You registration failed because of the following.
<b>$errors</b>";
} // There are errors; display them else { // No errors; continue $time = time(); if ( !empty( $_SERVER[ 'HTTP_CLIENT_IP' ] ) ) {
$ip = $_SERVER[ 'HTTP_CLIENT_IP' ];
} // attempts to get as accurate IP as possible
elseif ( !empty( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ) ) {
$ip = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]; } // optional method to retrieve IP
else {
$ip = $_SERVER[ 'REMOTE_ADDR' ];
} // generates random email confirmation code & password salt $listOfCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@$%^*()"; $encKey = ""; $len = rand( 30, 40 ); for ( $x = 0; $x < $len; $x++ ) {
$encKey .= $listOfCharacters[ rand( 0, strlen( $listOfCharacters ) - 1 ) ];
} $password_salt = $encKey; $encKey = ""; $len = rand( 30, 40 ); for ( $x = 0; $x < $len; $x++ ) { $encKey .= $listOfCharacters[ rand( 0, strlen( $listOfCharacters ) - 1 ) ]; } $email_code = $encKey; // Generates password using tiger192,4 encryption & randomly generated salt appended at end $password2 = $password . $password_salt; $password2 = hash( 'tiger192,4', $password2 ); // Format birthdate $birthdate = strtotime( $_POST[ 'month' ] . '/' . $_POST[ 'day' ] . '/' . $_POST[ 'year' ] ); // Add user into database $db->query( "INSERT INTO `users` (`username`,`password`,`email`,`birthday`,`whyjoin`,`last_seen`,`ip`,`gender`,`createddate`,`country`,`email_code`,`password_code`,`under13`) VALUES (%s,%s,%s,%s,%s,%u,%i,%s,%u,%s,%s,%s,%s)", $_POST[ 'username' ], $password2, $_POST[ 'email' ], $birthdate, $_POST[ 'comment' ], $time, $ip, $_POST[ 'gender' ], $time, $_POST[ 'country' ], $email_code, $password_salt, $coppa ); // Notify user of success echo "Your registration has been completed! We will send a mail to your inbox if your application is accepted."; } } // if form is submitted else { // form not submitted, show form ?>
<img src="assets/images/form_header.png" alt="" title="" border="0" /> <form action="" method="post"> <table border="0"> <tr> <td> <b> Username </b> </td> <td> <input type="text" name="username" /> </td> </tr> <tr> <td> <b> Password </b> </td> <td> <input type="password" name="password" /> </td> </tr> <tr> <td> <b> Confirm Password </b> </td> <td> <input type="password" name="password2" /> </td> </tr> <tr> <td> <b> E-mail </b> </td> <td> <input type="text" name="email" /> </td> </tr> <tr> <td> <b> Confirm E-mail </b> </td> <td> <input type="text" name="email2" /> </td> </tr> <tr> <td> <b> Gender </b> </td> <td> <select name="gender"> <option value="Male"> Male </option> <option value="Female"> Female </option> <option value="Hidden"> Hidden </option> </select> </td> </tr> <tr> <td> <b> Birthdate </b> </td> <td> <select name="month"> <option value="1"> January </option> <option value="2"> February </option> <option value="3"> March </option> <option value="4"> April </option> <option value="5"> May </option> <option value="6"> June </option> <option value="7"> July </option> <option value="8"> August </option> <option value="9"> September </option> <option value="10"> October </option> <option value="11"> November </option> <option value="12"> December </option> </select> <select name="day"> <?php for ( $i = 1; $i <= 31; $i++ ) {
echo '<option value="' . $i . '">' . $i . '</option>';
} // generate list of days of month ?> </select> <select name="year"> <?php for ( $i = 2002; $i >= 1940; $i = $i - 1 ) {
echo '<option value="' . $i . '">' . $i . '</option>';
} // generate years ?> </select> </td> </tr> <tr> <td> <b> Country </b> </td> <td> <select name="country"> <optgroup label="Select Country"> <option value="Afganistan"> Afghanistan </option> <!-- LIST OF ALL COUNTRIES HERE --> </select> </td> </tr> <tr> <td> <b> Why Join? </b> </td> <td> <textarea name="comment" id="comment" rows="6" cols="50" title="Your response here will determine your registration acceptance. Keep in mind to use proper grammar and mechanics. It may take up to 24 hours for your registration to be reviewed."> </textarea>
<span id="charlimitinfo"> 600 Character Max. </span> </td> </tr> <tr> <td> <b> Referrer </b> </td> <td> <select name="ref"> <!-- LIST OF REFERRERS --> </select> </td> </tr> <tr> <td> <b> Terms of Service </b> </td> <td> <div class="termsdiv"> <!-- SITES TERMS OF SERVICE --> </div>
Agree? <input type="checkbox" name="terms" value="agree" /> </td> </tr> <tr> <td> <b> Verification </b> </td> <td> <?php // show reCAPTCHA form require_once( 'support/recaptchalib.php' ); $publickey = "-- RECAPTCHA KEY --"; echo recaptcha_get_html( $publickey ); ?> </td> </tr> </table>
<input type="submit" name="submit" value="Register" /> </form>
Your IP Address will be logged. See Privacy Policy for more details. <img src="assets/images/form_footer.png" border="0" alt="" title="" /> </center> <?php include( 'inc/footer.php' ); ?> Please let me know what you think. While I have worked for free in the past, I request that this job be paid and I ensure that I am not what may be considered "expensive." I can provide flat rates or roughly $8/hr. I am completely open and even encourage price negotiation. When I am undisturbed (as in real life) while on the computer, I can program rather swiftly, while still maintaining the standards I have in terms of quality of code. I am easy to talk to, and hope that if/when accepted, I can do each project to your precise needs. Thank you for taking the time to read this application, Vibramental PHP Developer | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 3:30 am | |
| NBS you are over qualified, I accept this application, and now we await the verification from Martyn and Amour. | |
| | | vibramental Programmer
Posts : 8 Join date : 2010-11-23
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 4:42 am | |
| Calypso, Oh, thank you very much! I noticed your title of programmer, and am pleased that I have met your standards. (And where did you get 'NBS' from? Do you know me from somewhere else, or did you just create that using my other alias? Haha, a lot of close friends I know call me NBS, so just wondering. Either way, I don't mind. ) (One last edit - I live in Florida too, so this is becoming all the more suspicious and coincidental... ) Yes, and now we wait... | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 4:54 am | |
| Have you forgotten me that fast? Virapetz, and FantasyDepths, then I think you went to Lura as well. I was a writer for Vira, and FD, and a normal user at Lura. | |
| | | vibramental Programmer
Posts : 8 Join date : 2010-11-23
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 5:24 am | |
| It did indeed cross my mind, so you weren't "forgotten", but I would've never guessed that you programmed/took up programming. | |
| | | Martyn Owner
Posts : 336 Join date : 2010-08-18 Age : 29 Location : In your closet.
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 7:54 am | |
| Hmm... Such a tempting offer. I'll have to yes. | |
| | | Moonlight Graphics Artist
Posts : 185 Join date : 2010-08-19 Location : Under your bed.
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 8:16 am | |
| Where's Spekytr? :3 Not that we need her for this app. vibramental's pretty well known on some of the virtual pet discussion forums. | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 4:09 pm | |
| He he, I will never be forgotten, well I don't know php, yet. I will learn it in school. | |
| | | vibramental Programmer
Posts : 8 Join date : 2010-11-23
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 4:24 pm | |
| Yes, I went to Lurapets as well. I've been to so many sites. Yay, a second approval. I don't mind waiting for Amour and Spekytr. I wouldn't consider myself well known on the forums. If anything, I mostly read, watch, and observe. Besides, I was actually internet-less for the past two months. Oh, well good luck learning PHP (it is one of the easiest programming languages in the world). | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 5:11 pm | |
| To learn or use? I was going to learn on my own, but it is hard for me, since I am a visual learner, I have to see someone else do it, and show me how. | |
| | | Spektyr Head Programmer
Posts : 25 Join date : 2010-09-16 Age : 37 Location : Washington state
| Subject: Re: PHP Developer Position Application Wed Nov 24, 2010 9:18 pm | |
| Hello vibramental/Carl, I'm spektyr/Leslie.
You do appear to be rather overqualified, and that you want to work for Seripets is great. I'd be very happy to have the help.
Has someone emailed Amour? I did not know this thread existed until today, so she probably has no idea either.
If Amour accepts you, which I'm sure will happen, your first task should be to fix up the registration page. Add captcha and so forth. I have not been using Juddster's database class (even though I know I should), so if you want to begin using it I can learn it and change all the current scripts to use it.
My email is quicque at gmail, so give me a shout if you have any questions or comments. We can talk standards, formatting, version control, whatever. =) | |
| | | vibramental Programmer
Posts : 8 Join date : 2010-11-23
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 12:05 am | |
| Hello Spektyr, Nice to meet you! Thanks everyone for calling me "overqualified", but I'll do my best. I've worked at many sites and hope that I can use that to my advantage to make sure things are done right. Well, I asked Moonlight if the position was open, and she invited me to apply so I understand that y'all weren't expecting me. I hope someone can tell Amour soon. While I generally do recommend using Juddster's Database Class, I would like to see the setup first, and it'll be easier to determine if it is necessary. It is very easy to learn; and I hope that if we do use it, you will learn it quickly and will be able to apply it everywhere you program. It really is great. Thanks for providing your email. Do you have a messenger though? I strongly prefer contacting everyone by a messenger. Mainly because it is much easier to chat with someone instantly, and the only e-mail I do have is a personal one, and I'd hate to mix it in with my work. Thanks everyone. | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 12:45 am | |
| I will E-mail Amour, and please PM me your Messenger address Carl, I would love to chat with you. | |
| | | Spektyr Head Programmer
Posts : 25 Join date : 2010-09-16 Age : 37 Location : Washington state
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 1:46 am | |
| I do not use conventional IM but do talk to people through gmail's IM system (though I always appear offline). I don't use IM because it's distracting - people I don't want to talk to expect inane conversation while I'm trying to code. But feel free to add the gtalk protocol to your IM program and send me a message that way. | |
| | | Amour Owner
Posts : 34 Join date : 2010-08-18 Age : 35 Location : Over the rainbow.
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 3:39 am | |
| My apologies for the wait. I accept your application. :} Can't wait to see what's in store. | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 4:00 am | |
| Welcome to the staff team. | |
| | | vibramental Programmer
Posts : 8 Join date : 2010-11-23
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 4:09 am | |
| Calypso: Thanks for the welcome. In response to your earlier question (not 'forgotten' of course ), it is the easiest to use. Learning is always difficult for everyone, especially if it is your first language. It is most similar in syntax to C, which most people migrate from to PHP. Spektyr: Awesome! That'll work just fine. I tried adding you, but it says you don't exist. I'll PM me you my GMail so you can add it as I'm not sure how to add GMail contacts that you can message. Amour: It is no problem, I posted my application only a day ago, so this is really awesome timing. Thanks for the acceptance. | |
| | | Calypso Owner, Programmer
Posts : 413 Join date : 2010-08-18 Age : 32 Location : Florida, USA
| Subject: Re: PHP Developer Position Application Thu Nov 25, 2010 4:27 am | |
| Well I am an HTML and CSS fluent, need to learn a lot more, I want to learn Java as well. | |
| | | Sponsored content
| Subject: Re: PHP Developer Position Application | |
| |
| | | | PHP Developer Position Application | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |
|