Category Archives: PHP/MySQL

WordPress and jQuery AJAX … and some PHP

I had an issue where I created a custom form in WordPress using jQuery, AJAX, and PHP. Here’s a quick rundown of the process. I created a custom WP template file with form HTML included. I created a JS script … Continue reading

Posted in AJAX, PHP/MySQL, WordPress | Comments Off on WordPress and jQuery AJAX … and some PHP

Get absolute path of website using PHP

<?php $path = getcwd(); echo “This Is Your Absolute Path: “; echo $path; ?>

Posted in PHP/MySQL | Tagged , , | Comments Off on Get absolute path of website using PHP

How To Start Your Own PHP MVC Framework In 4 Steps?

http://phpocean.com/tutorials/back-end/how-to-start-your-own-php-mvc-framework-in-4-steps/28

Posted in PHP/MySQL | Tagged , , | Comments Off on How To Start Your Own PHP MVC Framework In 4 Steps?

Send Email Using SMTP And PHP Mailer

Nice tut: Send Email Using SMTP And PHP Mailer http://talkerscode.com/webtricks/send-email-using-smtp-and-php-mailer.php

Posted in PHP/MySQL | Tagged , , , , | Comments Off on Send Email Using SMTP And PHP Mailer

How to view your server PHP settings – phpinfo()

<? phpinfo(); ?>

Posted in PHP/MySQL | Tagged , , | Comments Off on How to view your server PHP settings – phpinfo()

Sending mixed-type messages with PEAR::Mail_Mime

Sending mixed-type messages with PEAR::Mail_Mime

Posted in PHP/MySQL | Tagged , , , , | Comments Off on Sending mixed-type messages with PEAR::Mail_Mime

PHP – read text file and get contents

<?php $myfile = fopen(“file-to-read.txt”, “r”) or die(“Unable to open file!”); // Output one line until end-of-file while(!feof($myfile)) { echo fgets($myfile) . “<br>”; } fclose($myfile); ?>

Posted in PHP/MySQL | Tagged , | Comments Off on PHP – read text file and get contents

PHP – Connect to database

Connect to database $host_name = “dbhost.com”; $database = “dbname”; $user_name = “dbusername”; $password = “dbpassword”; $connect = mysqli_connect($host_name, $user_name, $password, $database); if (mysqli_connect_errno()) { echo “Failed to connect to MySQL: ” . mysqli_connect_error(); } else echo ‘You are connected to … Continue reading

Posted in PHP/MySQL | Comments Off on PHP – Connect to database

More form input cleaning – Validating Sanitizing and Escaping User Data

This article is somewhat specific to WordPress, but the principals are universal. https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data

Posted in PHP/MySQL, WordPress | Comments Off on More form input cleaning – Validating Sanitizing and Escaping User Data

Serious Form Security with PHP from CSS-Tricks

I great PHP article on for security. Besides stripping tags and CAPTCHA type checks, it also using a token matching system and creating a white list, and hack log.  https://css-tricks.com/serious-form-security/

Posted in PHP/MySQL | Tagged , , , | Comments Off on Serious Form Security with PHP from CSS-Tricks

Embed PHP Code in CSS files

Embed PHP Code in CSS files. March 26, 2011, Rahul, Uncategorized, , 7 Comments Have you been embedding CSS Styles into PHP files just for the sake of making the styles dynamic?Ever wished to add PHP codes in CSS files … Continue reading

Posted in PHP/MySQL | Comments Off on Embed PHP Code in CSS files

Working with Password Hashes in PHP

http://www.splitbrain.org/blog/2008-07/28-working_with_password_hashes_in_php

Posted in PHP/MySQL | Comments Off on Working with Password Hashes in PHP

Get IP and host of client using PHP

<?php// client-ip.php : Demo script by nixCraft <www.cyberciti.biz>// get an IP address$ip = $_SERVER[‘REMOTE_ADDR’];// display it backecho “<h2>Client IP Demo</h2>”;echo “Your IP address : ” . $ip;echo “<br>Your hostname : “. gethostbyaddr($ip) ;?>

Posted in PHP/MySQL | Comments Off on Get IP and host of client using PHP

Yes, I did reinvent the wheel. I spend about 3 hours creating a Captcha type form validation script.

I had a custom form in a WordPress page that submitted to PHP form handler. I needed some type of Captcha style validation function. All the plugins I found used form plugins, and all the PHP scripts I found required … Continue reading

Posted in JavsScript, jQuery, PHP/MySQL, Web Dev | Comments Off on Yes, I did reinvent the wheel. I spend about 3 hours creating a Captcha type form validation script.

PHP – loop through $_POST and assign to variables

Send form data to this script and it will loop through the $_POST array and assign each value to a variable with the name of the “name” attribute of the form element. if(is_array($_POST))   {      foreach ($_POST as … Continue reading

Posted in PHP/MySQL | Leave a comment

PHP Email Validator – Email MX DNS Record Check

Mr Walsh to the rescue again. http://davidwalsh.name/php-email-validator

Posted in PHP/MySQL | Leave a comment

www.killerphp.com – PHP tutorials

Really cool PHP tutorials. http://www.killerphp.com/

Posted in PHP/MySQL | Leave a comment

PHP – clean up form data with strip_tags() and trim()

To better protect your site from D-Bags trying to break in, use strip_tags() function to remove and code that is trying to be submitted. Also, you can clean up any white space before and after the data post by using trim(). … Continue reading

Posted in PHP/MySQL | Leave a comment

PHP – basename : get file name of current page.

I was using an include for the <head>section, but wanted to individually set the page <title>. So I used PHP basename to parse the current URL. The basename will include any query strings, so I explode the string at the … Continue reading

Posted in PHP/MySQL | Leave a comment

PHP/MySQL connect and select database

<?php // the first part assigns all the MySQL/database login info to variables $server = ‘localhost’;  // This is the server URL. $un = ‘root’;  // This is the database user name. $db = ‘log’;   // This is the name of the … Continue reading

Posted in PHP/MySQL | Leave a comment

PHP crypt() – Using PHP encryption methods

I had not done any user registration type stuff in the past and needed to figure this out. I wanted to store an encrypted password in a database, and then be able to compare a submitted pw at login. I … Continue reading

Posted in PHP/MySQL | Tagged , , | Leave a comment