Author Topic: Member area  (Read 7481 times)

0 Members and 1 Guest are viewing this topic.

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #30 on: December 07, 2009, 01:42:12 AM »
I use the member area in my game portal, so, sometimes I forget to change "games" to "video".

For the comment, If you return to the videos, do you see your last comment posted

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #31 on: December 07, 2009, 03:00:28 AM »
I use the member area in my game portal, so, sometimes I forget to change "games" to "video".

For the comment, If you return to the videos, do you see your last comment posted

no but can I see the comment in the admin part. also can you post your LAN stuff
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #32 on: December 07, 2009, 09:03:35 AM »
I send The 3 files in attachment

The link in admib_header.tpl to mange links :
Code: [Select]
<li {if $pagetype eq "comment"}class='selected'{/if}><a href="comment.php?pt=comment&amp;pag=options">Commentaires</a></li>

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #33 on: December 07, 2009, 02:06:36 PM »
I send The 3 files in attachment

The link in admib_header.tpl to mange links :
Code: [Select]
<li {if $pagetype eq "comment"}class='selected'{/if}><a href="comment.php?pt=comment&amp;pag=options">Commentaires</a></li>


thanks I will give them a try, and let you know
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #34 on: December 07, 2009, 02:31:53 PM »
Is your sql query to insert comment like this :
Code: [Select]
$ip=$_SERVER['REMOTE_ADDR'];
$requete = "SELECT COUNT(ip) as ip FROM pp_comment WHERE ip='$ip' and file_id='$_GET[id]'";
$reponse = mysql_query ($requete);
$reponse= mysql_fetch_array($reponse);
if ($reponse['ip']==0) {

if(isset($_POST['go']) && !empty($_POST['comment']) && !empty($_POST['nom']))
{
mysql_query("INSERT INTO pp_comment (file_id, nom, comment,ip) VALUES ('$_POST[id]', '$_POST[nom]','".addslashes($_POST['comment'])."','$ip')");

$smarty->assign('message', 'Thanks Guy, Your comment has been added');
}
}
else
{
$smarty->assign('message', 'Sorry, You have already comment this game');
}

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #35 on: December 07, 2009, 02:43:48 PM »
Is your sql query to insert comment like this :
Code: [Select]
$ip=$_SERVER['REMOTE_ADDR'];
$requete = "SELECT COUNT(ip) as ip FROM pp_comment WHERE ip='$ip' and file_id='$_GET[id]'";
$reponse = mysql_query ($requete);
$reponse= mysql_fetch_array($reponse);
if ($reponse['ip']==0) {

if(isset($_POST['go']) && !empty($_POST['comment']) && !empty($_POST['nom']))
{
mysql_query("INSERT INTO pp_comment (file_id, nom, comment,ip) VALUES ('$_POST[id]', '$_POST[nom]','".addslashes($_POST['comment'])."','$ip')");

$smarty->assign('message', 'Thanks Guy, Your comment has been added');
}
}
else
{
$smarty->assign('message', 'Sorry, You have already comment this game');
}


is this in the videos.php


i have
Code: [Select]

require('header.php');
$ip=$_SERVER['REMOTE_ADDR'];
$requete = "SELECT COUNT(ip) as ip FROM pp_comment WHERE ip='$ip'";
$reponse = mysql_query ($requete) or die (mysql_error);
$reponse= mysql_fetch_array($reponse);
if ($reponse['ip']==0) {

if(isset($_POST['go']) && !empty($_POST['comment']) && !empty($_POST['nom']))
{
mysql_query("INSERT INTO pp_comment (file_id, nom, comment,ip) VALUES ('$_POST[id]', '$_POST[nom]','".addslashes($_POST['comment'])."','$ip')");

$smarty->assign('message', 'Your comment has been added. Thanks');
}
}
else
{
$smarty->assign('message', 'Sorry, you have already comment this video');
}
$query_com = "SELECT * FROM pp_comment WHERE file_id='$_GET[id]' ORDER BY id DESC";
$result_com = mysql_query($query_com);
while ($row_com = mysql_fetch_assoc($result_com)){
 $videos_com[] = $row_com;
 $q_av = "SELECT * FROM pp_user WHERE user='$row_co[nom]'";
$result_av = mysql_query($q_av);
$row_av = mysql_fetch_assoc($result_av);
}
$smarty->assign('videos_com', $videos_com);
$smarty->assign('avatar', $row_av['avatar']);




