Esempio n. 1
0
     $getnick = sacar($_POST["status"], "_", "_");
     $nicktofollow = idfromnick($getnick);
     follow($nicktofollow, $_SESSION['user_id']);
     echo "</div>";
     //UNFOLLOW COMMAND
 } elseif (eregi("^UNFOLLOW _", $_POST['status']) == true) {
     echo "<div id=\"message\">";
     $getnick = sacar($_POST["status"], "_", "_");
     $nicktofollow = idfromnick($getnick);
     unfollow($nicktofollow, $_SESSION['user_id']);
     echo "</div>";
     //DELETE TODO LIST COMMAND
 } elseif (eregi("^DONE _", $_POST['status']) == true) {
     $n_td_l = md5($_SESSION['user_id'] . "_todo_list");
     $name = "./todo/" . $n_td_l . ".txt";
     $line = sacar($_POST["status"], "_", "_");
     $line = $line - 1;
     $file = file($name);
     $file[$line] = "";
     $file = implode("", $file);
     $o = fopen($name, "w+");
     fwrite($o, $file);
     fclose($o);
     echo "<div id=\"message\">" . $indexphp_todo3 . "<b>" . ($line + 1) . "</b>.</div>";
     //ENVÍA EL TWITT
 } else {
     $connuni = mysql_connect($host, $user, $pass) or die(mysql_error());
     mysql_select_db($db, $connuni) or die(mysql_error());
     $_POST['status'] = substr($_POST['status'], 0, $numero_caracteres);
     if ($twitpicurl) {
         $_POST['status'] = $twitpicurl . " - " . $_POST['status'];
Esempio n. 2
0
<?php

class CuentaDeAhorros
{
    public $saldo;
    function __construct($saldo)
    {
        $this->saldo = $saldo;
    }
}
function poner($cuenta, $cantidad)
{
    $cuenta->saldo += $cantidad;
}
function sacar($cuenta, $cantidad)
{
    $cuenta->saldo -= $cantidad;
}
$antonio = new CuentaDeAhorros(300);
poner($antonio, 100);
sacar($antonio, 450);
if ($antonio->saldo < 0) {
    echo 'Cuida tu platita Antonio...';
}
Esempio n. 3
0
function replace_images($string)
{
    $string = ereg_replace("twitpic.com/([[:alnum:]]*)", "twitpic.com/show/thumb/\\1.jpg", $string);
    //echo $string;
    $twp = sacar($string, "http://twitpic.com/show/thumb/", ".jpg");
    if ($twp != "") {
        echo "<a style='margin: 2px;' target='_blank' href='http://twitpic.com/" . $twp . "/full'><img width='120' height='80' src='http://twitpic.com/show/thumb/" . $twp . ".jpg'></a>";
    }
    $gif = sacar($string, "http://", ".gif");
    if ($gif != "") {
        echo "<a style='margin: 2px;' target='_blank' href='http://" . $gif . ".gif'><img width='120' height='80' src='http://" . $gif . ".gif'></a>";
    }
    $png = sacar($string, "http://", ".png");
    if ($png != "") {
        echo "<a style='margin: 2px;' target='_blank' href='http://" . $png . ".png'><img width='120' height='80' src='http://" . $png . ".png'></a>";
    }
    $jpg = sacar($string, "http://", ".jpg");
    if ($jpg != "" && strstr($jpg, "twitpic") == false) {
        echo "<a style='margin: 2px;' target='_blank' href='http://" . $jpg . ".jpg'><img width='120' height='80' src='http://" . $jpg . ".jpg'></a>";
    }
}