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 | |
| // file_get_contents() alternative for some server environments | |
| function curl_get_contents($url) | |
| { | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_URL, $url); |
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 | |
| define('DB_HOST', 'localhost'); | |
| define('DB_NAME', ''); | |
| define('DB_USERNAME', ''); | |
| define('DB_PW', ''); | |
| $db_conn = mysqli_connect(DB_HOST, DB_USERNAME, DB_PW, DB_NAME); | |
| if(mysqli_connect_errno()){ | |
| die('MySQL database connection failed. '.mysqli_connect_error(). ' --- '.mysqli_connect_errorno()); |
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 | |
| $array = array('val1', 'val2', 'val3'); | |
| $file = fopen("file.csv","w"); | |
| fputcsv($file, array("col1", "col2", "col3") ); | |
| foreach($array as $val){ | |
| fputcsv($file, array("$val") ); | |
| } |
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 | |
| function get_trimmed($str, $char_count){ | |
| $str_trimmed = strlen($str) > $char_count ? substr($str, 0, $char_count)."..." : $str; | |
| return $str_trimmed; | |
| } | |
| ?> |
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 | |
| $to = ''; | |
| $subject = ''; | |
| $headers = "From: info@domain.com\r\n"; | |
| $headers .= "MIME-Version: 1.0\r\n"; | |
| $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; | |
| //headers .= "Bcc: other@domain.com\r\n"; | |
| $flag = ''; | |
| $email_msg_top = " |
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
| Find: | |
| <\?(?!php) | |
| Replace: | |
| <?php |
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 | |
| $IP = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); | |
| ?> |
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 | |
| $str = 'How are you?'; | |
| if (strpos($str, 'are') !== false) { | |
| echo 'true'; | |
| } | |
| ?> |
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 | |
| $var_cleaned = preg_replace("|[^0-9a-zA-Z -]|", '', $_POST['var']); | |
| ?> |
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
| # protect .htaccess | |
| <files .htaccess> | |
| order allow,deny | |
| deny from all | |
| </files> | |
| # protect wpconfig.php | |
| <files wp-config.php> | |
| order allow,deny | |
| deny from all | |
| </files> |
OlderNewer