da ich wie versprochen die Systeme, die mir sinnvoll erscheinen, programmieren und releasen werde, habe ich hier nun das erste fertige System für euch.
Weitere Vorschläge werden gerne entgegen genommen (:
Das System ist ein Couponsystem.
Das Team erstellt Coupons die via eigenem E-Mail Script, Forum oder sonst wie verbreitet werden können.
Anschließend hat der Benutzer die Möglichkeit diesen Coupon einzulösen. Aktuell sind die Währung Item, Donate Coin und Vote Coin enthalten.
Bei Vorschlägen zu weiteren Währungen bitte einfach im Thread melden.
Bei Vorschlägen zu neuen Systeme oder Fragen zu diesen bitte ebenfalls einfach posten (:
Der Source Code zu dem ganzen Spaß findet sich im Anhang.
Das System lässt sich mit JEDER Webseite kombinieren egal ob es nun eine alte Stefan Pfeifer, die Sapphiere Flyff oder eine eigene Webseite ist.
define('WEBSITE_DATABASE', 'WEBSITE_DBF'); //Name of your website database
define('COUPON_TABLE_DBF', 'FLYFF'); //Name of the database where the coupon table is
define('DONATE_COIN_TABLE', 'WebAccount'); //Table where the donate coins are saved
define('VOTE_COIN_TABLE', 'WebAccount'); //Table where the vote coins are saved
define('DONATE_COIN_ROW', 'dcoins'); //Row where the value of the donate coins is saved
define('VOTE_COIN_ROW', 'vcoins'); //Row where the value of the vote coins is saved
define('SESSION_USER', 'user'); //Session Key like $_SESSION['user'] "user" which is used for the account name by your session
//CREATE COUPON
public function CreateCoupon($post){
//If button is not pressed
if(!isset($post['create'])){return false;}else{unset($post['create']);}
//SELECT ALL COUPONS
private function GetAllCoupons(){
$coupons = self::Exec($this->sql, 'SELECT * FROM ' . COUPON_TABLE_DBF . '.dbo.Coupon');
return $coupons;
}
public function SelectAllCoupons(){
$coupons = array();
$coupons['Rows'] = self::Rows(self::GetAllCoupons());
$coupons['Result'] = self::Fetch(self::GetAllCoupons(), $coupons['Rows']);
return $coupons;
}
//DELETE ALL EXPIRED COUPONS
public function DeleteAllExpiredCoupons($post){
if(!isset($post['deleteall'])){return false;}
self::Exec($this->sql, 'DELETE FROM ' . COUPON_TABLE_DBF . '.dbo.Coupon WHERE expire < ' . time());
}
//SELECT EVENT COUPONS
private function GetCouponsBySpecificEvent($post){
$post = self::Escape($post);
$coupons = self::Exec($this->sql, 'SELECT * FROM ' . COUPON_TABLE_DBF . '.dbo.Coupon WHERE [event] = ' . $post['event']);
return $coupons;
}
public function SelectEventCoupons($post){
if(!isset($post['eventcoupons'])){return false;}
if(self::EmptyInput($post) === 0){echo 'Please fill in all fields'; exit;}
public function GetCharacterByAccount(){
$account = $_SESSION[SESSION_USER];
$chars = self::Exec($this->sql, 'SELECT [m_idPlayer], [m_szName] FROM [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] WHERE [account] = \'' . $account. '\' AND [isblock] = \'F\'');
$rows = self::Rows($chars);
if($rows <= 0){die('You have to create a character before you can use a coupon.');}
$result = self::Fetch($chars, $rows);
return $result;
}
public function UseCoupon($post){
$account = $_SESSION[SESSION_USER];
if(!isset($post['usecoupon'])){return false;}
if(self::EmptyInput($post) === 0){echo 'Please fill in all fields'; exit;}
$coupon = self::GetUsersSpecificCoupon($post, $account);
$arr = array();
$arr['Rows'] = self::Rows($coupon);
if($arr['Rows'] > 0){
$arr['Result'] = self::Fetch($coupon, $arr['Rows']);
if(intval($arr['Result'][1]['expire']) >= time()){
if(intval($arr['Result'][1]['used']) === 0){
if($arr['Result'][1]['account'] === '0'){
$characterSave = $post['character'];
$post = self::Escape($post);
$charlength = strlen($characterSave);
$str = null;
for($i = 1;$i <= 7-intval($charlength);$i++){
$str .= '0';
}
$str .= $characterSave;
echo $str;
self::GetSpecificReward($arr['Result'][1]['schedule'], $arr['Result'][1]['value'], $str, $account, $arr['Result'][1]['coupon']);
echo 'Item has been send to your character.'; exit;
}else {
if($arr['Result'][1]['account'] === $account){
self::GetSpecificReward($arr['Result'][1]['schedule'], $arr['Result'][1]['value'], $post['character'], $account, $arr['Result'][1]['coupon']);
echo 'Item has been send to your character.'; exit;
}else {
echo 'This coupon is reserved for another player.'; exit;
}
}
}else {
echo 'Coupon was already used by another player.'; exit;
}
}else {
echo 'Coupon has been expired.'; exit;
}
}else {
echo 'Coupon not found.'; exit;
}
}
}
class Validation {
public static function EmptyInput($array){
$result = 1;
foreach($array as $key => $value){
if(empty($array[$key])){
return $result = 0;
}
}
return $result;
}
//CREATE COUPON
public function CreateCoupon($post){
//If button is not pressed
if(!isset($post['create'])){return false;}else{unset($post['create']);}
//SELECT ALL COUPONS
private function GetAllCoupons(){
$coupons = self::Exec($this->sql, 'SELECT * FROM ' . COUPON_TABLE_DBF . '.dbo.Coupon');
return $coupons;
}
public function SelectAllCoupons(){
$coupons = array();
$coupons['Rows'] = self::Rows(self::GetAllCoupons());
$coupons['Result'] = self::Fetch(self::GetAllCoupons(), $coupons['Rows']);
return $coupons;
}
//DELETE ALL EXPIRED COUPONS
public function DeleteAllExpiredCoupons($post){
if(!isset($post['deleteall'])){return false;}
self::Exec($this->sql, 'DELETE FROM ' . COUPON_TABLE_DBF . '.dbo.Coupon WHERE expire < ' . time());
}
//SELECT EVENT COUPONS
private function GetCouponsBySpecificEvent($post){
$post = self::Escape($post);
$coupons = self::Exec($this->sql, 'SELECT * FROM ' . COUPON_TABLE_DBF . '.dbo.Coupon WHERE [event] = ' . $post['event']);
return $coupons;
}
public function SelectEventCoupons($post){
if(!isset($post['eventcoupons'])){return false;}
if(self::EmptyInput($post) === 0){echo 'Please fill in all fields'; exit;}
public function GetCharacterByAccount(){
$account = $_SESSION[SESSION_USER];
$chars = self::Exec($this->sql, 'SELECT [m_idPlayer], [m_szName] FROM [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] WHERE [account] = \'' . $account. '\' AND [isblock] = \'F\'');
$rows = self::Rows($chars);
if($rows <= 0){die('You have to create a character before you can use a coupon.');}
$result = self::Fetch($chars, $rows);
return $result;
}
public function UseCoupon($post){
$account = $_SESSION[SESSION_USER];
if(!isset($post['usecoupon'])){return false;}
if(self::EmptyInput($post) === 0){echo 'Please fill in all fields'; exit;}
$coupon = self::GetUsersSpecificCoupon($post, $account);
$arr = array();
$arr['Rows'] = self::Rows($coupon);
if($arr['Rows'] > 0){
$arr['Result'] = self::Fetch($coupon, $arr['Rows']);
if(intval($arr['Result'][1]['expire']) >= time()){
if(intval($arr['Result'][1]['used']) === 0){
if($arr['Result'][1]['account'] === '0'){
$characterSave = $post['character'];
$post = self::Escape($post);
$charlength = strlen($characterSave);
$str = null;
for($i = 1;$i <= 7-intval($charlength);$i++){
$str .= '0';
}
$str .= $characterSave;
echo $str;
self::GetSpecificReward($arr['Result'][1]['schedule'], $arr['Result'][1]['value'], $str, $account, $arr['Result'][1]['coupon']);
echo 'Item has been send to your character.'; exit;
}else {
if($arr['Result'][1]['account'] === $account){
self::GetSpecificReward($arr['Result'][1]['schedule'], $arr['Result'][1]['value'], $post['character'], $account, $arr['Result'][1]['coupon']);
echo 'Item has been send to your character.'; exit;
}else {
echo 'This coupon is reserved for another player.'; exit;
}
}
}else {
echo 'Coupon was already used by another player.'; exit;
}
}else {
echo 'Coupon has been expired.'; exit;
}
}else {
echo 'Coupon not found.'; exit;
}
}
}
class Validation {
public static function EmptyInput($array){
$result = 1;
foreach($array as $key => $value){
if(empty($array[$key])){
return $result = 0;
}
}
return $result;
}
Guter Release ^^
Deine Item Liste (wahrscheinlich dynamisch gelistet) releast du doch bestimmt auch
Die item Liste ist relativ einfach zu machen.
Wie es mit Ajax aussieht weiß ich nicht.
Aber du musst um so eine Liste zu erhalten item_dbf aktivieren danach kannste den PHP Code schreiben.
Die item Liste ist relativ einfach zu machen.
Wie es mit Ajax aussieht weiß ich nicht.
Aber du musst um so eine Liste zu erhalten item_dbf aktivieren danach kannste den PHP Code schreiben.
Wie ich eine solche Liste mache ist mir bewusst Gentros, ich bin nicht gerade kurz in der Web Entwicklung. Ajax hält die Liste permanent aktuell und verbessert die Ladezeit da die Liste ja nicht gerade klein ist.
Aber wenn es für dich so einfach ist, warum hat AMAZEN es für dich gecodet und nicht du selber?
Was hat denn ein asynchroner XML Call mit der Aktualität einer Liste zu tun?
Wollt ihr alle paar Sekunden ALLE Items aus der Datenbank laden lassen, nur damit die Liste auf der Homepage aktuell ist?
Naja man hätte auch das Promocode System von xBlubbs erweitern können, welches man übrigens im Release von Chyukasame findet(Forsaken Flyff Release).
Hätte hätte Fahrradkette.
Ich persönlich würde es auch selber schreiben, wenn ich die Kenntnisse dafür habe. Wozu dann also ein bestehendes nehmen und umschreiben? :P
Amazen hat es wirklich schon gut gemacht. ^^
[B]Coupon System [S]PSC, PP, E*gold 11/22/2014 - Metin2 Trading - 2 Replies Vorwort:
Hallo Community,
wie in der Überschrift bereits erwähnt. Biete ich hier ein Coupon System für das Hen-Script.
Funktionen:
- Ein Admin kann Coupons erstellen
- Diese kann man jemandem geben
- Jemand kann Sie einlösen und erhält Coins
- Beispiel: Man kann einen Couponshop erstellen. (Treasures auf EPVP) o.ä.
[Release] Coupon-System für das hen! CMS 08/10/2012 - Metin2 PServer Guides & Strategies - 9 Replies Guten Abend,
nach langer Zeit gibt es mal wieder ein Release von mir. Das System wurde nicht benutzt und ich benötige es nicht, daher möchte ich es euch nun zur Verfügung stellen. Vielleicht baut der ein oder andere User das System etwas aus, das liegt in eurer Hand. Dies ist kein Neueinstieg in die Sektion, es ist lediglich ein kleines Geschenk. Ich gebe keinen Support zu dem Coupon-System, bei den Tests funktionierte es einwandfrei ;-)
Was bringt mir das Coupon-System?
Nachdem das...