• 18-10-2012, 13:36:08
    #1
    Arkadaşlar Kolay Gelsin;

    Elimdeki scripti sanırım biraz karıştırdım daha önceden silebildiğim içeriği artık silemiyorum derede yanlış yapmış olabilirim,

    [COLOR="rgb(139, 0, 0)"]Kullanılan fonksiyon;--------------------------------[/COLOR]

    public function deleteKampanya()
    {
    $delid = $_GET['del'];
    if(is_numeric($delid))
    {
    $delid = intval($delid);
    $check = mysql_query("select `id`,`title`, `resim` from kampanyalar where `id` = $delid");
    if(mysql_num_rows($check)>=1)
    {
    $fetch = mysql_fetch_array($check);
    $ustid = $fetch['id'];
    $usttt = $fetch['title'];
    $resim = $fetch['resim'];
    chmod("../".$resim, 0777);
    unlink("../".$resim);

    $this->delSubKampanya($ustid);

    echo "<p class='info'>$usttt adlý kampanya ve içerdiði tüm kampanyalar ve alt kampanyalarý baþarýyla silindi!</p>";
    }
    }
    }
    ----------------------------------------------------------

    fonksiyonun kullanıldığı sayfa içeriği;------------------------------

    <?php if(!$core->requirer) { die(""); } if(!$core->admin()) { die(); } if(!$core->MO_Kampanya) { die(); } ?>
    <img id="top2" src="images/top2.png" alt="" />
    <div id="page">
    <?php require('template/nav.php'); ?>
    <div class="content">
    <div class="baslik">
    <h2>Kampanyalar</h2>
    <p style="padding-left: 2px;">Yeni kampanya ekleyip alt kampanyalarýný ekleyebilir veya düzenleyebilirsiniz.</p>
    </div>
    <?php
    if(isset($_GET['del'])) { $core->deleteKampanya(); }
    if(isset($_POST['catchNewKampanya'])) { $core->insertKampanya(); }
    if(isset($_POST['catchConKampanya'])) { $core->updateKampanya(); }

    $correctConf = false;
    if(isset($_GET['con'])&&!$core->updateComplete)
    {
    if(is_numeric($_GET['con']))
    {
    $con = intval($_GET['con']);
    $getinfo = mysql_query("select * from kampanyalar where `id` = $con");
    if(mysql_num_rows($getinfo)>=1)
    {
    $fetch = mysql_fetch_array($getinfo);
    $confid = $fetch['id'];
    $conftt = stripslashes($fetch['title']);
    $confui = $fetch['ust_id'];
    $confoz = stripslashes($fetch['ozet']);
    $conftx = stripslashes($fetch['text']);
    $confrs = "../".$fetch['resim'];

    $correctConf = true;
    }
    }

    if($correctConf) {
    ?>
    <form class="appnitro" enctype="multipart/form-data" target="_self" method="post" style="border:1px solid #e2e2e2; background:#ededed; margin:0px; padding:12px;">
    <div class="form_description" style="border: none;">
    <h3 style="margin: 0px; padding:0px;"><?php echo $conftt; ?> Düzenleniyor</h3>
    </div>

    <table cellspacing="0" cellpadding="0" border="0" align="center" width="100%">
    <tr>
    <td style="width: 216px;" align="left" valign="top">
    <img src="<?php echo $confrs; ?>" style="width: 200px; height:200px;" />
    </td>
    <td align="left" valign="top">
    <ul>
    <li id="li_1">
    <label class="description" for="element_1">Kampanya Adý</label>
    <input type="hidden" name="confid" value="<?php echo $confid; ?>" />
    <input type="hidden" name="confrs" value="<?php echo $confrs; ?>" />
    <div><input id="kampanya" name="kampanya" class="element text medium" style="width: 440px;" type="text" maxlength="255" value="<?php echo $conftt; ?>" /></div>
    </li>
    <li id="li_2">
    <label class="description" for="element_1">Üst Kampanya Seçin</label>
    <div>
    <select name="kampanyaust" class="element text medium" style="width: 458px; padding:2px;">
    <option value="0">!üst kampanya yok</option>
    <?php
    $getsays = mysql_query("select `id`,`title` from kampanyalar order by `title` ASC");
    while($row = mysql_fetch_assoc($getsays))
    {
    $idz = $row['id'];
    $ttz = stripslashes($row['title']);
    $sel = "";
    if($idz==$confui) { $sel = " selected='selected'"; }

    if($idz!=$confid) {
    echo "<option value='$idz'$sel>$ttz</option>\n";
    }
    }
    ?>
    </select>
    </div>
    </li>
    <li id="li_3">
    <label class="description" for="element_2"><span style="color: #ff0000; padding:0px; margin:0px;"><span style="color: #191919; padding:0px; margin:0px;">Kampanya Resmi: (</span>Resmi deðiþtirmek istemiyorsanýz boþ býrakýn</span>)</label>
    <div><input name="kampanyaresim" type="file" class="element text medium" style="width: 420px;" /></div>
    </li>
    </ul>
    </td>
    </tr>
    </table>
    <ul>
    <li id="li_4">
    <label class="description" for="element_1">Kampanya Özeti</label>
    <textarea id="ozet" name="ozet" rows="5" cols="54"><?php echo $confoz; ?></textarea>
    </li>
    <li id="li_5">
    <textarea id="kampanyatext" name="kampanyatext"><?php echo $conftx; ?></textarea>
    <script type="text/javascript">
    CKEDITOR.replace('kampanyatext',
    {
    width : 860+'px',
    height : 280+'px',
    uiColor : '#9AB8F3',
    filebrowserBrowseUrl : '<?php echo $core->panelURL; ?>elfinder.php'
    });
    </script>
    </li>
    <li class="buttons">
    <input class="sbMbutton" type="submit" name="catchConKampanya" value="Kaydet" style="margin: 0px;" />
    </li>
    </ul>
    </form>
    <?php
    } else { echo "<p class='errP'>Düzenlemek istediðiniz kategori bulunamadý!</p>"; }
    } else {
    ?>
    <form class="appnitro" enctype="multipart/form-data" target="_self" method="post" style="border:1px solid #e2e2e2; background:#ededed; margin:0px; padding:12px;">
    <div class="form_description" style="border: none;">
    <h3 style="margin: 0px; padding:0px;">Yeni Kampanya Ekle</h3>
    </div>

    <ul>
    <li id="li_1">
    <label class="description" for="element_1">Kampanya Adý</label>
    <div><input id="kampanya" name="kampanya" class="element text medium" style="width: 440px;" type="text" maxlength="255" value="<?php if(isset($_POST['kampanya'])&&!$core->addComplete&&!$core->updateComplete) { echo $core->encore(stripslashes($_POST['kampanya'])); } ?>" /></div>
    </li>
    <li id="li_2">
    <label class="description" for="element_1">Üst Kampanya Seçin</label>
    <div>
    <select name="kampanyaust" class="element text medium" style="width: 458px; padding:2px;">
    <option value="0">!üst kampanya yok</option>
    <?php
    $getsays = mysql_query("select `id`,`title` from kampanyalar order by `title` ASC");
    while($row = mysql_fetch_assoc($getsays))
    {
    $idz = $row['id'];
    $ttz = stripslashes($row['title']);

    echo "<option value='$idz'>$ttz</option>\n";
    }
    ?>
    </select>
    </div>
    </li>
    <li id="li_3" >
    <label class="description" for="element_1">Kampanya Resmi</label>
    <div><input name="kampanyaresim" type="file" class="element text medium" style="width:440px;" /></div>
    </li>
    <li id="li_4">
    <label class="description" for="element_1">Kampanya Özeti</label>
    <textarea id="ozet" name="ozet" rows="5" cols="54"><?php if(isset($_POST['ozet'])&&!$core->addComplete&&!$core->updateComplete) { echo $_POST['ozet']; } ?></textarea>
    </li>
    <li id="li_5">
    <textarea id="kampanyatext" name="kampanyatext"><?php if(isset($_POST['kampanyatext'])&&!$core->addComplete&&!$core->updateComplete) { echo $_POST['kampanyatext']; } ?></textarea>
    <script type="text/javascript">
    CKEDITOR.replace('kampanyatext',
    {
    width : 860+'px',
    height : 280+'px',
    uiColor : '#9AB8F3',
    filebrowserBrowseUrl : '<?php echo $core->panelURL; ?>elfinder.php'
    });
    </script>
    </li>
    <li class="buttons">
    <input class="sbMbutton" type="submit" name="catchNewKampanya" value="Kaydet" style="margin: 0px;" />
    </li>
    </ul>
    </form>
    <?php } ?>

    <div class="content">
    <div class="baslik">
    <h3 style="padding: 0px; margin:0px;">Kayýtlý Kampanyalar</h3>
    </div>

    <table cellspacing="0" cellpadding="0" border="0" align="center" width="860px">
    <?php
    $color = "fdffc9";

    $liste = mysql_query("SELECT * FROM kampanyalar where ust_id = 0 order by `title` ASC");
    while($yaz = mysql_fetch_assoc($liste))
    {
    $id = $yaz["id"];
    $ui = $yaz['ust_id'];
    $title = stripslashes($yaz["title"]);

    $d_href = $core->panelURL."index.php?page=kampanya&con=".$id;
    $s_href = $core->panelURL."index.php?page=kampanya&del=".$id;

    echo "<tr class='$color' onmouseover='trhover(this)' onmouseout='trblur(this, ".'"'.$color.'"'.")'>";
    echo "<td style='width:16px; padding:4px;' align='left'><img src='images/dot.gif' /></td>";
    echo "<td align='left' style='padding:4px;'>$title</td>";
    echo "<td align='right' style='width:120px; padding:4px;'><a class='dza' href='$d_href'>Düzenle</a></td>";
    echo "<td align='right' style='width:60px; padding:4px;'><a class='sla' href='javascript:del(".'"\r\n'.strtoupper($title). ' !!!VE TÜM ALT KAMPANYALARI!!!"'.", ".'"'.$s_href.'"'.")'>Sil</a></td>";
    echo "</tr>";

    $derinlik = 4;
    altkampanyaBul($id, $derinlik);

    if($color=="fdffc9") { $color = "ffffff"; } else { $color = "fdffc9"; }
    }

    function altkampanyaBul($id, &$derinlik)
    {
    $altkampanyalar = mysql_query("select * from kampanyalar where ust_id = ".intval($id));
    if(mysql_num_rows($altkampanyalar)>=1)
    {
    while($r = mysql_fetch_assoc($altkampanyalar))
    {
    $id = $r['id'];
    $ui = $r['ust_id'];
    $tt = $r['title'];

    $d_href = $core->panelURL."index.php?page=kampanya&con=".$id;
    $s_href = $core->panelURL."index.php?page=kampanya&del=".$id;

    echo "<tr style='background:#f2f2f2;'>";
    echo "<td style='width:16px; padding:4px; border-bottom:1px dashed #cccccc;' align='left'>&nbsp;</td>";
    echo "<td align='left' style='padding:4px; border-bottom:1px dashed #cccccc; padding-left:0px; padding-left: $derinlik".'px'.";'><img src='images/up.png' /> $tt</td>";
    echo "<td align='right' style='width:120px; border-bottom:1px dashed #cccccc; padding:4px;'><a class='dza' href='$d_href'>Düzenle</a></td>";
    echo "<td align='right' style='width:60px; border-bottom:1px dashed #cccccc; padding:4px;'><a class='sla' href='javascript:del(".'"KAMPANYAYA BAÐLI OLAN TÜM ALT KAMPANYALAR SÝLÝNECEK!\r\n'.$tt.'"'.", ".'"'.$s_href.'"'.")'>Sil</a></td>";
    echo "</tr>";

    $kontrol = mysql_query("select id from kampanyalar where ust_id = ".$id);
    if(mysql_num_rows($kontrol)>=1) {
    $derinlik = $derinlik+19;
    altkampanyaBul($id, $derinlik);
    } else { $derinlik = 4; }
    }
    }
    }

    if(mysql_num_rows($liste)<=0)
    {
    echo "<tr><td>Hiç kayýtlý kampanya bulunmuyor!</td></tr>";
    }
    ?>
    </table>
    </div>
    </div>
    <?php require('template/footer.php'); ?>
    </div>
    <img id="bottom2" src="images/bottom2.png" alt="" />
    ----------------------------------------------------------------------
  • 18-10-2012, 15:48:41
    #2
    Arkadaşlar Yokmu yardım edebilecek olan bir arkadaş