Thread: Pay by SMS
View Single Post
  #1  
Old 30th June 2008, 23:30
Fynnon's Avatar
Fynnon Fynnon is offline
xxx
 
Join Date: Nov 2007
P2P
Posts: 984
Default Pay by SMS
I also would like us to develop this mod because i use it on a tracker and it is really great !
I found smth on tbdev.net so i brought it here, i don`t know if it`s working but it can be starting point !

This mod allows your users to donate by sending a SMS from their cellphone.

This script is configured to work with the swedish site: http://www.mosms.com

For those that don`t understand Swedish they need another provider of this service, here are some:

http://www.daopay.com
http://www.smskambi.com/en
http://www.123ticket.com

If you have another SMS site that you want this script to work with just easily change the $_REQUEST variables in takesms.php.
If you want help with that i can probably help you out there.


Run this query in your Database:

Code:
ALTER TABLE `users` ADD `cell` varchar(255) NOT NULL default '';
Make the next php files:

sms1.php
Code:
<?
ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
dbconn(true);
loggedinorreturn();
stdhead();
begin_main_frame();
begin_frame("SMS Donation");

  $curre = $CURUSER['username'];
  $cell = $_POST['cell'];

echo("<h2>SMS donation (25 SEK) Step 1/3</h2>");

?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
What cellphone number will you donate from?

OBS! Type your cellphone number below. See the example.


<input type="text" name="cell">

example: 0701234567



<input type="submit" name="submit" value="Continue">
</form>

<?

if($_POST['submit'] && $_POST['cell']){
  mysql_query("UPDATE users SET cell = '".mysql_real_scape_string($cell)."' WHERE username = '$curre'");
  header("Location: sms2.php");
  }

end_frame();
end_main_frame();
stdfoot();
?>
sms2.php
Code:
<?
ob_start("ob_gzhandler");
require_once("include/bittorrent.php");

dbconn(false);
loggedinorreturn();
stdhead();
begin_main_frame();
begin_frame("SMS Donation");

echo("<h2>SMS donation (25 SEK) Step 2/3</h2>
");
echo("Send a SMS to 72550 with the following information: ");
echo("");
echo("SILVTORR"); // YOUR PREFIX HERE
echo("

");
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="GET">
<input type="submit" name="submit" value="Continue">
</form>

<?

if($_GET['submit']){
header("Location: sms3.php");
}
end_frame();
end_main_frame();
stdfoot();
?>
sms3.php
Code:
<?
require_once("include/bittorrent.php");

dbconn(false);
loggedinorreturn();
stdhead();
begin_main_frame();
begin_frame("SMS Donation");

echo("<h2>SMS donation (25 SEK) Step 3/3</h2>");


echo("Your donation should now be complete!
 You will notice this with a star beside your nickname!

 The staff at silvertorrents.org are graceful for your donation and are hoping that you will like us.");


end_frame();
end_main_frame();
stdfoot();
?>
takesms.php
Code:
<?php
require_once("include/bittorrent.php");
dbconn(true);

if ((empty($_REQUEST['nr'])) || (!isset($_REQUEST['nr'])))
die('No NR is there');

$nr = $_REQUEST['nr']; // Cellphone number donation came from
$donated = $_REQUEST['tariff']; // How much that have been donated
$curre = $CURUSER['username'];
$qry = "UPDATE users SET donated = '$donated' WHERE cell = ".sqlesc($nr)." LIMIT 1"; // Remove this line if you dont have the donation mod or the donated column in your sql 
$qry2 = "UPDATE users set donor = 'yes' WHERE cell = '$nr'";
mysql_query($qry); // Remove this line if you dont have the donation mod or the donated column in your sql
mysql_query($qry2);

echo("Thank you for your donation! You are helping us to continue to run our activity //Staff"); //This is the SMS to the cellphone
?>
Just simply link your connection @Your_Provider to takesms.php .

Also be sure to have no errors in takesms.php or add this line -> error_reporting(0);

If you have errors in your takesms.php code it will be sent to the cellphone.

Why?
Well because everything you are echoing in the takesms.php file will be sent to the cellphone.
So if you have any errors in your takesms.php the error msg will be sent to the cellphone.

Thats it i'll hope you will like this mod and if you have any questions just ask.

@http://www.tbdev.net/index.php?showtopic=7028
Reply With Quote
The Following 2 Users Say Thank You to Fynnon For This Useful Post:
d6bmg (14th November 2010), FENIX (28th January 2013)