Showing posts with label PHP Script. Show all posts
Showing posts with label PHP Script. Show all posts

CouponPress - Wordpress Coupon site clone script


Retail me or not clone script. CouponPress takes the power, security and flexibility of Wordpress and allows you to run your very own online coupon website! Running your own coupon website is easy with Couponpress, you simply download the theme, install it your Wordpress themes folder and your ready to go! With every download of CouponPress includes loads of easy to customize, changeable templates, professional coupon features and lots of help and support to get you started!


adopted from http://clonestop.com

Creating a Facebook-like Registration Form with jQuery


Facebook is a showcase of great UI design. And as it has become a major part of our lives, it has also raised the bar for web development, pushing developers to meet higher expectations.

This however has a good side – it challenges web developers and designers to better themselves and constantly improve their work.

In this tutorial, we are going to learn from the best, and create a facebook-like sign up form. So go ahead and download the demo files to start learning!


adopted from http://tutorialzine.com

Create Login Page Using PHP

Overview
In this tutorial create 3 files

  1. main_login.php
  2. checklogin.php
  3. login_success.php

Step
  1. Create table "members" in database "test".
  2. Create file main_login.php.
  3. Create file checklogin.php.
  4. Create file login_success.php.
  5. Create file logout.php

Create table "members"



Create file main_login.php


Create file checklogin.php


Create file login_success.php


Logout.php


For PHP5 User - checklogin.php


Encrypting Password - Make your Login More Secure



Secure File Upload with PHP

PHP makes uploading files easy. You can upload any type of file to your Web server. But with ease comes danger and you should be careful when allowing file uploads.

In spite of security issues that should be addressed before enabling file uploads, the actual mechanisms to allow this are straight forward. In this tutorial we will consider how to upload files to some directory on your Web server. We will also discuss security issues concerned with the file uploading.

The HTML Form

Before you can use PHP to manage your uploads, you need first construct an HTML form as an interface for a user to upload his file. Have a look at the example below and save this HTML code as index.php.


There are some rules you need to follow when constructing your HTML form. First, make sure that the form uses the POST method. Second, the form needs the following attribute: enctype="multipart/form-data". It specifies which content-type to use when submitting information back to server. Without these requirements, your file upload will not work.

Another thing to notice is the hidden form field named MAX_FILE_SIZE. Some web browsers actually pick up on this field and will not allow the user to upload a file bigger than this number (in bytes). You should set this value to coincide with the maximum upload size that is set in your php.ini file. It is set with the upload_max_filesize directive and the default is 2MB. But it still cannot ensure that your script won't be handed a file of a larger size. The danger is that an attacker will try to send you several large files in one request and fill up the file system in which PHP stores the decoded files. Set the post_max_size directive in your php.ini file to the maximum size that you want (must be greater than upload_max_filesize). The default is 10MB. This directive controls the maximum size of all the POST data allowed in a single request. Also make sure that file_uploads inside your php.ini file is set to On.

At least, have a look at the input tag attribute: type="file". It is used to designate the input element as a file select control. This provides a place for the URI of a file to be typed and a "Browse" button which can be used as an alternative to typing the URI.

After the user enters the URI of a file and clicks the Submit button the copy of the file will be sent to the server and the user will be redirected to upload.php. This PHP file will process the form data.

Processing the Form Data (PHP Code)

When the file was uploaded, PHP created a temporary copy of the file, and built the superglobal $_FILES array containing information about the file. For each file, there are five pieces of data. We had named our upload field 'uploaded_file', so the following data would exist:

  • $_FILES["uploaded_file"]["name"] the original name of the file uploaded from the user's machine
  • $_FILES["uploaded_file"]["type"] the MIME type of the uploaded file (if the browser provided the type)
  • $_FILES["uploaded_file"]["size"] the size of the uploaded file in bytes
  • $_FILES["uploaded_file"]["tmp_name"] the location in which the file is temporarily stored on the server
  • $_FILES["uploaded_file"]["error"] an error code resulting from the file upload

The example below accepts an uploaded file and saves it in the upload directory. It allows to upload only JPEG images under 350Kb. The code, itself, is rather clear, but we will give a little explanation. Have a look at the example and save this PHP code as upload.php.



Before you do anything with the uploaded file you need to determine whether a file was really uploaded. After that we check if the uploaded file is JPEG image and its size is less than 350Kb. Next we determine the path to which we want to save this file and check whether there is already a file with such name on the server. When all checks are passed we copy the file to a permanent location using the move_upload_file() function. This function also confirms that the file you're about to process is a legitimate file resulting from a user upload. If the file is uploaded successfully then the corresponding message will appear.

Note: Be sure that PHP has permission to read and write to the directory in which temporary files are saved and the location in which you're trying to copy the file.

