Beginners PHP - Xampp and Editors

7 posts Page 1 of 1
Contributors
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Beginners PHP - Xampp and Editors
smashapps
Hey guys,

Me and Benji are going to cover a range of PHP tutorials, here is a list of what we have planned:
- Downloading, Installing and Using Xampp
- Recommended editors free and paid
- MySQl I – Creating Databases, tables and connecting to them with PHP
- Retrieve data from your database and display it on your web pages
- Update databases from a HTML form
- Deleting data from a database with PHP
- PHP storing encrypted data in a database
- PHP error checking
- PHP Tutorial – Member registration and login
- PHP Tutorial – Sending emails
- PHP Tutorial – Shopping Carts
- PHP Tutorial – Checkout/Payment Systems
- Integrating with PayPal
PHP is a server sided language and requires a web server to use it. There are lots of different servers you can use but for Windows the best option would have to be Xampp.

A few things to note is that Apache runs on ports 80 and 443 by default, you need to be aware of applications that use the same port. You will need to close these applications or change the ports that Apache runs on, same goes with MySql, as we are going to be using Apache and MySql for these tutorials. IIS web server runs on port 80, and some vmware runs on 443. Just check the ports are free when you are running Xampp.

There are two main types of Xampp, installer and portable. With the installer you install it to one directory and that’s it. With the portable you can run it anywhere, like a USB and transfer everything to another PC, useful for school if you’re needing to use a web server like I do. You keep all the databases etc. on the USB.

The latest version of Xampp is buggy, so we use the second latest.

Download Xampp installer: Click here to download

Download Xampp portable: click here to download

Installation is typical, just keep clicking Next/Finish until it’s done. If you’re installing to USB it may take some time.

Once it’s installed you can run the Xampp control panel.

Image

You should be able to run Apache and MySQL with no problems. If you have any issues post them here and I’ll help you fix them.

All files you are working on are stored in a htdocs folder in Xampp. If you installed to C:/ it would be in C:/Xampp/htdocs/here. I recommend putting websites in separate folders in the htdocs folder. When you go to your webbrowser navigate to http://localhost/ and that’s where your files will be located. Like this:

Image

Except you won’t need to add the port if you’re using port 80 since that’s localhost default.

Once you’ve set up Xampp you’re ready to add files into the htdocs folder where you can then run the websites from your browser. If you want to change the location of the htdocs folder you can edit the Apache configuration file located in Xampp/Apache/conf/httpd.conf and edit the “C:/Xampp/htdocs/” path to whatever path you want to keep your websites stored in. you will need to have stopped the server, then run it again after you’ve saved your changes.

In the next tutorial I’ll talk about some editors you can use, both free and paid. If you need any help or have any questions feel free to ask.

+rep if you liked this tutorial

Editors:

Obviously there are two main types of editors, free and paid. Both types are great.

One of the best known free editors is Notepad++. It supports a huge range of languages, is easy to use and is customizable.

The editor myself and Ben use is Sublime Text 2, it's currently on version 3 and costs about $70 for a license. It has -some- intellisense and the editor is easy on the eyes.

I could list loads of editors but it all comes down to personal opinion, but I have listed to what I believe is the best free and paid. There are MANY alternatives like Dreamweaver, Netbeans, and Aptana.

So far we've gone over setting up a web server and viewing your web pages, and editors. The next tutorial will be on creating databases, tables and connecting to them with PHP. We will be using MySQLi instead of MySQL because in version 5.5 of PHP it's become depreciated, MySQLi is better to use.
Last edited by smashapps on Sun Feb 16, 2014 8:25 am, edited 1 time in total.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Re: Beginners PHP - Xampp
AnoPem
Nice tutorial, will you cover any security later on ?
https://t.me/pump_upp
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: Beginners PHP - Xampp
smashapps
Yes later on there will be a tutorial on encrypting and encrypting data, and Benji_19994 might do one on sql injections, not sure, but definitely encryption.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Re: Beginners PHP - Xampp
AnoPem
smashapps wrote:
Yes later on there will be a tutorial on encrypting and encrypting data, and Benji_19994 might do one on sql injections, not sure, but definitely encryption.
I was thinking more about the sql injection, but keep up the work cooll;
https://t.me/pump_upp
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

Re: Beginners PHP - Xampp
Shim
#AnoPem #smashapps

I had this in my file directory, using this you can protect your website/db from SQLi. It blocks all kind of quotation marks which are the basement for sql injection attacks.
Code: Select all
<?php


function sanitize($poster) {
	$poster = trim($poster);
//this line needs mysql connection
  $poster = mysql_real_escape_string($poster);
  if(get_magic_quotes_gpc())
{
$poster = stripslashes($poster);
}
  $poster = strip_tags($poster);
  $poster = str_replace(array("\n", "'", "‘", "’", "'", "“", "”", "„", "?", '"'), array("", "\’", "\’", "\’", "\’", "\"", "\"", "\"", "\"", "\""), $poster);
    return $poster;

}

while (list($Key, $Val) = each($_POST)) { 
 if (substr($Key, 0, 4) != "fsk_") {
  if (is_array($Val) === true) {
   while (list($sKey, $sVal) = each($Val)) {
    $Val[$sKey] = sanitize($sVal);
   }
   $_POST[$Key] = $Val; 
  } else {
   $_POST[$Key] = sanitize($Val); 
  }
 }
}

/*
Example Usage: 

$variable = sanitize($_POST['example']);

*/
?>
Find my programs on Softpedia
User avatar
AnoPem
VIP - Donator
VIP - Donator
Posts: 441
Joined: Sat Jul 24, 2010 10:55 pm

Re: Beginners PHP - Xampp
AnoPem
Shim wrote:
#AnoPem #smashapps

I had this in my file directory, using this you can protect your website/db from SQLi. It blocks all kind of quotation marks which are the basement for sql injection attacks.
Thanks i will save this !
https://t.me/pump_upp
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: Beginners PHP - Xampp
smashapps
Nice share #Shim, thanks!
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
7 posts Page 1 of 1
Return to “Tutorials”