and in the comment.tpl
I have

Code: [Select]

<div id="comment">
<h1>{$LAN_70}</h1>
{if isset($smarty.cookies.id)}
{$message}
<form method="post" action="videos.php?id={$video[video].id}">
<input type="hidden" name="id" value="{$video[video].id}">
 <b>{$LAN_71}</b><br /><input type="text" name="nom" value="{$user}"><br />
<b>{$LAN_72}</b><br /><textarea name="comment" row="10" cols="60"></textarea><br />
<input type="submit" name="go" value="{$LAN_73}">
</form>
<br />
{else}
{$LAN_94}
{/if}
<table width="100%">
{section name=videos_co loop=$videos_co}
     <tr>
     <td width="60" align="left">
<img src="avatar/{$avatar}" width="50" height="50" align="left">
</td>
<td width="400" valign="top">{$LAN_16} <b>{$videos[videos_co].nom}</b><br />
  {$videos_co[videos_co].comment}</td><tr>
<br />
{/section}
</table>
</div>
« Last Edit: December 07, 2009, 02:47:48 PM by winracer »
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #36 on: December 07, 2009, 03:23:45 PM »
sorry I had

{section name=videos_co loop=$videos_co}


and not

{section name=videos_com loop=$videos_com}



i can see the comments now but the avator is not showing up.

here is the code now

Code: [Select]

<div id="comment">
<h1>{$LAN_70}</h1>
{if isset($smarty.cookies.id)}
{$message}
<form method="post" action="videos.php?id={$video[video].id}">
<input type="hidden" name="id" value="{$video[video].id}">
 <b>{$LAN_71}</b><br /><input type="text" name="nom" value="{$user}"><br />
<b>{$LAN_72}</b><br /><textarea name="comment" row="10" cols="60"></textarea><br />
<input type="submit" name="go" value="{$LAN_73}">
</form>
<br />
{else}
{$LAN_94}
{/if}
<table width="100%">
{section name=videos_com loop=$videos_com}
     <tr>
     <td width="60" align="left">
<img src="avatar/{$avatar}" width="50" height="50" align="left">
</td>
<td width="400" valign="top">{$LAN_160} <b>{$videos[videos_com].nom}</b><br />
  {$videos_com[videos_com].comment}</td><tr>
<br />
{/section}
</table>
</div>






i think it is losing the $avatar varable because when I click on the video the avatar next to the login goes blank to.
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #37 on: December 07, 2009, 05:17:05 PM »
In header.php

