/**
 * Shell-escape a string. The argument must be one whole (and only one) arg
 * (this function adds quotes around it so that the shell sees it as such).
 *
 * @param $str
 * @return string
 */
function tfb_shellencode($str)
{
    $str = (string) $str;
    return strlen($str) > 0 ? mb_escapeshellarg($str) : "''";
}
Example #2
0
Route::get('signup', function () {
    if (Auth::guest()) {
        return View::make('auth.signup');
    } else {
        return Redirect::to('/');
    }
});
Route::post('signup', 'UserController@signup');
Route::get('logout', function () {
    Auth::logout();
    return Redirect::to('/');
});
Route::get('test', function () {
    $c = DB::table('media_files')->where('id', '<', 4000)->get();
    foreach ($c as $f) {
        $filepath = '/home/mfs/Downloads/transmission/completed/' . $f->media_id . '/' . mb_escapeshellarg($f->path);
        $fi_size = shell_exec("stat -c '%s' {$filepath} 2>&1");
        if ($f->size_or != (int) $fi_size) {
            echo $f->media_id . '-- ';
            echo $f->id . '----' . $f->size_or . '----' . (int) $fi_size;
            echo '<br>';
        }
        //$f->save();
    }
});
Route::get('test2', function () {
    $url = 'http://s01.okaydrive.com/rt/plugins/httprpc/action.php';
    $myvars = 'mode=list-get&hash=5720CE89CEB5206B8C741C6AF3552AD867F416AF';
    $ch = curl_init($url);
    $username = '******';
    $password = '******';