hilfe bei handle.php

11/24/2014 16:33 D@rk-€vil#1
ich habe einen zahlungsanbieter für mein itemshop gefunden.
allerdings weis ich nicht wie ich den in die handler.php reinbekomme.
Ich habe schon versucht die orginaldaten zu ersetzen, aber dies schlug bisher fehl.
Deswegen die frage an euch, vielleicht weis ja einer wie ich das machen muss.

Handler.php
PHP Code:
<?php
    
#Security
    
define'IN_MALL' );
    
    
#Include config
    
require_once( './config.php' );
    
    
#Include bootstrap
    
require_once( './bootstrap.php' );
    
    
#Logged In
    
if( isset( $_SESSION['userName'] ) )
    {
        
#Lel
        
if( $_SESSION['logIP'] != $_SERVER['REMOTE_ADDR'] )
        {
            
session_destroy();
            
            exit;
        }
    
        
#Trying to buy
        
if( isset( $_POST['buy'] ) )
        {
            
$Item $_POST['buy'];

            
#Numbers only
            
if( preg_match'/^[0-9][0-9]*$/' $Item ) == )
            {
                
#Get Info
                
$ItemInfo Functions::GetItemInfo$Item );
                
                
#Item doesn't exist
                
if( count$ItemInfo ) == )
                {
                    
Functions::Error'Invalid item' );
                }
                
                
#Fucking nest
                
$ItemInfo $ItemInfo[0];
                
                
#Get user points
                
$Points Functions::GetUserPoints$_SESSION['nEMID'] );
                
                
#Failed to get user points
                
if( count$Points ) == )
                {
                    
Functions::Error'Server error' );
                }
                
                
#Fucking nest
                
$Points $Points[0]['nAGPoints'];

                
#Enough points?
                
if( $ItemInfo['nPrice'] > $Points )
                {
                    
Functions::Error'You do not have enough points' );
                }
                
                
#Deduct points
                
Functions::SubtractPoints$_SESSION['nEMID'] , $ItemInfo['nPrice'] );

                
#Give item
                
Functions::AddItem$_SESSION['nEMID'] , $ItemInfo );
                
                
Functions::Error'Item bought' );
            }
            else
            {
                
Functions::Error"Invalid item" );
            }        
            
        }
        
#Coins
        
else if( isset( $_GET['coins'] ) )
        {
            
$Coins functions::GetUserPoints$_SESSION['nEMID'] );
            
            
$Coins $Coins[0]['nAGPoints'];        
            
            echo 
$Coins;
        }
        
#Specific category
        
else if( isset( $_GET['cat'] ) )
        {
            
$Cat $_GET['cat'];
        
            
#Valid sub-category?
            #Sub-Cats are number indexed
            
if( preg_match'/^[0-9][0-9]*$/' $Cat ) == )
            {
                
$Results Functions::GetCat$Cat );
                
                
#Category is real
                
if( count$Results ) > )
                {
                    
$Results $Results[0]['nCat'];
                
                    
$Items Functions::GetItemsByCat$Results );
                    
                    
#No items in category
                    
if( count$Items ) > )
                    {
                        echo 
'<ul class="thumbnails">';
                    
                        foreach( 
$Items as $Key => $Info )
                        {
                            
$Info = (object) $Info;
                            
                            
functions::PrintItem$Info );
                        }    
                        
                        echo 
'</ul>';
                    }
                    else
                    {
                        
Functions::Error'No items in this category' true );
                    }
                }
                else
                {
                    
Functions::Error'Invalid category' true );
                }
            }
            else if( 
$Cat == -)
            {
                echo 
'<iframe 
src="https://api.***********.com/api/subscription
?key=79e2eeb73688f48286d5a613826058b8
&uid=user42
&widget=p10
&email=user%40hostname.com
&sign_version=3
&sign=SIGNATURE" width="750" height="800" frameborder="0">
</iframe>'
;

            }
            else if( 
$Cat == -)
            {
                echo 
"Yo! Paypal!";
            }
            else
            {
                
Functions::Error"Invalid category" true );
            }
        }
        
