Spiga



Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Upload Your PHP folder file to www on Netserver

After done the .php file. Open folder where you extracting netserver. Then, open folder (www) then paste the php file that have you done it.

Go to the web browser type http://localhost/.php

.php = file name of your folder.

After that browser will display your list on folder and your must selected folder you want to view.

Thank you...Hope You Enjoy with this tutorial.i not really good in english but i can do my best in practically.

Netserver Installation on your Computer

Today i will teach you how to using netserver to start doing your programming.

Ok firstly,create any file name to extract netserver file. For example "PHP". Click the netserver setup and choose the directory have you create before to extract netserver file.

After done all extracting process. click the netserver icon to install it.

*Close Skype Application if you using it.

Web/HTTP Server(Apache)
Select Manage server - > Click Apache Web Server - > Click Install -> Select PHP version 4/5-> Install . Complete...

MySQL Server Installation
Select MySQL Database Server. Complete..

After this i will updated this post and upload the netserver and thier video installation how to install netserver on computer.

Determining Last Day of a Given Month

It is often useful to determine what the last day of a given month is. Although a lookup table could tell you what the actual day is (although you would have to still calculate February based on leap years), it is often useful to have an actual time stamp for that day.

Fortunately, through the use of mktime() this is not difficult. This function accepts the following variables in order: hour,minute,second,month,day and year. The powerful part is that mktime() automatically determines zero or negative number for you correctly.

Therefore, whereas entering a month of 3 (March) and a day of 1 returns a stamp for March 1' entering a month of 3 (March) and a day of 1 returns a stamp for February.

Code below demonstrate how to take advantage of mktime() in calculating last-day-of-month time stamps.




//set the default timezone to US/Eastern
date_default_timezone_set('US/Eastern');

//Will return a timestamp of the last day in a month for a specified year
function last_day($month, $year) {

//Use mktime to create a timestamp one month into the future, but one day //less.
//Also make the time for almost midnight, so it can be used as an 'end of //month' boundary
return mktime(23, 59, 59, $month + 1, 0, $year);

}

//Determine the last day for february, 2006
$stamp = last_day(2, 2006);

//Output the result, it will be : 28
echo '

The last day for February in 2006 is: ',date('d', $stamp) , '

';

?>

Time And Date in PHP5

Application that deal with are forever present, especially in web-based application: times of form submittals, user input such as date of birth, and the updating and removal of pages when out of date are just a few examples. Though potentially complicated, the date extensions in PHP are relatively simple and straightforward.

This lesson deals mainly with the core date and time functions. These function provide all basic for time manipulation which is retrieving, formatting, and converting. One other extension, the calendar functions, is devoted to conversion between different calendar systems, such as converting dates between the Gregorian and Jewish calendars. After this you can see the fucntion cal_to_jd() and cal_from_jd() on my Quick code below.

Subject beyond the scope of this chapter is that of schedule or calendar management, such as meeting and event scheduling. An extension is available, called MCAL, which does provide such functionality. for more information, see http://php.net/mcal.

To fully utilize the time functionality of PHP, you must understand how PHP measures time. For PHP, time is measured as the number of seconds since January 1, 1970, theUNIX epoch.
Hence any moment in time is store as a simple integer. Time, when stored this way, is often referred to as a time stamp. As you will see, many functions either return a time stamp or use a time stamp as a parameter. You must be careful however, when reading documentation or code comments. Depending on context, the term time stamp can also be used in its more generic sense: a time at which something occurs. For example, when referring to web server log files, the time at which an event is logged is reffered to as a time stamp.

This i add a Quick hits of function in time and date in PHP

Get the time stamp for the current time:

$timestamp = time();

Taking no parameter, this function returns the time stamp of the current time-that is,when time() is called.



Get the current time stamp to the microsecond resolution:

$result = microtime($format);

retun the UNIX time stamp but resolved to microseconds in accuracy. If $format is false, the default, the time is returned as the string "seconds microseconds" with the seconds portion the same as that returned by time(), and microseconds as a fraction of a second.If $format is true, the time is returned as a floating point number.


Create a time stamp for a specified date and time:

$timestamp =mktime($hour,$minute,$second,$month,$day,$year);

Return a time stamp that corresponds to the specified time and date.


Format the specified time:


$string = date($format,$timestamp);

Return a string representing the given time stamp based on the specified format. If $timestamp is not specified,the current time is used.