find this :
Code: [Select]
if(isset($_COOKIE["id"]))
{
   $result_us= mysql_query("SELECT * FROM pp_user WHERE id=$_COOKIE[id]") or die(mysql_error());
      $row_us = mysql_fetch_assoc($result_us);
  $smarty->assign('user', $row_us['user']);


Add:
Code: [Select]
$smarty->assign('avatar', $row_us['avatar']);

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #38 on: December 07, 2009, 05:32:06 PM »
In header.php

find this :
Code: [Select]
if(isset($_COOKIE["id"]))
{
   $result_us= mysql_query("SELECT * FROM pp_user WHERE id=$_COOKIE[id]") or die(mysql_error());
      $row_us = mysql_fetch_assoc($result_us);
  $smarty->assign('user', $row_us['user']);


Add:
Code: [Select]
$smarty->assign('avatar', $row_us['avatar']);


here is my header.php

Code: [Select]

//Firefox? END

if(isset($_COOKIE["id"]))
{
   $result_us= mysql_query("SELECT * FROM pp_user WHERE id=$_COOKIE[id]") or die(mysql_error());
      $row_us = mysql_fetch_assoc($result_us);
  $smarty->assign('user', $row_us['user']);
  $smarty->assign('avatar', $row_us['avatar']);
}
?>


not sure why but when I add this two to  the bottom of videos.php and it started working if you are logged in you can see the avatar on the comment but if not logged in you can not
$smarty->assign('user', $row_us['user']);
$smarty->assign('avatar', $row_us['avatar']);


so my video.php looks like

Code: [Select]

<?php
/*
+ ----------------------------------------------------------------------------+
|     PHPDirector.
| $License: GNU General Public License
| $Website: phpdirector.co.uk
|
| THIS FILE IS AN UPDATED VIDEOS.PHP FILE.
+----------------------------------------------------------------------------+
*/

$idc $_GET["id"];

if(isset($idc) && is_numeric($idc)){

if(!isset($_COOKIE[$idc])){
$twomonths 60 60 24 60 time();
setcookie("$idc"$idc$twomonths);
$viewaddone true;
}

}

require(
'header.php');
$ip=$_SERVER['REMOTE_ADDR'];
$requete "SELECT COUNT(ip) as ip FROM pp_comment WHERE ip='$ip'";
$reponse mysql_query ($requete) or die (mysql_error);
$reponsemysql_fetch_array($reponse);
if (
$reponse['ip']==0) {

if(isset(
$_POST['go']) && !empty($_POST['comment']) && !empty($_POST['nom']))
{
mysql_query("INSERT INTO pp_comment (file_id, nom, comment,ip) VALUES ('$_POST[id]', '$_POST[nom]','".addslashes($_POST['comment'])."','$ip')");

$smarty->assign('message''Your comment has been added. Thanks');
}
}
else
{
$smarty->assign('message''Sorry, you have already comment this video');
}
$query_com "SELECT * FROM pp_comment WHERE file_id='$_GET[id]' ORDER BY id DESC";
$result_com mysql_query($query_com);
while (
$row_com mysql_fetch_assoc($result_com)){
 
$videos_com[] = $row_com;
 
$q_av "SELECT * FROM pp_user WHERE user='$row_co[nom]'";
$result_av mysql_query($q_av);
$row_av mysql_fetch_assoc($result_av); 
}
$smarty->assign('videos_com'$videos_com);
$smarty->assign('avatar'$row_av['avatar']);


if(isset($idc) && is_numeric($idc)){
$id mysql_real_escape_string($idc);
$result mysql_query("SELECT * FROM pp_files WHERE id=$id AND `approved` = '1' LIMIT 1") or die(mysql_error());  
}else{
$result mysql_query("select * from pp_files WHERE approved='1' AND reject='0' order by rand() LIMIT 1") or die(mysql_error());  
}

// For each result that we got from the Database
while ($row mysql_fetch_assoc($result))
{
 

 
$video[] = $row;

  if($viewaddone == true){
$new_views $row["views"] + 1;
mysql_query("UPDATE pp_files SET views = '$new_views' WHERE id = '$id'");
}

$smarty->assign('vidtype'$row['video_type']);

if( $row['video_type'] == "dailymotion"){
$dm_xml_pic_string = @file_get_contents("http://www.dailymotion.com/atom/fr/cluster/extreme/featured/video/".$row['file']);
$dm_xml_pic_start explode("/swf/",$dm_xml_pic_string,2);
$dm_xml_pic_end explode("\"",$dm_xml_pic_start[1],2);
$dmid $dm_xml_pic_end[0];
$smarty->assign('dmid'$dmid);
}

}

// Assign this array to smarty

$smarty->assign('video'$video);
$smarty->assign('id'$row['id']);
 
$smarty->assign('user'$row_us['user']); 
$smarty->assign('avatar'$row_us['avatar']);

if(isset($_GET["pop"])){
$smarty->display('viewvidpop.tpl');
}else{
$smarty->display('viewvid.tpl');
}

mysql_close($mysql_link);
?>



   
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #39 on: December 07, 2009, 05:41:15 PM »
Replace
Code: [Select]
$q_av = "SELECT * FROM pp_user WHERE user='$row_co[nom]'";
By
Code: [Select]
$q_av = "SELECT * FROM pp_user WHERE user='$row_com[nom]'";

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #40 on: December 07, 2009, 05:49:07 PM »
Replace
Code: [Select]
$q_av = "SELECT * FROM pp_user WHERE user='$row_co[nom]'";
By
Code: [Select]
$q_av = "SELECT * FROM pp_user WHERE user='$row_com[nom]'";


WOW thanks for all your help, I guess I had one two many beers!

I looked and looked.

working great now.   


might have a few more questions I am installing the PM script now.


if I do not care how many times someone posted a comment as log as they are logged in what would I change. thought this could be good for people to chat on comments


great job !!!!
« Last Edit: December 07, 2009, 05:51:27 PM by winracer »
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #41 on: December 07, 2009, 06:07:57 PM »
For this
replace :
Code: [Select]
$ip=$_SERVER['REMOTE_ADDR'];
$requete = "SELECT COUNT(ip) as ip FROM pp_comment WHERE ip='$ip'";
$reponse = mysql_query ($requete) or die (mysql_error);
$reponse= mysql_fetch_array($reponse);
if ($reponse['ip']==0) {

if(isset($_POST['go']) && !empty($_POST['comment']) && !empty($_POST['nom']))
{
mysql_query("INSERT INTO pp_comment (file_id, nom, comment,ip) VALUES ('$_POST[id]', '$_POST[nom]','".addslashes($_POST['comment'])."','$ip')");

$smarty->assign('message', 'Your comment has been added. Thanks');
}
}
else
{
$smarty->assign('message', 'Sorry, you have already comment this video');
}
$query_com = "SELECT * FROM pp_comment WHERE file_id='$_GET[id]' ORDER BY id DESC";
$result_com = mysql_query($query_com);
while ($row_com = mysql_fetch_assoc($result_com)){
 $videos_com[] = $row_com;
 $q_av = "SELECT * FROM pp_user WHERE user='$row_co[nom]'";
$result_av = mysql_query($q_av);
$row_av = mysql_fetch_assoc($result_av);
}
$smarty->assign('videos_com', $videos_com);
$smarty->assign('avatar', $row_av['avatar']);

With
Code: [Select]
if(isset($_POST['go']) && !empty($_POST['comment']) && !empty($_POST['nom']))
{
mysql_query("INSERT INTO pp_comment (file_id, nom, comment,ip) VALUES ('$_POST[id]', '$_POST[nom]','".addslashes($_POST['comment'])."','$ip')");

$smarty->assign('message', 'Your comment has been added. Thanks');
}

$query_com = "SELECT * FROM pp_comment WHERE file_id='$_GET[id]' ORDER BY id DESC";
$result_com = mysql_query($query_com);
while ($row_com = mysql_fetch_assoc($result_com)){
 $videos_com[] = $row_com;
 $q_av = "SELECT * FROM pp_user WHERE user='$row_co[nom]'";
$result_av = mysql_query($q_av);
$row_av = mysql_fetch_assoc($result_av);
}
$smarty->assign('videos_com', $videos_com);
$smarty->assign('avatar', $row_av['avatar']);

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #42 on: December 07, 2009, 06:12:09 PM »
You can also replace in comment.tpl

Code: [Select]
<td width="400" valign="top">{$LAN_160} <b>{$videos[videos_com].nom}</b><br />
     {$videos_com[videos_com].comment}</td>

By

Code: [Select]
<td width="400" valign="top">{$LAN_160} <b><a href=user.php?u={$videos[videos_com].nom}">{$videos[videos_com].nom}</a></b><br />
     {$videos_com[videos_com].comment}</td>

This code link the username to the userpage

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Member area
« Reply #43 on: December 07, 2009, 07:02:06 PM »
You can also replace in comment.tpl

Code: [Select]
<td width="400" valign="top">{$LAN_160} <b>{$videos[videos_com].nom}</b><br />
     {$videos_com[videos_com].comment}</td>

By

Code: [Select]
<td width="400" valign="top">{$LAN_160} <b><a href=user.php?u={$videos[videos_com].nom}">{$videos[videos_com].nom}</a></b><br />
     {$videos_com[videos_com].comment}</td>

This code link the username to the userpage


this must be a bad day for me. I tried the above code and do not see  the username
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline hilflo

  • Full phpd Member
  • ***
  • Posts: 98
  • Karma: 2
  • Sorry for my bad english
    • View Profile
    • Les félés
Re: Member area
« Reply #44 on: December 07, 2009, 07:05:22 PM »
Sorry, I think it"s my fault. Add a " before user.php