Last active
December 10, 2015 19:48
-
-
Save simeondahl/4484220 to your computer and use it in GitHub Desktop.
My Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0.1.8 -> 0.1.9 | |
| general: | |
| - Updated all the old PHP 4 to PHP 5 tags | |
| - Updated security to secure a MySQL injection | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.7 -> 0.1.8 | |
| general: | |
| - Added a frew ON and OFF (defrines) | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.6 -> 0.1.7 | |
| general: | |
| - Added a function that allows you to enable/disable the function and leaves no errors | |
| - Added the function to use or don't use mail if form is disabled | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.5 -> 0.1.6 | |
| general: | |
| - Added a link in the done.php file to give a link to homepage | |
| - Added a config to enable/disable mysql connection | |
| - Fixed a bug in the done.php that prevent it for updateing database (mysql_query) | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.4 -> 0.1.5 | |
| general: | |
| - Changeing some MySQL connect function names | |
| - Added the renamed functions to mysql_connect | |
| - Removed a unused comment | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.3 -> 0.1.4 | |
| general: | |
| - Fixed a bug in index.php on a "radio button" so MySQL can read it | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.2 -> 0.1.3 | |
| general: | |
| - Added a funtion to give a error if somone forgot to fill a felt in the form | |
| -------------------------------------------------------------------------------------------------- | |
| 0.1.2 | |
| general: | |
| - Added security to secure a MySQL crack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /*Here you can change settings on your website*/ | |
| define("ON" , true); | |
| define("OFF", false); | |
| // Site | |
| $site['title'] = "Simeon Side"; | |
| // MySQL | |
| $mysql['enabled'] = ON; // ON if you want to use mysql | |
| $mysql['host'] = "host"; // Host | |
| $mysql['db'] = "databse"; // Database | |
| $mysql['user'] = "user"; // Username | |
| $mysql['pass'] = "pass"; // Password | |
| // Form Settings | |
| $form_enable = ON; // set to ON to enable the the from (not the site) | |
| $form_email = "Webmaster@your domain.com"; // Set to "OFF" if you dont want to use mail | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require ("config.php"); | |
| if ($mysql['enabled']) | |
| { | |
| // MySQL Connect | |
| $connect = mysqli_connect($mysql['host'],$mysql['user'],$mysql['pass']); | |
| if (!$connect) { die('Error: ' . mysql_error()); } | |
| $name = mysqli_real_escape_string($connect, $_POST['name']); | |
| $mail = mysqli_real_escape_string($connect, $_POST['email']); | |
| $check = mysqli_real_escape_string($connect, $_POST['check']); | |
| $location = mysqli_real_escape_string($connect, $_POST['location']); | |
| $message = mysqli_real_escape_string($connect, $_POST['message']); | |
| if ( $name == '' ||$mail == '' || $check == '' || $location == '' || $message == '') { | |
| if ($check == "yes") { | |
| $check_value = "Yes"; | |
| } else { | |
| $check_value = "No"; | |
| } | |
| mysqli_select_db($mysql_db, $connect); | |
| mysqli_query($connect, "INSERT INTO `$mysql_db`.`reports` (`Name`, `Email`, `Right`, `Place`, `Message`) VALUES ($name, $mail, $check_value, $location, $message)"); | |
| echo ("We how have your message :)"); | |
| } else { | |
| echo ('You forgot a type in a felt. Please check agen.<br/>'); | |
| echo ('Please go back by pressing <a href="index.php">here</a>.'); | |
| } | |
| mysqli_close($connect); | |
| } | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| if course this will be a .php file | |
| buts now it html so you can see the colors | |
| --> | |
| <?php | |
| include ("config.php"); | |
| ?> | |
| <html> | |
| <head> | |
| <title><?=$site['title']?></title> | |
| </head> | |
| <body> | |
| <?php | |
| if ($enable_form == true) { ?> | |
| <form action="done.php" method="post"> | |
| <table style="background-color:lightgrey; margin: 0 auto;"> | |
| <tr> | |
| <td>Name: </td><td><input type="text" name="name"/></td> | |
| </tr> | |
| <tr> | |
| <td>Mail: </td><td><input type="email" name="email"/></td> | |
| </tr> | |
| <tr> | |
| <td>Right: </td><td align="left"><input type="radio" value="yes" name="check">Yes<input type="radio" value="no" name="check">No</td> | |
| </tr> | |
| <tr> | |
| <td>Place: </td> | |
| <td> | |
| <select name="location"> | |
| <option value="East">East</option> | |
| <option value="West">West</option> | |
| </select> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td>Message</td> | |
| <td> | |
| <textarea name="message"></textarea> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td></td><td align="right"><input type="submit" name="submit" value="Send"/></td> | |
| </tr> | |
| </table> | |
| </form> | |
| <?php } else { | |
| function use_mail() { | |
| if ($form_email != "OFF") { | |
| echo ("Send a email to ". $form_email . "et get more info."); | |
| } | |
| } | |
| echo ("This function is not enabled.". use_mail()); | |
| } | |
| ?> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment