Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
jjmusicpro
Involved
Involved


Joined: Jul 12, 2005
Posts: 283

PostPosted: Thu Dec 28, 2006 6:19 pm Reply with quote

I was looking all over, but i was unable to find out hot to add google adsense to the forums last 5 block on the main page.

I can get it to run, but it wont display anything.
I tried adding all the adsense code, with the $content tag in front of it but it didnt work, ive read the forums here and nothing helps.
Code:
<?php


########################################################################
# PHP-Nuke Block: iCGstation Center Forum Block v.3              #
# Made for PHP-Nuke 6.5 and up                       #
#                                                                      #
# Made by mikem http://www.nukemods.com                                #
# This block is made only to match the iCGstation Theme pack           #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License.       #
# If you modify this, let me know for fun. =)                          #
######################################################################## 

if (eregi("block-iCGstation-Forum.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
   
global $prefix, $sitename, $admin, $db;

$HideViewReadOnly = 1;
          
$Last_New_Topics  = 8;
$show = "  <tr>
    <td height=\"15\" colspan=\"6\" align=\"center\" background=\"themes/iCGstation/forums/images/tb2_m.gif\">&nbsp;</td>
  </tr>
</table></td>
        </tr>
      </table></td>
  </tr>
</table>";


$Count_Topics = 0;
$Topic_Buffer = "";
$result = $db->sql_query( "SELECT t.topic_id, f.forum_name, f.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id ORDER BY topic_last_post_id DESC" );
while( list( $topic_id, $forum_name, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow( $result ) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result1 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'" );
      list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result1 );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }

   if( $topic_moved_id != 0 )
   {
     // Shadow Topic !!
      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$result2 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;

$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %h:%i%p') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);

$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);

                         $viewlast .="  <tr>
    <td height=\"34\" nowrap class=\"row1\"><img src=\"themes/iCGstation/forums/images/folder_new.gif\" border=\"0\" /></td>
    <td width=\"100%\" class=\"row1\">&nbsp;<b>$forum_name</b><br>&nbsp;&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\">$topic_title</a></td>
    <td align=\"center\" class=\"row2\">$topic_replies</td>
    <td align=\"center\" class=\"row1\"><a href=\"profile-.html$sifra\">$avtor</a></td>
    <td align=\"center\" class=\"row2\">$topic_views</td>
    <td align=\"center\" nowrap class=\"row1\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
      <a href=\"profile-.html$user_id\">$username</a>&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"themes/iCGstation/forums/images/icon_minipost_new.gif\" border=\"0\" alt=\"Last Post\"></a></td>
  </tr>";
}

   
   if( $Last_New_Topics == $Count_Topics ) { break 1; }
   
}

    $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
  <tr>
    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr>
          <td bgcolor=\"#000000\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
  <tr>

<th height=\"25\" colspan=\"2\" align=\"center\" nowrap><font color=\"#28313C\"><strong>Forum/Topic</strong></font></th>
    <th height=\"25\" width=\"50\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
    <th height=\"25\" width=\"100\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Author&nbsp;</strong></font></th>
    <th height=\"25\" width=\"50\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Views&nbsp;</strong></font></th>
    <th height=\"25\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
  </tr>";



    $content .= "$viewlast";

 $content .= "$show";


?>

_________________
- JJMUSICPRO
Myspacetoolbelt.com || RankBook.com || GamerBomb.com || MyspaceJar.com 
View user's profile Send private message Visit poster's website
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Fri Dec 29, 2006 1:58 am Reply with quote

tested and works to..... Wink

Code:


