Search
Left Quote    Maybe this world is another planet's Hell.
- Aldous Huxley    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Comment Script Question
  This user is offline  gravy
  Subject: "Comment Script Question" Posted: @ 5:15 am on Mar 10 2007   

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

Heya,

I dug into the comment script today, and I got it to work and show up and all that happy stuff, so thats all awesome.

Noticed one thing though. If you comment on a page, it doesn't show up in the comments section until you manually hit the refresh button on your browser. Is there something wrong with the code, or...

Anyway, I have racked my head over the

Code:

header('Locatio n: http://' . $_SERVER['HTTP_ HOST'] . $_POST['page'] . "#comments ";


but have had no luck.



Photo Hosting Scripts? It's what I do....
    Viewed: 7,821 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: Comment Script Question" Posted: @ 5:36 am on Mar 10 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

I canged the code above to this:

Code:


//header(" ;Location: $info2";
echo ("<met a http-equiv='re fresh' content='2;URL =$_SERVER[HTTP_ REFERER]'> ";


works like a charm, but there is a slight delay....

oh and before anyone mentions it, ob_start();< /b> is my friend, and its line number one.




Photo Hosting Scripts? It's what I do....

    Viewed: 7,814 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Comment Script Question" Posted: @ 5:17 pm on Mar 10 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Yes, the problem is that the comments are displayed based on the URL, well, the URL you're re-directing includes #comments on the end. So you need to make a change when your query your comments, strip out #comments from the requested url so it will display it, like this:


Code:


$_SERVER['REQU EST_URI'] = str_replace(&q uot;#comments& quot;, "", $_SERVER['REQU EST_URI']); //take out anchor

//select all comments associated with this page:
$com = mysql_query(&q uot;SELECT * FROM `comments` WHERE `page` = '".strip slashes($_SERVE R['REQUEST_URI '])."' ORDER BY time ASC");
if(!$com) die(mysql_error ());




-bs0d | AllSyntax.com

    Viewed: 7,801 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: Comment Script Question" Posted: @ 6:21 pm on Mar 10 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

  bs0d said...

< i> Yes, the problem is that the comments are displayed based on the URL, well, the URL you're re-directing includes #comments on the end. So you need to make a change when your query your comments, strip out #comments from the requested url so it will display it, like this:

<BR><f ont size=1><u >Code:</u ><BR>& lt;div name="div _box" class="di vCode"> ;
$_SERVER['REQU EST_URI'] = str_replace(&q uot;#comments& quot;, "", $_SERVER['REQU EST_URI']); //take out anchor

//select all comments associated with this page:
$com = mysql_query(&q uot;SELECT * FROM `comments` WHERE `page` = '".strip slashes($_SERVE R['REQUEST_URI '])."' ORDER BY time ASC";
if(!$com) die(mysql_error ());


Tried it, doesn't work for me.
I actually kinda like the way I have set now, cause this way I can display a message to the user for that 3 seconds insuring them that their comment is being inserted.

Thanks for the help though.
Here is another question I have about this script.
Can I bridge it with my Complete Membership System so that the username is already filled in, and the contact would become Click Here so that another member could contact them if they want.

The comment script is used only by members to comment on photos. So I have no need for the filling of these fields, if you know what I mean.
Here is my test site, if you need an idea:Click Here to see what i mean




Photo Hosting Scripts? It's what I do....

    Viewed: 7,797 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: Comment Script Question" Posted: @ 8:43 pm on Mar 10 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

I got it, took a little time but it now suits the sites needs.




Photo Hosting Scripts? It's what I do....

    Viewed: 7,791 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Comment Script Question" Posted: @ 10:55 pm on Mar 10 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Good, so you answered your own question. Yes the comments can be integrated with the members system.




-bs0d | AllSyntax.com

    Viewed: 7,788 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank