View sourcecode

The following files exists in this folder. Click to view.

transfer.php

29 lines ASCII Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
    session_start
();
    include(
'check_login.php');
    include(
'functions.php');
    
$amount 0;

    if(
$_POST['amount']<=0){
        
header('location: home.php'); 
        exit();
    }

    if(isset(
$_POST['type'])){
        if(
$_POST['type'] == 'withdraw'){
            
$amount = -1*$_POST['amount'];
        }
        else{
            
$amount $_POST['amount'];
        }

        
add($_SESSION['user'] . $_SESSION['userid'], $_POST['account'], $_POST['type'], $amount);
    }
    else{
        
$amount $_POST['amount'];
        
add($_SESSION['user'] . $_SESSION['userid'], $_POST['account1'], 'transfer', -1*$amount);
        
add($_SESSION['user'] . $_SESSION['userid'], $_POST['account2'], 'transfer'$amount);
    }
    
header('location: home.php'); 
    exit();
?>