<?php
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}
global $prefix, $sitename, $admin, $db;
$HideViewReadOnly = 1;
$Last_New_Topics  = 8;
$show = "  <tr>
<td height=\"15\" colspan=\"6\" align=\"center\" background=\"\">&nbsp;</td>
</tr></table><scr~ipt type=\"text/javascr~ipt\"><!--
google_ad_client = 'pub-';
google_ad_width = '100%';
google_ad_height = ;
google_ad_format = ' ';
google_ad_type = 'text';
google_ad_channel ='';
google_color_border = '000000';
google_color_bg = 'ffffff';
google_color_link = '0000ff';
google_color_url = '00ff00';
google_color_text = '000000';
//--></scr~ipt>
<scr~ipt type=\"text/javascr~ipt\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scr~ipt></td></tr></table></td></tr></table>";
$Count_Topics = 0;
$Topic_Buffer = "";
$result = $db->sql_query( "SELECT t.topic_id, f.forum_name, f.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id ORDER BY topic_last_post_id DESC" );
while( list( $topic_id, $forum_name, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow( $result ) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result1 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'" );
list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result1 );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}
if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}
if( $skip_display == 0 )
{
$Count_Topics += 1;
$result2 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;
$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %h:%i%p') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);
$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);
$viewlast .="  <tr>
<td height=\"34\" nowrap class=\"row1\"><img src=\"\" border=\"0\" /></td>
<td width=\"100%\" class=\"row1\">&nbsp;<b>$forum_name</b><br>&nbsp;&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" class=\"row2\">$topic_replies</td>
<td align=\"center\" class=\"row1\"><a href=\"profile-.html$sifra\">$avtor</a></td>
<td align=\"center\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap class=\"row1\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
<a href=\"profile-.html$user_id\">$username</a>&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"\" border=\"0\" alt=\"Last Post\"></a></td>
</tr>";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
<tr><td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"#000000\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" nowrap><font color=\"#28313C\"><strong>Forum/Topic</strong></font></th>
<th height=\"25\" width=\"50\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
<th height=\"25\" width=\"100\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Author&nbsp;</strong></font></th>
<th height=\"25\" width=\"50\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Views&nbsp;</strong></font></th>
<th height=\"25\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
</tr>";
$content .= "$viewlast";
$content .= "$show";
?>
 
View user's profile Send private message
jjmusicpro
PostPosted: Fri Dec 29, 2006 8:30 am Reply with quote

Hitwalker....

Ok, I tried your code, however it dosent display anything....

It just acts like there is no data to display.
 
hitwalker
PostPosted: Fri Dec 29, 2006 8:42 am Reply with quote

well i did say i checked it....and i did..
dont forget to enter all the info in the adsense areas..and that you do that the correct way...

other possibility is that some java whatever breaks the code somehow,or you use to many adsense on your site....
a few options ....
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 8:44 am Reply with quote

I am running php 5 if that matters...
I dont have any adsenses on my site other then this one.
I have no other "adsense" like tools on my site.

But it still dosent work....

Code:



<?php
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}
global $prefix, $sitename, $admin, $db;
$HideViewReadOnly = 1;
$Last_New_Topics  = 8;

$show = "  <tr>
<td height=\"15\" colspan=\"6\" align=\"center\" background=\"\">&nbsp;</td>
</tr></table><sc~ript type=\"text/javascr~ipt\"><!--
google_ad_client = 'pub-xxxxxxxxxxxxxxxx';
google_ad_width = '468';
google_ad_height = '60';
google_ad_format = '468x60_as ';
google_ad_type = 'text';
google_ad_channel ='';
google_color_border = '000000';
google_color_bg = 'ffffff';
google_color_link = '0000ff';
google_color_url = '00ff00';
google_color_text = '000000';
//--></scri~pt>
<scr~ipt type=\"text/javas~cript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scr~ipt></td></tr></table></td></tr></table>";


