Example #1
0
function tablolistele8($conn, $tablo, $baslik, $alan, $filtre, $sirala, $linkyazi, $linkdosya, $linkalan, $baslangic, $satirsayisi)
{
    // diger tablolistelelerden farki, connection bazli calismasi, yani parametre olarak conn alir, onu kullanir.
    //GLOBAL $confdir;
    //include($confdir."dbconf.php");
    $color1 = "#FFE8B2";
    $color2 = "#E2E2E2";
    $result2 = "";
    $alansayisi = count($alan);
    $alansayisi2 = count($linkyazi);
    $satirno = 0;
    $query = "select * from {$tablo}";
    if ($filtre != "") {
        $query .= " where {$filtre}";
    }
    if ($sirala != "") {
        $query .= " order by {$sirala}";
    }
    if ($satirsayisi > 0) {
        $query = buildquery($query, $baslangic, $satirsayisi);
    }
    //echo "query: $query <br>";
    $result = db_query($conn, $query);
    if ($result) {
        $result2 .= "\n<table border=0>\n<tr border=1>";
        // once basliklari yaz.
        if (count($baslik) > 0) {
            for ($i = 0; $i < $alansayisi; $i++) {
                if ($baslik[$i] != "") {
                    $yaz = $baslik[$i];
                } else {
                    $yaz = $alan[$i];
                }
                $result2 .= "<td>{$yaz}</td>";
            }
        } else {
            for ($i = 0; $i < $alansayisi; $i++) {
                $yaz = $alan[$i];
                $result2 .= "<td>{$yaz}</td>";
            }
        }
        //        for ($i=0;$i<$alansayisi2;$i++)$result2.="<td>$linkyazi[$i]</td>";
        $result2 .= "</tr>\n ";
        while ($r = db_fetch_array($result)) {
            $satirrengi = iseven($satirno++) ? $color1 : $color2;
            $result2 .= "<tr bgcolor='{$satirrengi}'>";
            for ($i = 0; $i < $alansayisi; $i++) {
                $al = $alan[$i];
                $yaz = $r[$al];
                if ($yaz == "") {
                    $result2 .= "<td>&nbsp</td>";
                } else {
                    if (is_numeric($yaz)) {
                        $yaz = "<p align=right>" . number_format($yaz, 2) . "</p>";
                    }
                    $result2 .= "<td>{$yaz}</td>";
                }
                //if($al==$linkalan){$link=$r[$al];};
            }
            $link = $r[$linkalan];
            for ($i = 0; $i < $alansayisi2; $i++) {
                $ly = $linkyazi[$i];
                $ld = $linkdosya[$i];
                $char = "?";
                if (strpos($ld, "?")) {
                    $char = "";
                }
                if ($ly != "") {
                    $result2 .= "<td><a href='{$ld}{$char}{$linkalan}={$link}' target='_blank'><img src='{$ly}' border='0'></a></td>";
                }
            }
            $result2 .= "</tr>\n";
        }
        //$query="select count(*) as count from $tablo";
        //if($filtre<>""){$query.=" where $filtre";};
        //$res=dbresult($query,array("count"));
        $kayitsayisi = kayitsayisi($tablo, $filtre);
        //$res[0];
        //$result2.= "<tr><td>Kayt Says: $res[0] </td></tr>";
        $result2 .= "</table>";
        $ilerimiktar = $baslangic + $satirsayisi;
        if ($satirsayisi > 0) {
            $sondanoncesi = $kayitsayisi - $satirsayisi;
            $querystring = $_SERVER['QUERY_STRING'];
            $querystring = str_replace("baslangic={$baslangic}&satirsayisi={$satirsayisi}", "", $querystring);
            // asagidaki tabloya bu baslangic tekrar gitmesin diye. asagida zaten ekleniyor.
            if ($querystring != "") {
                $querystring .= "&";
            }
            // bialtsatrda ?den sonra yazmak in. ileri geride kullanlyor.
            if ($ilerimiktar < $kayitsayisi) {
                $ileri = "<a href=" . $_SERVER['PHP_SELF'] . "?" . $querystring . "baslangic={$ilerimiktar}&satirsayisi={$satirsayisi}>&gt</a>";
                $son = "<a href=" . $_SERVER['PHP_SELF'] . "?" . $querystring . "baslangic={$sondanoncesi}&satirsayisi={$satirsayisi}>&gt&gt</a>";
            } else {
                $ileri = "&gt";
                $son = "&gt&gt";
            }
            if ($baslangic > 0) {
                $geri = "<a href=" . $_SERVER['PHP_SELF'] . "?" . $querystring . "baslangic=" . ($baslangic - $satirsayisi) . "&satirsayisi={$satirsayisi}>&lt</a>";
                $bas = "<a href=" . $_SERVER['PHP_SELF'] . "?" . $querystring . "baslangic=0&satirsayisi={$satirsayisi}>&lt&lt</a>";
            } else {
                $geri = "&lt";
                $bas = "&lt&lt";
            }
            if ($kayitsayisi > $satirsayisi) {
                $result2 .= "{$baslangic} .. " . ($baslangic + $satirsayisi) . "  {$bas} &nbsp  {$geri} {$ileri} &nbsp {$son} ";
            }
        }
        $result2 .= "<br>Kayt Says: {$res['0']} <br>";
        //mysql_free_result($result);
    } else {
        echo "Bir hata olustu:<br>sql:{$query}<br>";
        echo mysql_error();
    }
    return $result2;
}
                    if (isset($items[$item_id]['file_path']) && file_exists($items[$item_id]['file_path'])) {
                        //expire every 30 minutes
                        $time = floor(time() / 86400 * (2 * 24));
                        $download_url = buildquery($redirect_uri, array('item_id' => $item_id, 'download' => md5(SEED . $item_id . $time)));
                    }
                    $url = buildquery($_SESSION['returnto'], array('mymail_download_url' => urlencode($download_url), 'mymail_slug' => $slug, 'mymail_nonce' => $_SESSION['auth']));
                }
            }
        }
    }
    header('Location: ' . $url);
    exit;
    //return from the Envato authorization page
} elseif (isset($_GET['error'])) {
    @session_start();
    $url = buildquery($_SESSION['returnto'], array('mymail_error' => urlencode($_GET['error_description']), 'mymail_nonce' => $_SESSION['auth']));
    header('Location: ' . $url);
    exit;
    //custom file path in use
} elseif (isset($_GET['download'])) {
    $time = floor(time() / 86400 * (2 * 24));
    $item_id = (int) $_GET['item_id'];
    $hash = md5(SEED . $item_id . $time);
    if ($_GET['download'] == $hash) {
        $path = $items[$item_id]['file_path'];
        header('Content-Description: File Transfer');
        header('Content-Type: application/zip');
        header('Content-Length: ' . (string) filesize($path));
        header('Content-Disposition: attachment; filename=' . $hash . '.zip');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');