Format a date and time, adjusting the result to be Greenwich Mean Time(GMT):

$string = gmdate($format,$timestamp);

This function is equivalent to date(), the time is adjusted to be relative to GMT representation of the given time.


Get various information about a specified time:

$time_array = getdate($timestamp);

returns an array of various values based on the given time stamp. The keys to the are array seconds,minutes,hours,mday,wday,mon,year,yday,weekday
,month.


Get and set the time zone used by the time functions:

$string = date_default_timezone_get();
date_default_timezone_set($string);

This pair of funtions gets or sets the timezone identifier


Parse any English string representation of time and produce a time stamp:

$timestamp = strtotime($english_time);

This function can take nearly any string containing a textual description of a date and time, in English, and produce the corresponding time stamp.


Validate a date against the gregorian calendar:

$isvalid = checkdate($month,$day,$year);

Returns true if the specified date can be found on the Gregorian calendar. Useful to make sure that user input or calculated time is valid.


Find sunrise and sunset times for a given position:

$time_rise = date_sunrise($day_ts, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude);

$time_set = date_sunset($day_ts, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude);

This pair of funtions returns the time of sunrise and sunset at the specified location. The constant, SUNFUNCS_RE_TIMESTAMP, tell the function to return the time as a time stamp.



Convert a date between different calendars and Julian Day Count:

$jday_count = cal_to_jd($calendar,$month,$day,$year);
$date_array = cal_from_jd($jday_count, $calendar);


This pair functions converts a date, in a specified calendar system, to and from a Julian Day Count. These are useful for converting dates from one calendar to another. The supported calendar systems are CAL_GREGORIAN, CAL_JULIAN, CAL_JEWISH and CAL_FRENCH.


I hope you interest about my post on my site. If u like any article,please subscribe now and bookmark for me. Thanks You. We will meet again. email me at Marx Nazrin

Clickbank Security Using PHP

by: Robert Plank

Here's a way to protect the products you sell with Clickbank, using their built-in protection and by implementing a 30-day expiration, all without having to worry about managing databases or customer lists.

THE FIRST STEP

First of all, Clickbank protection is decent as it is. If you want to keep your customers from passing the thank you page URL around to friends, there are a couple of things you can do.

Login to your Clickbank account: http://www.clickbank.com/login.html

At the top there's a link that says "Click HERE to modify your account". Click on the link.

On this page there are two links at the top, but one says "Click HERE to modify your account." Click on this one.

You should be at the page that allows you to edit the prices of all your Clickbank products. Scroll down to the bottom where it says:

Secret key (up to 16 letters & digits)

You should see a text box here. If it's empty, choose a secret key, type it in and remember it. It can be anything you want, but it should be different than your Clickbank password.

"COOKIE CUTTER" TOOLS

If you've looked around the Clickbank site you'd know that Clickbank offers some friendly pieces of code in a few different programming languages like Perl and PHP that can help you protect your downloads. Basically this is what happens:

* Your order link contains what's called a "seed". This is just a word or a piece of text, which can be anything you want.

* Your customer clicks on the order link and pays.

* Clickbank takes that seed, and uses your secret key on it -- basically mashes the two together and does a bunch of crazy stuff to come up with a garbled piece of junk. But this a garbled piece of junk that can ONLY come from this seed and secret key. You change the value of the seed or secret key even a little and this "hash" changes.

