forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Auto-responder for generating serials for an application

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Miscellaneous
View previous topic :: View next topic  
Author Message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri May 20, 2011 5:51 pm    Post subject: Auto-responder for generating serials for an application Reply with quote

Hello,

Does anybody know where/how I could have the following.


I will be selling an app and the payments are done by a third party. The third party sends me for each order a confirmation email. But does not manage my serials of course. So I want to be able to have an auto responder that will respond back the buyer with a serial (within a list that I have) automatically in an email. I want to avoid responding manually to each order.

Any free PHP script or something I can host on a website ? How I could do that? I looked on google, have not found anything interesting for that.

Thanks guys,

Marty
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1562

PostPosted: Fri May 20, 2011 6:29 pm    Post subject: Reply with quote

Here is part of a script I wrote and used previously to check orders automatically. It will login to a mail server, check each email, then process each order. It then deletes the emails so the next time it is checked it doesnt reprocess the same orders again. You will need to use a windows scheduled task (if you are using a windows server) or cron (on a linux server) to have this script execute periodically.


You will want to do some chages to this, such as picking a serial to send to a customer as you needed and also forwarding emails which arent valid order emails to an email address that is monitored. Id suggest that any email address being used for this purpose is only used for orders and not used elsewhere.

You may also want to see if the 3rd party company does http posts to a script, as that would be the preferable way to process orders rather than using cron/scheduled task to constantly poll your email address for orders. PayPal has the option to post direclty to your server on each order instantly without having to use email, they use standard POST variables to the php script. Take a look at other sellers like trialpay, esellerate, shareit - these all offer the ability for better integration than email polling.




Code:

<?php
  $server = "localhost";
  $mailuser = "username";
  $mailpass = "password";
 
  // Connect to email server
  $connection = @imap_open("{".$server.":110/pop3/notls}INBOX", $mailuser, $mailpass) or die("Connection to mail server failed");
  $headers = @imap_headers($connection);

 
  // Retrieve number of emails from server
  $numEmails = @imap_num_msg($connection);

  // Repeat through each email until $numEmails is reached and process each order
  for($i = 1; $i < $numEmails+1; $i++)
  {
    // Set initial email variables to be used later
    $mailheader = @imap_headerinfo($connection, $i);
    $from = $mailheader->fromaddress;
    $subject = strip_tags($mailheader->subject);
    $body = @imap_body($connection, $i);

    // Parse each line and seperate by : character, example 'Customer Name: John Doe'
    $line = explode("\n", trim($body));
    $proparray = array();
    foreach ($line as $namevalue)
    {
      list($propname, $propvalue) = explode(":", $namevalue);
      $proparray[$propname] = trim($propvalue);
    }
   
    // More email variables that we will use to generate name/serials
    $product = trim($proparray['Software Ordered']);
    $orderno = trim(proparray['Order ID']);
    $name = trim($proparray['Customer Name']);
    $email = trim($proparray['E-Mail Address']);
    $quantity = trim($proparray['Copies']);
    $country = trim($proparray['Country']);
    $ipaddress = trim($proparray['IP Address']);


    // here you add the logic to send an email with serial number, etc.  I just did a print so it prints to browser
    print "Product: $product\r\nOrder Number: $orderno\r\nCustomer Name: $name\r\nEmail Address: $email\r\nQuantity: $quantity\r\nCountry: $country\r\nIP Address: $ipaddress\r\n\r\n"


    // Deletes the order email, you can remove this if you dont want the email deleted.
    // You may also want to add some logic above that makes sure this email is a valid order email - such as all the order
    // variables - product, name, orderno are not empty - if not forward the email using the php mail() function to an address
    // that is monitored and check manually
    @imap_delete($connection, $i);
  }

  @imap_expunge($connection);
  @imap_close($connection);
  exit;

?>
Back to top
View user's profile Send private message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri May 20, 2011 7:43 pm    Post subject: Reply with quote

Wow.. thanks PK Wink

I will work on that Smile

Not simple as I thought.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Sat May 21, 2011 12:32 pm    Post subject: Reply with quote

Hi Marty...

I actually have a 3/4 finished product i was going to release...

It is called VDSP

It is written in PHP and has a MySQL database backend.


Bascially you can put it on your server, and when a user wants to buy your product, you can link directly to the file from your app (which then would open a webbrowser) with the product info.

The user then enters their name & email address.

The VDSP (PHP), then forwards the user to PayPal, and once the user pays, they are redirected back to your website were there serial number is automatically generated and shown to them. (The info is also stored in the database)

The VDSP (PHP), uses the blowfish algorythim, to create a serail key. (Based on certain paras)

This can be used for loads of different products, which can also be stored in the database with a unique crypt key for every product/version.

Then I also have the code, which you include in your VDS Program that decrypts the serial and confirms it as valid.

This is built into a VDSP.dsu file Wink

Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun May 22, 2011 4:43 pm    Post subject: Reply with quote

You could also make this in VDS to run off your PC.
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Mon May 23, 2011 5:12 pm    Post subject: Reply with quote

Nice idea Rubes_sw, will it work with something else than Paypal? I dont use paypal.

And Garrett, I never thought about VDS doing that.. will look into that Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Mon May 23, 2011 6:06 pm    Post subject: Reply with quote

I think I have codevthat will allow u to use.

Worldpay, Google checkout..., reflex, sagepay and pypal

But u could use any payment processor that have , a payment process, eg api, callback etc... faily easy to do in php
Back to top
View user's profile Send private message Send e-mail Visit poster's website
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Tue May 24, 2011 12:48 pm    Post subject: Reply with quote

Ok thanks Rubes_sw.

I use Reg.net, not sure if they have an api for that. Will look into that.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Miscellaneous All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group