• 1786阅读
  • 1回复

圣域发布的冲值收费系统 [复制链接]

上一主题 下一主题
离线clsming
 
发帖
1313
祝福宝石
0
威望
2034
玛雅之石
0
创造宝石
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2004-03-19
在MuOnline数据库中创建表cards,其中列如下
列名,数据类型,长度,允许空
===================================
cid,int,4,false
cardid,varchar,16,false
cardpw,varchar,12,false
cardtype,tinyint,1,false
cardtime,int,4,false
payid,varchar,10,true
ispaid,tinyint,1,false
issend,tinyint,1,false
paidtime,int,4,true
bbsid,varchar,10,true
isreply,tinyint,1,true


config.inc.php
以下内容为程序代码:
$sitename = ""; // 服务器名
$dbhost = ""; // 数据库服务器地址(IP)
$dbuser = ""; // 数据库用户名
$dbpw = ""; // 数据库密码
$dbname = "MuOnline"; // 数据库名
$mkid=""; //生成卡的管理用户名
$mkpw=""; //生成卡的密码
?>


index.php
以下内容为程序代码:
require("config.inc.php");
?>


<?php print sprintf("%s-帐号充值",$sitename) ?>












































































请填写充值信息




充值卡号码




提示:每个充值卡号码包含一定的VIP资格时间,并仅能充值一次。

充值卡密码




提示:使用充值卡所需的密码。

论坛帐号




提示:您想充值VIP的论坛帐号。

重复论坛帐号




提示:为防止输入错误,请再输入一次论坛帐号。

游戏帐号




提示:您需要开通的游戏帐号。

游戏密码




提示:为防止输入错误,请输入游戏帐号的密码。

验证码


输入验证码





















