Your IP : 216.73.216.39


Current Path : /home/wirbesti/public_html/php/
Upload File :
Current File : /home/wirbesti/public_html/php/copytest.php

<?php

ini_set ("display_errors", "1");
error_reporting(E_ALL);
$copy1 = copy('/home/wirbesti/unwaehlbar.ch/images/2762.jpg', '/home/wirbesti/public_html/images/Committee/2762.jpg');
echo $copy1 ? '2762 success' : '2762 failed';
echo '<br/>';
$copy1 = copy('/home/wirbesti/unwaehlbar.ch/images/3080.jpg', '/home/wirbesti/public_html/images/Committee/3080.jpg');
echo $copy1 ? '3080 success' : '3080 failed';
echo '<br/>';
$copy1 = copy('/home/wirbesti/unwaehlbar.ch/images/2776.jpg', '/home/wirbesti/public_html/images/Committee/2776.jpg');
echo $copy1 ? '2776 success' : '2776 failed';
echo '<br/>';
$copy1 = copy('/home/wirbesti/unwaehlbar.ch/images/3000.jpg', '/home/wirbesti/public_html/images/Committee/3000.jpg');
echo $copy1 ? '3000 success' : '3000 failed';
echo '<br/>';
$copy1 = copy('/home/wirbesti/unwaehlbar.ch/images/2766.jpg', '/home/wirbesti/public_html/images/Committee/2766.jpg');
echo $copy1 ? '2766 success' : '2766 failed';
echo '<br/>';

require_once 'DBConnection.php';
require_once 'setting.config.php';

$db = new DBConnection($config);

function copyWithpixfromdb($pixnum, DBConnection $dbc)
{
    $images = '/home/wirbesti/unwaehlbar.ch/images/';
    $target = '/home/wirbesti/public_html/images/Committee/';
    $query = "SELECT p.picture from `wirbesti_unwaehlbar`.`politician` p WHERE picture = :picture";
    $getpic = $dbc->dbc->prepare($query);
    $filename = $pixnum.'.jpg';
    $getpic->bindValue('picture', $filename);
    $getpic->execute();
    $pixresult = $getpic->fetchColumn();
    echo 'pixresult = '.$pixresult.'<br/>';
    $sourcefile = trim($images.$pixresult);
    $targetfile = trim($target.$pixresult);
    $copyresult = copy($sourcefile, $targetfile);
    echo "copy $pixnum ".($copyresult ? "success" : "failed").'<br/>';
    if (!$copyresult) {
        echo "copy($sourcefile, $targetfile)<br/>";
    }
}

copyWithpixfromdb(2762,$db);
copyWithpixfromdb(3080,$db);
copyWithpixfromdb(2776,$db);
copyWithpixfromdb(3000,$db);
copyWithpixfromdb(2766,$db);

?>