Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 09:50

  • Please register to post and access all features, it's quick, easy and FREE!

 

[Release] Promo item script

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2011
Posts: 250
Received Thanks: 324
[Release] Promo item script

Hello,
On my free time I was bored and decided to make a promo item script. I
based it off the gpotato coupon page. It uses a 16 character code(4 characters per box). I used the cash shop login script so i didn't bother making a login script for it but if anyone would like me to leave a message here and I will make it when I have time.OK, here is the scripts for it.

Promo_Code.sql


used_promo.sql
promo.php
PHP Code:
<?php
session_start
();
?>

<!DOCTYPE HTML>
<header>
<title>Promotional Item</title>
<div align="center">
<?php
if (file_exists('func.php')) {
  include 
'func.php';  
} else {
    echo 
'Sorry, was unable to locate the required script. =(';
    exit();
}

if (!
logged_in()) {
    echo 
'<font color="red">You must be logged in to view this page!</font>';
    exit();
}

?>
</div>
<script type="text/javascript">
function FocusMove(srcObj, maxLen, moveObj)
{
    if (srcObj.value.length >= maxLen)
    {
        try
        {
            if(typeof(moveObj) != "object")
            {
                moveObj = document.getElementsByName(moveObj)[0];
            }
            moveObj.focus();
            try{moveObj.select();}catch (E2){}
        }
        catch (E){}
    }
}
</script>
</header>
<body>
<div align="center">
<form action="" method="post">
<p>Please insert your promotional item code below.</p> <br />
<input type="text" name="code1" maxlength="4" size="4 px" onkeyup="FocusMove(this,4,'code2');"  autocomplete="off" /> -
<input type="text" name="code2" maxlength="4" size="4 px" onkeyup="FocusMove(this,4,'code3');" autocomplete="off" /> -
<input type="text" name="code3" maxlength="4" size="4 px" onkeyup="FocusMove(this,4,'code4');" autocomplete="off" /> -
<input type="text" name="code4" maxlength="4" size="4 px" autocomplete="off" /> <br />
<input type="submit" name="submit" value="Claim your promo item!" />
</form>
<footer>
<div align="center"><p>Made by <font color="blue">xXExiledXx</font></p></div>
</footer>
</div>
</body>
func.php
PHP Code:
<?php
function logged_in() {
    return isset (
$_SESSION['user_id']);
}

if (isset(
$_POST['submit'])) {
    
$code1 $_POST['code1'];
    
$code2 $_POST['code2'];
    
$code3 $_POST['code3'];
    
$code4 $_POST['code4'];
    
    if (
strlen($code1) > || strlen($code2) > || strlen($code3) > || strlen($code4) >4) {
      echo 
'<font color="red">Your promo code is too long please re-enter it!</font>';
      exit();
    } else{
        
mssql_connect('127.0.0.1''sa''') or die(mssql_get_last_message());
        
       
$query mssql_query("SELECT * FROM [Auth].[dbo].[Promo_Code] WHERE code1 = $code1 and code2 = $code2 and code3 = $code3 and code4 = $code4") or die(mssql_get_last_message());
       
$row_num mssql_num_rows($query);
       
       if (
$row_num == 0) {
        echo 
'<font color="red">You have put a invalid promo code!</font>';
        exit();
       } else {
        
$item mssql_fetch_assoc($query);
        
$account_id $_SESSION['user_id'];
        
$item_code $item['item_code'];
        
$get_used_items mssql_query("SELECT * FROM [Auth].[dbo].[used_promo] WHERE account_id = '$account_id' and item_code = '$item_code'");
        
$get_used_rows mssql_num_rows ($get_used_items);        
        if (
$get_used_rows 0) {
           echo 
'<font color="red">You have already used this promo code!</font>';
           exit();            
        } else {
          
          
$account_id $_SESSION['user_id'];
            
$item_count $item['item_count'];
          
$rest_item_count $item_count;
          
$format"d/m/Y G:i:s";
          
$bought_time date($format);
          
$valid_time date("d/m/Y G:i:s"mktime(date("G"), date("i"), date("s"), date("m"), date("d")+30,  date("Y")));
          
$taken_account_id $account_id;
        
          
mssql_query("INSERT INTO [Telecaster].[dbo].[PaidItem](account_id,item_code,item_count,rest_item_count,bought_time,valid_time,taken_account_id) VALUES('$account_id','$item_code','$item_count','$rest_item_count','$bought_time','$valid_time','$taken_account_id')");
          
mssql_query("INSERT INTO [Auth].[dbo].[used_promo](account_id, item_code) VALUES ('$account_id', '$item_code')");
         
          
$get_nameid mssql_query("SELECT * FROM [Arcadia].[dbo].[ItemResource] WHERE id='$item_code'");
          
$get_namecode mssql_fetch_assoc($get_nameid);
          
$name_id $get_namecode['name_id'];
          
$get_name mssql_query("SELECT * FROM [Arcadia].[dbo].[StringResource] WHERE code = '$name_id'");
          
$name_sql mssql_fetch_assoc($get_name);
          
$item_name $name_sql['value'];
        
          echo
'Your <b>',$item_name,'(s)</b> has been place in ur item box. Have a great day!';
            }
        }
    }
}


?>



xXExiledXx is offline  
Thanks
14 Users
Old   #2
 
elite*gold: 0
Join Date: Feb 2012
Posts: 32
Received Thanks: 1
hmm will give this a try and let ya know thanks for sharing


akindain is offline  
Old   #3
 
elite*gold: 0
Join Date: Oct 2010
Posts: 2,557
Received Thanks: 2,412
Eww it uses the MSSQL api. No worries mate. I will write out the MSSQL and pm you a SQLSRV copy so you can update this post. I am pretty sure Microsoft officially depreciated the MSSQL Api in favor of the SQL Driver. PM you soon.
ismokedrow is offline  
Old   #4
 
elite*gold: 0
Join Date: Mar 2011
Posts: 250
Received Thanks: 324
Ok, Thank you drow!


xXExiledXx is offline  
Old   #5
 
elite*gold: 0
Join Date: Apr 2012
Posts: 14
Received Thanks: 1
Ok, Thank you

Is that it would be possible to have the php authentication for your promo item which is really great!

Sorry for bad english i am french
orionware is offline  
Old   #6
 
elite*gold: 0
Join Date: Jul 2010
Posts: 98
Received Thanks: 28
for what is this script?
BartSimpson99 is offline  
Old   #7
 
elite*gold: 0
Join Date: Aug 2012
Posts: 312
Received Thanks: 252
Quote:
Originally Posted by BartSimpson99 View Post
for what is this script?
For php.

Noob question ! Noob answer

Hope you like me :troolll:


gr4ph0s is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
|>>|Rift EU Collectors Edition + Promo-Item + LvL 35 Rogue + other Chars + CHEAP!!
Hi! I'd like to sell my Rift EU Account : + Collectors Edition + Promo-Item : "Wohlgesponnener Hut" + lvl 35 Rogue >> Spross-Passage + 2-3...
2 Replies - Rift Trading
Suche Item Promo Für Navicat?
Also... Ich Suche- Item promo für navicat also für die neuen waffen ... könnte mir jemand helfen?
1 Replies - Metin2 PServer - Discussions / Questions



All times are GMT +2. The time now is 09:50.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.