This example is rather simple and its propose is to demonstrate you how to upload files using PHP. For example, you can add new conditions and allow to upload GIF and PNG images, or any other kind of files that you want. If you are unfamiliar with PHP this tutorial may be a good place to start.

Download Script

site reference http://www.webcheatsheet.com

Create Online Payment Using Paypall IPN

There are several PHP scripts and classes to process PayPal payments using their native IPN (Internet payment notification) feature. Because the whole process is based on the data you need to send via a web form to the PayPal payment processor these script look very similar.

The payment / notification process is shown via the following graphic:

Inside the form there are several required values to process a payment. PayPal gives the advice to post them all to get everything working. The following variables get some special attention:

business = your PayPal email address
cmd = single payments or subscription service (_xclick or _xclick-subscriptions)
return = the URL where the buyer get back after the payment is processed
cancel_return = the URL where the buyer get back if he has cancelled the payment
notify_url = the location where your IPN script is located
rm = how you need the data submitted from PayPal to your IPN script (1=get, 2=post)
currency_code = the currency you accept for your payment
lc = the country version of PayPal where your buyer is send to

There are much more variables, but we think that the other variables (product, order and shipment information) speak for themselves. Find a complete form provided with the example files.

To run some IPN enabled payment process we need a small script which will double check if the data which is send to the IPN script is valid according the data which is stored on the PayPal server. This feature is very important if your e-commerce accepts automatic payments.

The following code is able to check if the payment is valid against the PayPal server. Use this test to decide if the payment is valid or not.




$url = 'https://www.paypal.com/cgi-bin/webscr';
$postdata = '';
foreach($_POST as $i => $v) {
$postdata .= $i.'='.urlencode($v).'&';
}
$postdata .= 'cmd=_notify-validate';

$web = parse_url($url);
if ($web['scheme'] == 'https') {
$web['port'] = 443;
$ssl = 'ssl://';
} else {
$web['port'] = 80;
$ssl = '';
}
$fp = @fsockopen($ssl.$web['host'], $web['port'], $errnum, $errstr, 30);

if (!$fp) {
echo $errnum.': '.$errstr;
} else {
fputs($fp, "POST ".$web['path']." HTTP/1.1\r\n");
fputs($fp, "Host: ".$web['host']."\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($postdata)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $postdata . "\r\n\r\n");

while(!feof($fp)) {
$info[] = @fgets($fp, 1024);
}
fclose($fp);
$info = implode(',', $info);
if (eregi('VERIFIED', $info)) {
// yes valid, f.e. change payment status
} else {
// invalid, log error or something
}
}

As mentioned before there are some complete solutions available on the internet. If your e-copmmerce site doesn’t have a complex product catalog you should use some static code from the PayPal website. For this guide we checked the PHP toolkit provided by PayPal.

Code condition
The first thing I noticed the code is not very clean and is using a coding style which is based on older PHP versions (f.e. for systems using register globals = On)

Implementation
After some code clean-up it was possible to use the included file together with my shopping cart script. Static variables are defined in one central configuration file and dynamic files are posted via the form in your web application.

IPN features
This script is written to handle the IPN validation process with different methods: cURL, fsockopen, and libcURL. I tried only the fsockopen option because this method looks good to me and should work on almost every web platform.

Documentation
There is a “Readme” file with the information about the most important features. A complete guide is not included and the information about subscription payments is missing in all files and documents. If you decide to start with the original files you should check also the comments within the configuration and example files.

Example files
The included files are good enough to jump start your paypal payment application. All files are included for a single buy button and also for processing the payment f.e. for the items from a shopping cart. The bad thing is that the bad coding style makes it not easy to integrate the script into you own application if you’re an PHP beginner.

As mentioned before I included my own example files to this PayPal payment guide. If you have questions about this code please post them to our forum, we’re glad to help. Don’t forget the code is provided as it is and we’re not responsible for the functions and/or risks while using this code. Download the example code here.


Facebook Clone Site


Lately a lot of sites popping up cloning site of popular big sites. one of them are the facebook site clone . there are some facebook sites clone that I know and provide source script to be downloaded , like supreme, kootali. while those of the website and can not be downloaded as:
soendastreet.com, facebookclonescript.com. facebook clone script that can be downloaded requires an official license from the provider. whereas if you want to get for free, many site has been providing it. in this paper will review facebookclonescript.com site.
The image above is a screenshot of the site. when viewed from index pageviews looks much like the original. but if further understood, there is a part of facebook disguised writing of the letter F and B. like the picture that was given a red line. Writing became ook ace. Social networking sites are very potential and very profitable for the internet business. why these days many sites popping up that resembles the famous sites.

to try and if you want to register please visit the site here

Share

Share |