#Tried to log out?
        
else if( isset( $_GET['logout'] ) )
        {
            
Functions::LogOut();
            
            
Functions::Redirect'index.php' );
        }        
        
#Default
        
else
        {
            
$Coins functions::GetUserPoints$_SESSION['nEMID'] );
            
            
$Coins $Coins[0]['nAGPoints'];
            
            echo 
'<div class="navbar">
                    <div class="navbar-inner">
                        <ul class="nav">'
;
                        
            
$i Functions::PrintCategories();
            
            echo 
'</ul><div class="btn-group" style="float:right;">
              <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                Options
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
              <li><a href="#">' 
sprintf"Logged in as, <b style=\"color:red;\">%s</b>" htmlentities$_SESSION['userName'] ) ) . '</a></li>
              <li><a id="coins_lbl" href="#" onclick="updateCoins(); return false;">' 
sprintf"Coins:<b style=\"color:red;\">%s</b>" htmlentities$Coins ) ) . '</a></li>
              <li id="lbl_-1"><a href="#" onclick="loadCat(-1); return false;"><img src="./Template/img/dollar.png" alt="" /> Payment Wall</a></li>
              <!--<li><a href="#" onclick="loadCat(-2); return false;"><img src="./Template/img/dollar.png" alt="" /> Paypal</a></li>-->
              <li><a href="#" onclick="Logout(); return false;"><b>Logout<b/></a></li>
              </ul>
            </div>'
;        
            
            echo 
'</div></div>';
            
            if( 
$i == )
            {
                
Functions::Error"There are no mall items yet!" true );
            }
            else
            {
                echo 
'<script>$("#main").html(\'<div class="alert alert-info">Klicke auf eine kategorie um dir deine Items zu Kaufen! <button type="button" class="close" data-dismiss="alert">&times;</button></div>\');</script>';
            }
        }
    }
    
#Not logged in
    
else
    {
        
#Tried to log in?
        
if( isset( $_POST['username'] ) && isset( $_POST['password'] ) )
        {
            
$Username $_POST['username'];
            
            
$Password $_POST['password'];
            
            
#Validate input
            
if( strlen$Username ) < || strlen$Username ) > 15 || preg_match'/[^a-zA-Z0-9]/' $Username ) > )
            {
                
Functions::Error'3' );
            }
            elseif( 
strlen$Password ) < || strlen$Password ) > 20 )
            {
                
Functions::Error'2' );
            }
            
            
#Hash password
            
$Password Functions::MakePw$Username $Password );
            
            
#User didn't exist
            
if( $Password == null )
            {
                
Functions::Error'1' );
            }

            
#Validate login
            
$Results Functions::LoginValidate$Username $Password );
            
            if( 
count$Results ) > )
            {
                
$Results $Results[0];
            
                
Functions::SetLogin$Results );
                
                
Functions::Error'4' );
            }
            
#Invalid
            
else
            {
                
Functions::Error'1' );
            }
        }
        
#Nada
        
else
        {
            
Functions::LoggedOut();
        }
    }
?>
11/24/2014 18:05 DuOtto#2
Das kommt auf den Zahlungsanbieter an.

Bei Paypal beispielsweise leitest du den User mit bestimmten Parametern auf die Zahlungsseite weiter.
Paypal führt dann die Zahlung aus und sobald das Geld bei dir angekommen ist, schickt Paypal eine "automatische Zahlungsbestätigung" (Antwort, dass das Geld bei dir ist).
Die muss dein Server dann annehmen und kann das Guthaben in die Datenbank eintragen.

Von Paypal gibt's da auch eine schöne Grafik:

[Only registered and activated users can see links. Click Here To Register...]


Ansonsten müsstest du mal verlauten lassen, welchen Anbieter du hast, dann könnte man sich den mal anschauen und dir erklären, wie das da gelöst wird.
11/25/2014 08:11 0xDnFx3#3
Das Script würde ich nicht verwenden xD