* The seed and the hash are passed back to the thank you page where your Clickbank script sits. (We have the secret key added to your script, and it never changes, so it doesn't need to be handed to us by Clickbank.) This Clickbank script takes the seed and the secret key and does the same crazy shit Clickbank did to us to compute your own hash.

Clickbank calls this their "cbpop" or Clickbank Proof of Purchase.

The hash was something we figured out on your own and the hash Clickbank are compared. If they match, we're in business because the customer here really did buy from us.. The customer can't figure this out on his or her own because they never actually saw the secret key. (And no, you can't "reverse" a hash to figure out the original secret key.)

If you get nothing out of what I just told you, remember this: it's almost impossible for anyone to figure out the right Proof of Purchase code without that secret key.

USING SOMEONE ELSE'S CODE

This is the PHP function they give us:

function cbValid($seed, $cbpop, $secret_key) {

// A bunch of stuff in here...

}

This function cbValid takes three parameters: $seed, $cbpop, and $secret_key. The script goes through that last step of ours I explained above, does the crazy shit and then compares the result to the one given to us by Clickbank.

Now we need to figure out what to do if your customer really didn't pay. The easiest thing to do, is just stop the script in its tracks, preventing the page under it from loading.

if (!cbValid($seed, $cbpop, $secret_key)) die();

The exclamation point means "not". We're saying, first try this...

cbValid($seed, $cbpop, $secret_key)

.. pass the seed, proof of purchase, and secret key into your black box. If the function tells us NO, do the rest. In this case, "die". Die stops everything immediately, so if you have HTML or PHP code below that line, it won't be looked at if the Clickbank validation fails.

The "proper" way to grab $seed from the query string is this way:

if (!cbValid($_GET["seed"], $_GET["cbpop"], $secret_key)) die();

You could also redirect the user to an error page of yours if you like:

if (!cbValid($_GET["seed"], $_GET["cbpop"], $secret_key)) {

header("Location:http://www.your.host/error.html");

die();

}

Instead of $seed and $cbpop we use $_GET["seed"] and $_GET["cbpop"]. This is because the variables don't appear magically out of thin air, they really appear in the URL as http://www.your.url/test.php?seed=SOMESEED&cbpop=SOMEPOP. We want these values to be taken out of the URL.

USE MINE

Here's a zip file containing your cb.php script: http://www.jumpx.com/tutorials/clickbank/cb.zip

Save it, unzip it, and open cb.php. Near the top should be a line such as:

$secret_key = "YOUR_SECRET_KEY";

Change YOUR_SECRET_KEY to that secret key you set in the Clickbank control panel.

Now, for usage... your thank you pages will have to end in .php here. Like, thankyou.php (and now it doesn't matter if they have obvious names or not -- because they'll be thoroughly inaccessible to thieves. Remember, you can simply rename your HTML pages so they end in .php and they'll still work just fine.

Put this line at the top of you thank you page script:

Be sure to upload cb.php to the same folder as your thank you page. Now, when someone goes to the thank you page, the first thing the thank you script will do is run everything in cb.php, and cb.php will take the data Clickbank has passed to see if it matches.

You're going to have to change your Clickbank order links a little. This is what they should look like now:

http://www.clickbank.net/sell.cgi?link=YOUR_CLICKBANK_ID/YOUR_PRODUCT_ID/

YOUR_PRODUCT_NAME&seed=YOUR_SEED

Replace YOUR_CLICKBANK_ID with, of course, your Clickbank ID and YOUR_SEED with the seed you want to use. This can be anything, something simple that's short and one word like the product name. But NOT your secret key.

YOUR_PRODUCT_ID is the number Clickbank shows to the left of each thank you page as you add it. When you're testing, be sure to set the price at $0.00. Once everything's in place you can raise the price of the item to $19.95 or $29.95 or whatever it's priced at.

http://www.clickbankguide.com/merchant.htm#account will explain everything if you're a Clickbank newbie.

COULDN'T THE DOWNLOAD URL, HASH, AND RECEIPT BE SHARED?

You can't prevent sharing completely... after all, your customer can always download the file and share the file, not the download URL, to friends. We can do one thing to give these would-be freeloaders a bit of a headache, and that is expiration.

Here we can say, 30 days after someone buys your product, the thank you page will be inaccessible to them. If they buy on October 25th, they can bookmark and revisit that thank you page up until November 25th at the exact time they made their purchase. It's kind of a nice compromise because it gives honest people enough time to get what they need but at the same time it becomes impractical to share the URL.

In chapter 9 of my book, Simple PHP (http://www.simplephp.com), I explained how time works on computers, they use a big number which is just a count of how many seconds have passed since January 1st, 1970. I also explained that there was a function, called strtotime(), which we could use to determine this "number" or timestamp of a certain date. For example, 30 days ago or 1 year ago.

30 days sounds about right. To figure out the Unix timestamp of this moment, minus 30 days is:

strtotime("-30 days")

Now, to store it in a variable called $expire:

$expire = strtotime("-30 days");

But you're saying, how do I know when these people purchased? I don't have that kind of information. Aha! But you can. Remember, the seed you put in your order links can be anything you want. So let's just make it the timestamp of this exact moment.

When the customer revisits the thank you page, they can't change the seed, because as I mentioned, if you change *either* the seed or the secret key, the resulting hash (proof of purchase) will be different. So you see, they're stuck with it. But, the current time always changes!

All we have to do, in cb.php, are these two steps:

* Figure out what the timestamp was exactly 30 days ago, and store this value in $expire.

* Compare the seed and $expire. If the the value of the seed is less than that of $expire, it means that the product was purchased more than 30 days ago and the visitor shouldn't be given access to the page. Die.

We've already taken care of step one by saving the timestamp 30 days prior in $expire. Now, we compare the seed (it's $_GET["seed"], remember, because we're grabbing it out of the URL string) and $expire like:

if ($_GET["seed"] Order Now

Instead of YOUR_SEED we want PHP to call the function mktime(), which gives us the current timestamp, and output it, using echo.

echo mktime();

Now just put around it...

And shove it in there.

">Order Now

Now setup a link for $0.00 in your Clickbank control panel and try it. You can be sure it works by changing that "-30 days" in strtotime to "-5 minutes". Then try accessing the download page, then wait 5 minutes and try again. Neat, isn't it?

You say, I've done this, but I have more than one product. How do I keep someone from grabbing everything once they've grabbed one?

Have your links look like the following: ">Order Now

This way the seeds will look like "stringbeans445433" if you're selling stringbeans. Then again if you're selling corn on the cob on another sales page, you can change "stringbeans" to "cornonthecob". Now the seeds for each product will be different.

Those seeds won't be all numbers, will they? So, in cb.php, do this:

$timestamp = ereg_replace("[^0-9]","",$_GET["seed");

I won't go into a lot of detail about pattern matching, but the [^0-9] means "NOT anything from 0 to 9. It basically goes through every letter and number of $_GET["seed"], and if what's there isn't a 0, 1, 2, etc. it's replaced with nothing (hence the ""). The final result is saved in a variable called $timestamp.

Since now we're looking at $timestamp and not $_GET["seed"], let's change that if-statement:

if ($timestamp

When I extracted the timestamp from the seed, I simply removed all characters that were not numbers, leaving just the numbers contained within that string. Now I want to do the opposite. Here's an example seed:

test1074482258

I take out all the numbers and am left with "test". Next I figure out which script called cb.php (which is stored in the variable $_SERVER["SCRIPT_NAME"]). Then the script takes out everything up to the last slash (/) and everything before the first dot (.). If the script was located at "/clickbank/test.php", all that's left is "test".

If you give each thank you page a different name, and make sure all your seeds reflect the correct page, i.e. if your thank you page is called "carrots", the part of that order link containing the seed should appear as:

&seed=carrots

If you don't care how Clickbank's protection works, that's your derogative. Just get the zip file and follow the instructions I've provided in cb.php.

As far as scripts that handle several Clickbank products -- I can't recommend any at this time, since I've never across any good ones. (But you should check out Harvey Segal's free site, ClickbankGuide.com, which can answer most of your questions about Clickbank.)

Here's that script again in case you missed it: http://www.jumpx.com/tutorials/clickbank/cb.zip

Make sure to read the instructions I've supplied in cb.php, get everything setup and on your web server, and you'll be well on your way to having bulletproof protection on your Clickbank products.

- G - Class Listing Download


DOWNLOAD CODE BY CLICK LINK BELOW


Geo Conversation - Convert coordinates between degrees and decimal download

GCurl - Perform HTTP requests using Curl download

Using GD Color Class - Manage colors allocated for GD images download

Gen Class - Generate MySQL table wrapper classes download

Gen Dummy Class - Generate class skeletons from existing classes download

Generic Array - Create arrays that allow members of just one type download

Geology IP - Determine the country of an IP address using GeoIP download

Gmap Builder - Present world maps on Web pages using Google Maps download

Google Hacks - Search the Internet for certain files using Google download

Google Translator - Translate texts between idioms using Google download

Grab Gmail - Grab the contact lists of a Gmail user download

Graph Colouring - Assign colors to graph points from a vertex list download

Gravatar - Retrieve Gravatar images download

Razon FTP Writer - Send files to an FTP server download

GPS Rinex - Parse GPS navigation messages in the RINEX format download


- F - Class Listing Download


DOWNLOAD CODE BY CLICK LINK BELOW


Feed Finder - Check whether an URL has an RSS or Atom feed Download

Ffmpeg - Manipulate and convert videos with ffmpeg program Download

Fast HTML Form Creator - Generate and validate Web forms Download

Fadpf - Generate PDF documents in the Farsi idiom Download

Find Date - Add to or substract day from date Download

Form Checker - Sanitize and validate user input data Download

FormLib4PHP - Generate and validate Web forms Download

Forum Integrator - Integrate with punBB and phpBB forum user systems Download

Fuse Box Manager - Generate Web applications using Fusebox framework Download


- E - Class Listing Download

DOWNLOAD CODE BY CLICK LINK BELOW


Easy Mail Smtp - Compose and send e-mail messages via SMTP download

Easy Mail - Compose and send HTML messages with attachments download

Easy Template - Template engine based on real HTML tag replacement download

Easy Thumbnail - Generate thumbnail images using the GD extension download

Edit File Tags - Find and replace tags in files with new values download

Email Parser - Parse e-mail messages using regular expressions download

Encode and optimize PHP - Obfuscate and compact PHP source files download

Error - Display exception call stack trace information download

Event - Register handlers and trigger event actions download

Extended Array Object - Create and manipulate arrays as objects download


- D - Class Listing Download


DOWNLOAD A CODE BY CLICK LINK BELOW

Daemon Emulation - Create and manage daemon processes download

Database Connection - Abstract the access to SQL databases download

Database Operation - MySQL database access wrapper download

Data Manipulate - Manipulating data using class download

Data To Graph - Generate bar charts from arrays of data download

Data To XML - Generate XML documents from data in MySQL database download

Date Difference - Calculate the difference between dates download

Date Buddy - Convert dates between ISO, MySQL and US formats download

Date Function - Spell the time relative to period or current time download

Day Iterator - Iterate the over the days of a range of dates download

Database Object - Object oriented database abstraction layer download

DB Connect Class - Simple MySQL database connection class download

Databse Code Assistant - Generate code to access databases as data objects download

DBrowser - Emulate a browser to extract content from sites download

Defensive Attack - Retrieve information of current user HTTP request download

Dev Color - Converts color values between RGB and hexadecimal download

Dictionary Object - Access arrays with the IDictionary interface download

Directory Match - Synchronize the files between two directories download

Distance Time - Calculate the speed, pace for distances ran download

Double Link List - Manage circular double-linked lists of objects download

Drastic Tools - Visualize MySQL data in Grid, Cloud and Map download

Dynamic Page - Replace comments in HTML templates with content download

Dynfetcher - Extract information from Web pages using SimpleXML download


- C - Class Listing Download


DOWNLOAD - CLICK LINK BELOW

Cache Zip Files - Cache zip content in files download

Cal Tag Cloud - Display a tag cloud from an array of tags download

Calendar Form - Display month calendars in Ukrainian download

Calendar Component - Generate calendar for a given month download

Chart Graphing Class - Generate line, bar and pie graphs and charts download

AMDev Captcha - Generate form elements for CAPTCHA validation download

Check Spam - Generate and validate CAPTCHA verification images download

Classfb - Wrapper to access Firebird databases download

Client Socket - Generic network client connection wrapper download

Class Image - Image manipulation with PHP 4 and PHP 5 support download

Class Mail Composite- Compose & send e-mail with attachments download

Code Map - Display the classes used by a PHP script download

coMySQL Class - MySQL database access wrapper download

Configuration Setting - Write and read configuration files like in .NET download

Connection PDO - Wrapper to access SQL databases using the PDO API download

Contact Grabber - Grab contacts of email and social networking sites download

Cookies Object Class - Store & retrieve composite data items in cookies download

Country From IP Adress - Lookup the country of a given IP address download

Cross Authentication - Authenticate users in multiple domains at once download

CSQLite - Wrapper to access SQLite databases under PHP 5 download

CSV managing class - Store and retrieve data from CSV files download

CSV parse and read - Parse and display data from a CSV file download

CSV tokenizer - Parse CSV files tokening data lines download

Currency Exchange - Convert values currencies using a XML feed download

Czechcourse - Get the conversion rates to the Czech currency download

- B - Class Listing Download


CLICK LINK BELOW TO DOWNLOAD


BarcodeGenerating -
Web interface to generate barcode images download

Bar Graphic - Generate bar charts using only HTML tables download

Binary Parser - Serialize and unserialize binary data download

Blogger Integration - Import a blog published in Blogger.com into a site download

BPT session manager - Manage user access sessions download

Cant Find?Try This.