function transfer($toAccount, $fromAccount, $amount)
{
    if (!debit($amount, $fromAccount)) {
        return false;
    }
    credit($amount, $toAccount);
    return true;
}
/**
TODO validation of bike / stand for commands
*/
if (!validateNumber($sms->Number())) {
    sendSMS($sms->Number(), _('Your number is not registered.'));
} else {
    switch ($args[0]) {
        case "HELP":
            help($sms->Number());
            break;
        case "CREDIT":
            if (iscreditenabled() == FALSE) {
                unknownCommand($sms->Number(), $args[0]);
                break;
            }
            credit($sms->Number());
            break;
        case "FREE":
            freeBikes($sms->Number());
            break;
        case "RENT":
            validateReceivedSMS($sms->Number(), count($args), 2, _('with bike number:') . " RENT 47");
            rentbike($sms->Number(), $args[1]);
            //intval
            break;
        case "RETURN":
            validateReceivedSMS($sms->Number(), count($args), 3, _('with bike number and stand name:') . " RETURN 47 RACKO");
            /*
            if (!preg_match("/return[\s,\.]+[0-9]+[\s,\.]+[a-zA-Z0-9]+[\s,\.]+(.*)/i",$message ,$matches))
               {
               $userNote="";
Exemplo n.º 3
0
 echo "<tr" . ($counte % 2 != 1 ? " class=\"alt\"" : "") . ">";
 foreach ($configuration["columns_files"] as $keyz => $column) {
     echo "<td>";
     if (array_key_exists(strtoupper(mbFirstChar($songinfo["file"])), $letters_files) && $letters_files[strtoupper(mbFirstChar($songinfo["file"]))] != false) {
         echo "<a name=\"files_" . strtoupper(mbFirstChar($songinfo["file"])) . "\" style=\"display: inline\"></a>";
         $letters_files[strtoupper(mbFirstChar($songinfo["file"]))] = false;
     }
     switch ($column) {
         case "Function":
             make_link("", "status", $configuration["add"], array("command" => "add", "arg" => htmlentities(rawurlencode($songinfo["file"]))));
             break;
         case "Number":
             echo $counte;
             break;
         case "Title":
             if (credit() > 0) {
                 if (array_key_exists($column, $songinfo) && strlen($songinfo[$column])) {
                     if (!array_key_exists("directory", $configuration)) {
                         make_link("", "status", htmlspecialchars($songinfo["Artist"] . " - " . $songinfo[$column]), array("command" => "add", "arg" => htmlentities(rawurlencode($songinfo["file"]))));
                         //						make_link("", "files", htmlspecialchars($songinfo[$column]), array("search" => "1", "searchtext" => htmlentities(rawurlencode($songinfo[$column])), "searchwhat" => "title", "exact" => "true"));
                     } else {
                         make_link("", "status", htmlspecialchars($songinfo[$column]), array("command" => "add", "arg" => htmlentities(rawurlencode($songinfo["file"]))));
                     }
                 } else {
                     make_link("", "status", htmlspecialchars(preg_replace("/\\.[^.\\s]{3,4}\$/", "", $songinfo["file"])), array("command" => "add", "arg" => htmlentities(rawurlencode($songinfo["file"]))));
                 }
             } else {
                 if (array_key_exists($column, $songinfo)) {
                     if (!array_key_exists("directory", $configuration)) {
                         echo htmlspecialchars($songinfo["Artist"] . " - " . $songinfo[$column]);
                     } else {
Exemplo n.º 4
0
<div id="playlist">
<?php 
//$listall=do_mpd_command($connection,"listall"."",null,true);
//echo "<pre>";echo $listall["file"][array_rand($listall["file"])];echo "</pre>";
if ($mpd_status["state"] == "play" && array_key_exists("song", $mpd_status) && $mpd_status["song"] == 1) {
    //playing second song, so first can be removed
    do_mpd_command($connection, "delete " . "0", null, true);
    $mpd_status["playlistlength"]--;
}
if (!array_key_exists("nextsong", $mpd_status) && credit() == 0) {
    //no mo payed song, do funky random add
    $listall = do_mpd_command($connection, "listall" . "", null, true);
    do_mpd_command($connection, "add \"" . $listall["file"][array_rand($listall["file"])] . "\"", null, true);
}
echo "<span class=\"current_playlist_h\"><a name=\"playlist\"></a>Current Playlist</span>\n";
/*echo "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\"";

if (array_key_exists("playlists", $layout_vars["default_targets"])) {
	if ($layout_vars["frames"] == true) echo " target=\"".$layout_vars["default_targets"]["playlists"]["frame"]."\"";
	echo ">\n<input type=\"hidden\" name=\"content\" value=\"".$layout_vars["default_targets"]["playlists"]["content"]."\" />\n<table cellspacing=\"0\">\n";
} else {
	echo "><table cellspacing=\"0\">\n";
}

echo "<tr>\n<td class=\"nobg\">";
make_link("", "playlist", "Shuffle", array("command" => "shuffle"));
echo "</td>\n";
echo "<td class=\"nobg\"><input type=\"text\" name=\"arg\" style=\"width: 100%\" class=\"textbox\" /></td>\n";
echo "<td class=\"nobg\"><input type=\"submit\" name=\"command\" value=\"save\" class=\"button\" /></td>\n";
echo "<td class=\"nobg\">";
make_link("", "playlist", "Clear", array("command" => "clear"));
<?php

require 'account.php';
session_start();
$amountCred = $_REQUEST['amount'];
$accNum = $_SESSION['creditNum'];
credit($amountCred, $accNum);
header('Location:admin.php');
Exemplo n.º 6
0
<center>
<br>
<input type=text name='lagu'
value='<?php 
if (isset($_POST['lagu'])) {
    echo strip_tags($_POST['lagu']);
}
?>
'> <input
type=submit value='search'>
</form>
</center>
<?php 
// If user make lyrics request, this section will start
if (isset($_POST['lagu']) && !empty($_POST['lagu'])) {
    if (!strpos($_POST['plugins'], ".")) {
        echo "<center>Error!</center>";
        die;
    }
    // Verified data so user can't include file from another source
    $plugins = "plugins/" . str_replace('.', '_', $_POST['plugins']) . ".php";
    // Rename data that been send by POST request
    include $plugins;
    // Include plugins
    $class = new lyrics();
    $class->search_result(strip_tags($_POST['lagu']), $plugins);
} else {
    echo "<center><font color='red'>Please Insert Song Name</font></center>";
}
credit();
Exemplo n.º 7
0
<div id="status">
<?php 
$credit = credit();
echo "<center>\n<span class=\"credit\">Credit: " . $credit . "</span><br />\n<span class=\"playing_h\"><a name=\"status\"></a>";
switch ($mpd_status["state"]) {
    case "play":
        echo "Playing:";
        break;
    case "pause":
        do_mpd_command($connection, "play", null, true);
        echo "Playing:";
        break;
    case "stop":
        do_mpd_command($connection, "play", null, true);
        echo "Playing:";
        break;
}
//echo " <small>[";
//make_link("index.php", "status", "refresh");
//echo "]</small></h2>";
echo "</span><br /><span class=\"playing\">";
if (array_key_exists("command", $_REQUEST) && $_REQUEST["command"]) {
    if ($command_successful !== true && $configuration["error_msg"]) {
        echo "Error on command " . $_REQUEST["command"] . " with arguments: " . $_REQUEST["arg"] . "<br />\n";
    }
}
switch ($mpd_status["state"]) {
    case "play":
    case "pause":
        $songinfo = do_mpd_command($connection, "playlistid " . $mpd_status["songid"], null, true);
        if ($configuration["filenames_only"] == true) {
Exemplo n.º 8
0
<?php

require 'functions.php';
$term = $_POST['term'];
$rate = $_POST['rate'];
$amount = $_POST['amount'];
$startmonth = $_POST['startmonth'];
$startyear = $_POST['startyear'];
$credit = credit($term, $rate, $amount, $startmonth, $startyear);
echo json_encode($credit);
Exemplo n.º 9
0
         $buffer = fgets($handle, 4096);
         $files[] = $buffer;
     }
     fclose($handle);
     if (do_mpd_command_list($connection, $command, $files) === true) {
         $command_successful = true;
     } else {
         $command_successful = false;
     }
     break;
 case "add":
     $command = $_REQUEST["command"];
     if (array_key_exists("arg", $_REQUEST) && strlen($_REQUEST["arg"]) > 0) {
         $command .= " \"" . $_REQUEST["arg"] . "\"";
     }
     if (credit() > 0 && credit("-1") === true && do_mpd_command($connection, $command) === true) {
         $command_successful = true;
     } else {
         $command_successful = false;
     }
     break;
 default:
     $command = $_REQUEST["command"];
     if (array_key_exists("arg", $_REQUEST) && strlen($_REQUEST["arg"]) > 0) {
         $command .= " \"" . $_REQUEST["arg"] . "\"";
     }
     if (do_mpd_command($connection, $command) === true) {
         $command_successful = true;
     } else {
         $command_successful = false;
     }