pay.php
以下内容为程序代码:
//parse_str($_SERVER["QUERY_STRING"]);
require("config.inc.php");
$mons["一月"]=1;
$mons["二月"]=2;
$mons["三月"]=3;
$mons["四月"]=4;
$mons["五月"]=5;
$mons["六月"]=6;
$mons["七月"]=7;
$mons["八月"]=8;
$mons["九月"]=9;
$mons["十月"]=10;
$mons["十一月"]=11;
$mons["十二月"]=12;
function filter($str) {
$str=str_replace(",", "",$str);
$str=str_replace(".", "",$str);
$str=str_replace(",", "",$str);
$str=str_replace(";", "",$str);
$str=str_replace("'", "",$str);
$str=str_replace(":", "",$str);
$str=str_replace("=", "",$str);
$str=str_replace("&", "",$str);
$str=str_replace("%", "",$str);
$str=str_replace("\"", "",$str);
$str=str_replace("$$", "",$str);
$str=str_replace("-", "",$str);
$str=str_replace(" ", "",$str);
return $str;
}
function showmsg($str,$paysuc=false) {
?>


<?php print sprintf("%s-帐号充值",$GLOBALS["sitename"]) ?>



































if(!$paysuc) {
?>









}
?>







充值卡号码:


论坛帐号:



















exit();
}
session_start();
session_register("checkcode");
$GLOBALS["cardid"]=$ps_cardid;
$GLOBALS["bbsid"]=$ps_bbsid;
$ps_cardid=filter($ps_cardid);
$ps_cardpw=filter($ps_cardpw);
if($checkcode!=$extcode) {
showmsg("验证码错误,请重新输入");
}
if($ps_bbsid!=$ps_rebbsid) {
showmsg("两次论坛帐号输入不符");
}
$dbconnect = @mssql_connect($dbhost,$dbuser,$dbpw) or showmsg("无法与数据库连接,请与管理员联系");
$dbselect = @mssql_select_db("$dbname")or showmsg("无法与数据库连接,请与管理员联系");
$sql = "SELECT * FROM MEMB_INFO WHERE memb___id = '$ps_gameid'";
$result = mssql_query($sql,$dbconnect);
if(!$result) {
showmsg("数据库错误,请与管理员联系");
}
$canfind = mssql_num_rows($result);
if($canfind==0) {
showmsg("无此帐号或密码错误,请确认是否输入正确");
}
$rows = mssql_fetch_array($result);
if($rows["memb__pwd"]!=$ps_gamepw) {
showmsg("无此帐号或密码错误,请确认是否输入正确");
}
$sql = "SELECT * FROM VI_CURR_INFO WHERE memb___id = '$ps_gameid'";
$result = mssql_query($sql,$dbconnect);
if(!$result) {
showmsg("数据库错误,请与管理员联系");
}
$canfind = mssql_num_rows($result);
if($canfind==0) {
showmsg("无此帐号或密码错误,请确认是否输入正确");
}
$rows = mssql_fetch_array($result);
$curbillingtime=$rows["Surplus_Minute"];
$billingtime=explode(" ",$curbillingtime);
$curyear=$billingtime[0];
$curmonth=$mons[$billingtime[1]];
$curday=$billingtime[2];
$curtt=mktime(0,0,0,$curmonth,$curday,$curyear);
$tt=time();
$nowyear=date("Y",$tt);
$nowmonth=date("n",$tt);
$nowday=date("j",$tt);
$nowtt=mktime(0,0,0,$nowmonth,$nowday,$nowyear);
if($curtt<$nowtt) {
$curtt=$nowtt;
}
$sql = "SELECT * FROM cards WHERE cardid = '$ps_cardid'";
$result = mssql_query($sql,$dbconnect);
if(!$result) {
showmsg("数据库错误,请与管理员联系");
}
$canfind = mssql_num_rows($result);
if($canfind==0) {
showmsg("无此充值卡号或密码错误,请确认是否输入正确");
}
$rows = mssql_fetch_array($result);
if($rows["cardpw"]!=$ps_cardpw) {
showmsg("无此充值卡号或密码错误,请确认是否输入正确");
}
if($rows["ispaid"]==1) {
$paytime=date("Y-m-d H:i:s",$rows["paidtime"]);
showmsg("这张充值卡已经在 ".$paytime." 被充值给帐号 ".$rows["bbsid"]."
\n请不要重复充值,否则我们可能会冻结您的帐号");
}
//添加充值信息
switch($rows["cardtype"]) {
case 1:
$tmpmsg="天";
$ptime=$rows["cardtime"];
break;
case 2:
$tmpmsg="月";
$ptime=$rows["cardtime"]*30;
break;
case 3:
$tmpmsg="季度";
$ptime=$rows["cardtime"]*90;
break;
case 4:
$tmpmsg="半年";
$ptime=$rows["cardtime"]*180;
break;
case 5:
$tmpmsg="年";
$ptime=$rows["cardtime"]*365;
break;
}
$curtt=$curtt+($ptime*86400);
$currtime=date("Y-m-d H:i:s",$curtt);
$paidtime=time();
$sql="update VI_CURR_INFO set Surplus_Minute='$currtime',Bill_Section=2 where memb___id='$ps_gameid'";
$result = mssql_query($sql,$dbconnect);
if(!$result) {
showmsg("数据库错误,请与管理员联系");
}
$sql="update cards set ispaid='1',payid='$ps_gameid',paidtime='$paidtime',bbsid='$ps_bbsid' where cardid='$ps_cardid'";
$result = mssql_query($sql,$dbconnect);
if(!$result) {
showmsg("数据库错误,请与管理员联系");
}
if($tmpmsg!="半年") {
showmsg("已经成功向 ".$ps_bbsid." 充入 ".$rows["cardtime"]." ".$tmpmsg."VIP时间
\n当前VIP资格到期时间: ".$currtime."
\n请您到论坛登陆之后确认您的VIP资格。",true);
}
else {
showmsg("已经成功向帐号 ".$ps_bbsid." 充入 半年 VIP时间
\n当前VIP资格到期时间: ".$currtime."
\n请您到论坛登陆之后确认您的VIP资格。",true);
}
?>

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
【別拿無知當個性】
【別拿幼稚當有性格】
【別拿你的脾氣挑戰我的耐心】
【收斂你們放縱的笑再美花也凋谢


离线clsming
发帖
1313
祝福宝石
0
威望
2034
玛雅之石
0
创造宝石
0
只看该作者 沙发  发表于: 2004-03-19
makecard.php
以下内容为程序代码:
class CCard {
function CCard() {
mt_srand((double)microtime()*1000000);
}
function rndchr() {
$s=mt_rand(0,2);
switch($s) {
case 0:
$min=65;
$max=90;
break;
case 1:
$min=97;
$max=122;
break;
case 2:
$min=51;
$max=57;
break;
}
$r=mt_rand($min,$max);
return $r;
}
function mkCard(&$CardID,&$CardPW) {
$p=0;
$cid="";
while($p<16) {
$chr=$this->rndchr();
if(($chr!=79)&&($chr!=90)&&($chr!=76)&&($chr!=73)&&($chr!=111)&&($chr!=122)&&($chr!=108)&&($chr!=105)) {
$cid=$cid.chr($chr);
$p++;
}
}
$p=0;
$cpw="";
while($p<12) {
$chr=$this->rndchr();
if(($chr!=79)&&($chr!=90)&&($chr!=76)&&($chr!=73)&&($chr!=111)&&($chr!=122)&&($chr!=108)&&($chr!=105)) {
$cpw=$cpw.chr($chr);
$p++;
}
}
$CardID=$cid;
$CardPW=$cpw;
}
}
function showmsg($str,$cresuc=false) {
?>


<?php print sprintf("%s-生成充值卡",$GLOBALS["sitename"]) ?>




































if(!$cresuc) {
?>















}
?>







管理帐号:


创建数量:


充值卡类型:





















exit();
}
session_start();
session_register("checkcode");
require("config.inc.php");
//parse_str($_SERVER["QUERY_STRING"]);
if(isset($id)&&isset($pw)&&isset($cc)&&isset($ct)&&isset($extcode)) {
$GLOBALS["manid"]=$id;
$GLOBALS["cardcount"]=$cc."张";
switch($ct) {
case "1":
$GLOBALS["cardtype"]="天数卡";
$GLOBALS["cardext"]="充值天数";
$tmpmsg="天";
break;
case "2":
$GLOBALS["cardtype"]="包月卡";
$GLOBALS["cardext"]="充值月数";
$tmpmsg="月";
break;
case "3":
$GLOBALS["cardtype"]="季度卡";
$GLOBALS["cardext"]="充值季数";
$tmpmsg="季度";
break;
case "4":
$GLOBALS["cardtype"]="半年卡";
$GLOBALS["cardext"]="";
$tmpmsg="半年";
$times=1;
break;
case "5":
$GLOBALS["cardtype"]="包年卡";
$GLOBALS["cardext"]="充值年数";
$tmpmsg="年";
break;
}
if($tmpmsg!="半年") {
$GLOBALS["extinfo"]=$times;
}
else {
$GLOBALS["extinfo"]="半年";
}
if($extcode!=$checkcode) {
showmsg("验证码错误,请重新输入");
}
if($cc<1) {
showmsg("最少需生成1张卡");
}
if($times<1&&$tmpmsg!="半年") {
showmsg($GLOBALS["cardtype"]."最少需包含1".$tmpmsg."的游戏时间");
}
if(($id==$mkid)&&($pw==$mkpw)) {
$dbconnect = @mssql_connect($dbhost,$dbuser,$dbpw) or showmsg("无法与数据库连接");
$dbselect = @mssql_select_db("$dbname")or showmsg("无法与数据库连接");
$card=new CCard();
$count=0;
while($count<$cc) {
$card->mkCard($CardID,$CardPW);
$resql = "SELECT * FROM cards WHERE cardid = '$CardID'";
$reresult = mssql_query($resql,$dbconnect);
if(!$reresult) {
showmsg("连接数据库出现错误");
}
$reresult2 = mssql_num_rows($reresult);
if($reresult2=="") {
$count++;
$sql="insert into cards (cardid,cardpw,cardtype,cardtime,ispaid,issend) values ('$CardID','$CardPW','$ct','$times','0','0')";
$result = mssql_query($sql,$dbconnect);
if(!$result) {
showmsg("连接数据库出现错误");
}
}
}
if($ct==4) {
showmsg("成功生成 ".$cc." 张包含 半年 游戏时间的充值卡",true);
}
else {
showmsg("成功生成 ".$cc." 张包含 ".$extinfo." ".$tmpmsg."游戏时间的充值卡",true);
}
exit();
}
}
?>


<?php print sprintf("%s-生成充值卡",$sitename) ?>








































































请填写生成所需信息




管理帐号




管理密码





生成数量





充值卡类型




充值天数





验证码


输入验证码




















---------------------------------------------------------------------------------
原贴:http://bbs.china-mu.com/dispbbs.asp?boardID=10&ID=74639
作者:熵焓
---------------------------------------------------------------------------------
【別拿無知當個性】
【別拿幼稚當有性格】
【別拿你的脾氣挑戰我的耐心】
【收斂你們放縱的笑再美花也凋谢


快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个

      管理员联系信箱 [email protected] 所有内容均来之互联网,如侵犯您的隐私和权益,请和我们及时联系!