Systeme de Commentaire avec Ajax/Jquerry

Fermé
Degra - 28 janv. 2010 à 04:51
 Profil bloqué - 6 mai 2010 à 21:21
Bonjour a tous,

Je travaille sur le Systeme de Commentaire avec Ajax. Jquerry. Ce que j aimerais c'est que les Utilisateur commente sur une Video sans que la page se recharge. Du genre Youtube, Dailymotion et autres.
Voici le Script de Jooria que j'essaie d'integrer. Mais je ne sais pas cela ne marche pas. Pouvez vous me dire ou se trouve l'erreur? Merci d'avance

<?php

/**
* @author jooria <support@jooria.com>
* @link http://www.jooria.com/Tutorials/Website-Programming-16/Advanced-PHP-Comments-System-With-jQuery-155/index.html
* @filename index.php
* @copyright 2009
*/

//connect to the mysql
$db = @mysql_connect('myhost', 'myusername', 'Mypass') or die("Could not connect database");
@mysql_select_db('db', $db) or die("Could not select database");

//pages
switch ($_GET['case']){
case 'add':
if($_POST){

if(empty($_POST['name'])){
echo '<li class="error">you cant let the name empty</li>';
}elseif(empty($_POST['mail'])){
echo '<li class="error">you cant let the mail empty</li>';
}elseif(empty($_POST['comment'])){
echo '<li class="error">you cant let the comment empty</li>';
}else{

if(strlen($_POST['name']) < 4){
echo '<li class="error">your name must be more than 4 </li>';
}elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$_POST['mail'])){
echo '<li class="error">Invalid email</li>';
}else{

$_POST = array_map('addslashes', $_POST);

@mysql_query("insert into comment set
comment_name='".$_POST['name']."',comment_mail='".$_POST['mail']."',comment_txt='".$_POST['comment']."',
comment_date ='".time()."'");

echo '<li>';
echo '<p>'.$_POST['name'].' ['.$_POST['mail'].'] said:'.'<p>';
echo '<p class="comment">'.$_POST['comment'].'</p>';
echo '<p>in: '.date(DATE_RFC822,time()).'</p>';
echo '</li>';
}

}
}


break;

default :
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Jooria Refresh Your Website Comments System</title>
<!-- js,and jquery -->
<script type="text/javascript" src="Jooria/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="style/jooria-js.js"></script>
<!-- css skin -->
<link rel="stylesheet" type="text/css" href="style/jooria-css.css" />

<script>

$(function() {
$('.submit').jooria_comment('index.php?case=add');
});

</script>

</head>
<body>

<?php

$sql = @mysql_query("select * FROM `comment` order by comment_id asc");

if(@mysql_num_rows($sql) > 0){

echo "<ul id='list'>";
while($Row = mysql_fetch_array($sql)) {

echo '<li>';
echo '<p>'.$Row['comment_name'].' ['.$Row['comment_mail'].'] said:'.'<p>';
echo '<p class="comment">'.htmlentities($Row['comment_txt']).'</p>';
echo '<p>in: '.date(DATE_RFC822,$Row['comment_date']).'</p>';
echo '</li>';

}
echo "</ul>";

}else{

echo '<div id="nocom">';
echo '<p>there is no comments yet</p>';
echo '</div>';

}




?>




<div>

<p>
<label for="name">Your Name:</label>
<input id="name" value="" size="40">
</p>

<p>
<label for="mail">Your E-mail:</label>
<input id="mail" value="" size="40">
</p>

<p>
<label for="comment">Your Comment:</label>
<textarea id="comment" style="width: 100%" rows="4" cols="40" ></textarea>
</p>

<p><button class="submit">Posting Quick Reply</button></p>

</div>


</body>
</html>

<?php


}

?>

1 réponse

Profil bloqué
6 mai 2010 à 21:21
moi aussi j'ai nvu et je travaille pour faire comme toi c'est dif ^^
0