$Count_Topics = 0;
$Topic_Buffer = "";
$result = $db->sql_query( "SELECT t.topic_id, f.forum_name, f.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id ORDER BY topic_last_post_id DESC" );
while( list( $topic_id, $forum_name, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow( $result ) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result1 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'" );
list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result1 );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}
if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}
if( $skip_display == 0 )
{
$Count_Topics += 1;
$result2 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;
$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %h:%i%p') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);
$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);
$viewlast .="  <tr>
<td height=\"34\" nowrap class=\"row1\"><img src=\"\" border=\"0\" /></td>
<td width=\"100%\" class=\"row1\">&nbsp;<b>$forum_name</b><br>&nbsp;&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" class=\"row2\">$topic_replies</td>
<td align=\"center\" class=\"row1\"><a href=\"profile-.html$sifra\">$avtor</a></td>
<td align=\"center\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap class=\"row1\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
<a href=\"profile-.html$user_id\">$username</a>&nbsp;<a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"\" border=\"0\" alt=\"Last Post\"></a></td>
</tr>";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
<tr><td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"#000000\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" nowrap><font color=\"#28313C\"><strong>Forum/Topic</strong></font></th>
<th height=\"25\" width=\"50\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
<th height=\"25\" width=\"100\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Author&nbsp;</strong></font></th>
<th height=\"25\" width=\"50\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Views&nbsp;</strong></font></th>
<th height=\"25\" align=\"center\" nowrap><font color=\"#28313C\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
</tr>";
$content .= "$viewlast";
$content .= "$show";
?>




Image
 
hitwalker
PostPosted: Fri Dec 29, 2006 8:51 am Reply with quote

huh...
and where does that page cannot be found comes from ?
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 9:00 am Reply with quote

Thats whats shows up when i put your code in, here is what it looks like with my code without adsense:

Image
 
hitwalker
PostPosted: Fri Dec 29, 2006 9:29 am Reply with quote

but thats impossible....
when adsense doesnt work ,..it doesnt show a page cannot be found...
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 9:33 am Reply with quote

I copy pasted your code above you put, and all i did was put in my pub id, and change these below:

google_ad_client = 'pub-xxxxxxxxxxxxxxxx';
google_ad_width = '468';
google_ad_height = '60';
google_ad_format = '468x60_as ';
 
hitwalker
PostPosted: Fri Dec 29, 2006 9:56 am Reply with quote

well i have no idea whats wrong or from your side...
speaks for itself that i created this for you,tested it with google and when done i gave it to you....

theres nothing more i can say...
you DID fixed the BROKEN java crap ?
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 9:59 am Reply with quote

What broken java crap? lol
 
hitwalker
PostPosted: Fri Dec 29, 2006 10:16 am Reply with quote

Well we cannot post full java scripts here remember?
So the script > tags are posted broken like scr~ipt>
check that...lol
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 10:21 am Reply with quote

yes, i fixed those.....when i installed it Smile
 
hitwalker
PostPosted: Fri Dec 29, 2006 10:24 am Reply with quote

well then im lost to...
i cannot see the situation so helping you further is hard...
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 10:28 am Reply with quote

ok....

anyone else?
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 12:00 pm Reply with quote

I even tried to make a center block all alone with google adsense, and it still dosent work.....

Code:



<?php
if (eregi("block-Sample_Block.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}
$content = "<s cript language='Javas cript'>
<!--
google_ad_client = 'pub-xxxxxxxxxxxxxx';
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = '468x60_as';
google_ad_type = 'text_image';
google_color_border = 'E3E6EA';
google_color_bg = '000000';
google_color_link = '0000CC';
google_color_text = 'FFFFCC';
google_color_url = '008000';
</scr  ipt>
<center><s cript language='Javas cript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</s cript></center>";
?>

 
hitwalker
PostPosted: Fri Dec 29, 2006 3:48 pm Reply with quote

well that proves a bit what i was telling / thinking huh...
 
jjmusicpro
PostPosted: Fri Dec 29, 2006 4:08 pm Reply with quote

I did a download online and found a preset google adsense block, i tried it and it worked, as a stand alone block, however, i still cant get them into above or below in the forums last 5 posts.
 
hitwalker
PostPosted: Fri Dec 29, 2006 4:12 pm Reply with quote

well i dont know what the reason is....
my testsite is ravennuke latest..,so why its different for you i dont know.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©