Suche SQL!

  • Hallo,

    Ich suche schon seit 2h dieses SQL datei oder ka,
    Einfach die sache "cms_news_vote" Like System..
    Hat das jemand? Wäre nett wenn ihr sie hier postet

    Wenn du willst, kriegst du meine.
    Ich packe dann articles.php und die SQLs in ein .rar Format.

    Download: News Like System - Upload by Colax33 @ iBaBBo.de.rar

    articles.php:

    Spoiler anzeigen


    <?php

    require_once('./data_classes/server-data.php_data_classes-core.php.php');
    require_once('./data_classes/server-data.php_data_classes-session.php.php');

    $body_id = "news";
    $pageid = "11";

    $news_id = FilterText($_GET['web-articles-id']);
    $main_sql = mysql_query("SELECT * FROM cms_news WHERE id = '".$news_id."'") or die(mysql_error());
    $article_exists = mysql_num_rows($main_sql);

    if($article_exists == "1"){
    $news = mysql_fetch_assoc($main_sql);
    $pagename = "News - ".HoloText($news['title'])."";
    } else {
    $main_sql = mysql_query("SELECT * FROM cms_news ORDER BY ID DESC") or die(mysql_error());
    $news = mysql_fetch_assoc($main_sql);
    $news_id = $news['id'];
    $pagename = "News - ".HoloText($news['title'])."";
    }
    if(isset($_GET['vote']) || FilterText($_GET['vote']) == "like" || FilterText($_GET['vote']) == "unlike"){
    $vote = FilterText($_GET['vote']);

    $usercheck = mysql_query("SELECT id_user FROM cms_news_vote WHERE id_user = '".$my_id."' AND id_news = '".$news_id."'") or die(mysql_error());
    if(mysql_num_rows($usercheck) < 1){

    if($vote == "like"){
    mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','1','0')") or die(mysql_error());
    } else {
    mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','0','1')") or die(mysql_error());
    }

    header("location: $path/articles/".$news_id."");
    } else {
    $msg = "<script>alert(\"Du hast bereits bei diesen News gevotet!\");</script>";
    }
    }

    require_once('./templates/community_subheader.php');
    require_once('./templates/community_header.php');

    ?>

    <style>
    body{
    font-family:corbel;
    }
    </style>


    <div id="container">
    <div id="content">
    <div id="column1" class="column">
    <div class="habblet-container ">
    <div class="cbb clearfix orange">
    <h2 class="title">News</h2>
    <div id="article-archive">

    <?php

    $sql = mysql_query("SELECT * FROM cms_news ORDER BY id DESC");
    if(mysql_num_rows($sql) > 0){

    ?>
    <h2>Letzten News</h2>
    <ul>


    <?php while($row = mysql_fetch_assoc($sql)){ ?>

    <li><?php if($news_id !== $row['id']){ echo"<a href=\"".$path."/articles/".$row['id']."\">"; } ?>
    <?php echo $row['title']; ?></a> &raquo;
    <?php if($news_id !== $row['id']){ echo"</a>"; } ?></li>

    <?php } ?>

    </ul>

    <?php } ?>

    <h2>Mehr News?</h2>
    <ul>
    <li>
    <a href="<?php echo $path; ?>/articles" class="article">Alle News anzeigen</a> &raquo;
    </li>
    </ul>
    </div>

    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
    </div>

    <div id="column2" class="column">
    <div class="habblet-container ">
    <div class="cbb clearfix notitle ">

    <div id="article-wrapper">
    <h2><?php echo HoloText($news['title']); ?></h2>
    <div class="article-meta">Geschrieben am <?php echo date('d.m.Y', $news['published']); ?></div>
    <p class="summary"><?php echo nl2br($news['longstory']); ?></p>
    <div class="article-body">
    <?php echo $news['shortstory']; ?>
    <div class="article-body"><img src="../web-gallery/album1/users_online.PNG"> <b><?php echo $news['author']; ?></b><br><br></div>
    <li><div style="float: right"><?php if(mysql_num_rows($usercheck = mysql_query("SELECT id_user FROM cms_news_vote WHERE id_user = '".$my_id."' AND id_news = '".$news_id."'")) < 1){ ?><a href="./articles/<?php echo $news_id; ?>&vote=like"><img src="./web-gallery/v2/images/news/like.png"></a> <a href="./articles/<?php echo $news_id; ?>&vote=unlike"><img src="./web-gallery/v2/images/news/unlike.png"></a><?php } ?></div>

    <?php
    $votecheck = mysql_query("SELECT * FROM cms_news_vote WHERE id_news = '".$news_id."'");
    $votecount = mysql_num_rows($votecheck);
    if($votecount < 1){
    $percentlike = "50";
    $percentunlike = "50";
    $like = "0";
    $unlike = "0";
    } else {
    $percentlike = 100 / $votecount * mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_like = '1'");
    $percentunlike = 100 / $votecount * mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_unlike = '1'");
    $like = mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_like = '1'");
    $unlike = mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_unlike = '1'");
    }
    ?>
    <div class="watch-sparkbars">
    <div class="watch-sparkbar-likes" style="width: <?php echo $percentlike ?>%"></div>
    <div class="watch-sparkbar-dislikes" style="width: <?php echo $percentunlike ?>%"></div>
    </div>
    <span class="watch-likes-dislikes">
    Gefällt <span class="likes"><?php echo $like; ?></span>, gefällt <span class="dislikes"><?php echo $unlike; ?></span> nicht
    </span>

    </li>
    </div></div></div></div>
    <?php if(!empty($facebook)){ ?>
    <br><br>
    <div id="column2" class="column">
    <div class="habblet-container ">
    <div class="cbb clearfix notitle ">

    <div id="article-wrapper">
    <h2>Kommentare</h2><div class="article-meta"></div>
    <div class="article-body"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="<?php echo $path; ?>/articles/<?php echo $news_id; ?>" num_posts="150" width="400"></fb:comments></p>
    <div class="article-body"><iframe src="http://www.facebook.com/plugins/likebo…book.com/pages/<?php echo $facebook; ?>&amp;width=292&amp;colorscheme=light&amp;connections=0&amp;stream=false&amp;header=false&amp;height=62" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:292px; height:62px;" allowTransparency="true"></iframe>
    </iframe>

    <script type="text/javascript" language="Javascript">
    document.observe("dom:loaded", function() {
    $$('.article-images a').each(function(a) {
    Event.observe(a, 'click', function(e) {
    Event.stop(e);
    Overlay.lightbox(a.href, "Image is loading");
    });
    });

    $$('a.article-127').each(function(a) {
    a.replace(a.innerHTML);
    });
    });
    </script>


    </div></div></div></div>

    </div>
    </div>

    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
    <?php } ?>

    <?php
    if(isset($_POST['post_comment'])):
    $error = array();

    $comentario = $_POST['comment'];

    if(empty($comentario))
    $error[] = "<font color='#ff0000'>Du hast keinen Text eingegeben!</font>";
    if(empty($error)):
    $sucess = "<font color='#009900'>Dein Kommentar wurde gespeichert!</font>";
    mysql_query("INSERT INTO `cms_comments`(`story`, `comment`, `date`, `author`) VALUES ('".$news_id."', '".$comentario."', '".time()."', '".$my_id."')");
    endif;
    foreach($error as $errors)
    $errorz = $errors;
    endif;

    ?>


    <?php
    $commentid = mysql_fetch_array(mysql_query("SELECT * FROM `cms_comments` ORDER BY id DESC LIMIT 1"));
    $mas = 1;
    $comid = $commentid['id']+$mas;
    ?>


    <div class="habblet-container ">

    <div class="cbb clearfix notitle ">

    <div id="article-wrapper"><h2>Kommentieren</h2>

    <div class="article-meta">
    <?php if(!empty($error)): echo '<b>'.$errorz.'</b>'; endif;
    if(!empty($sucess)): echo '<b>'.$sucess.'</b>'; endif; ?>

    <div class="article-body">

    <form action="/articles/<?php echo $news_id; ?>?articleid=<?php echo $news_id; ?>&commentid=<?php echo $comid; ?><?php echo $row12['id']; ?>&userid=<?php echo $my_id; ?>" method="post">

    <textarea name="comment" maxlength="500"></textarea><br /><br />

    <input type="submit" name="post_comment" value="Posten" />

    </form>

    </div>

    </div>

    </div>

    </div><style type="text/css">

    input[type="text"], input[type="password"] {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    width: 175px;

    padding: 5px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    input[type="submit"] {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    padding: 5px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    textarea {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    padding: 5px;

    width: 517px;

    height: 70px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    select {

    background-color: #F1F1F1;

    border: 1px solid #999999;

    padding: 5px;

    font-family: verdana;

    font-size: 10px;

    color: #666666;

    }

    </style>

    <?php
    $sql1 = mysql_query("SELECT * FROM cms_comments WHERE story = '".$news_id."'");
    $total = mysql_num_rows($sql1);
    ?>


    <div class="habblet-container ">

    <div class="cbb clearfix notitle ">

    <div id="article-wrapper"><h2>Kommentare (<?php echo $total; ?>)</h2>

    <div class="article-meta"></div>

    <div class="article-body">

    <?php
    $sql1 = mysql_query("SELECT * FROM cms_comments WHERE story = '".$news_id."' ORDER BY id DESC");
    if(mysql_num_rows($sql1) > 0){
    ?>

    <?php while($row1 = mysql_fetch_assoc($sql1)){

    $userdata = mysql_fetch_assoc($userdata = mysql_query("SELECT * FROM users WHERE id = '".$row1['author']."'"));
    ?>


    <table width="528px">

    <tr>

    <td width="90px" valign="top">

    <div style="float:left"><img src="http://www.habbo.de/habbo-imaging/avatarimage?figure=<?php echo $userdata['look']; ?>&size=b&direction=2&head_direction=3&gesture=sml&size=m"></div>


    </td>

    <td width="427px" valign="top">

    <strong>RE: <?php echo $news['title']; ?></strong><br /><br /><?php echo $row1['comment']; ?>

    </td>

    </tr>

    <tr>

    <td width="90px" valign="top">

    </td>

    <td width="427px" align="right">

    <i>Geschrieben von <strong><a href="/home/<?php echo $userdata['username']; ?>"><?php echo $userdata['username']; ?></a></strong> am <?php echo date('d.m.Y H:i:s', $row1['date']); ?></i><br /><br />

    </td>

    </tr>
    <?php } } ?>


    </table>

    </div>

    </div>

    </div>

    </div>
    </div>

    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>

    </div>
    <div id="column3" class="column">
    </div>

    <?php require_once('./templates/community_footer.php'); ?>

    cms_news_vote.sql:

    Spoiler anzeigen


    /*
    Navicat MySQL Data Transfer


    Source Server : home
    Source Server Version : 50528
    Source Host : localhost:3306
    Source Database : 123gangnamstyle


    Target Server Type : MYSQL
    Target Server Version : 50528
    File Encoding : 65001


    Date: 2012-12-03 18:46:56
    */


    SET FOREIGN_KEY_CHECKS=0;


    -- ----------------------------
    -- Table structure for `cms_news_vote`
    -- ----------------------------
    DROP TABLE IF EXISTS `cms_news_vote`;
    CREATE TABLE `cms_news_vote` (
    `id_user` int(11) NOT NULL,
    `id_news` int(11) NOT NULL,
    `vote_like` enum('0','1') NOT NULL DEFAULT '0',
    `vote_unlike` enum('0','1') NOT NULL DEFAULT '0'
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


    -- ----------------------------
    -- Records of cms_news_vote
    -- ----------------------------

    Einmal editiert, zuletzt von Alexiusx3 (3. Dezember 2012 um 18:50)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!