• [Plugin] Postcard Viewer 4 0 5 1
Currently:  

Author Topic: [Plugin] Postcard Viewer  (Read 65850 times)

0 Members and 2 Guests are viewing this topic.

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« on: May 20, 2003, 01:53:30 AM »
Hi I am writing a little mod so I can view postcards people have sent from my site. I have come up with the following code but it needs a tiny tweak which I'm having problems with. Can anyone help? Heres the code.
Code: [Select]
<?PHP

$result = "SELECT p.postcard_id, p.image_id, p.postcard_date, p.postcard_bg_color, p.postcard_border_color, p.postcard_font_color, p.postcard_font_face, p.postcard_sender_name, p.postcard_sender_email, p.postcard_recipient_name, p.postcard_recipient_email, p.postcard_headline, p.postcard_message, i.image_name, i.cat_id, i.image_media_file, i.image_thumb_file, p.postcard_confirm
            FROM ".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i
            WHERE p.image_id = i.image_id";
while($row = mysql_fetch_array($result))
{    
    $postcard_id = $row["postcard_id"];
$postcard_date = date("D d M, Y g:i a", $row["postcard_date"]);
$image_id = $row["p.image_id"];
$postcard_bg_color = $row["p.postcard_bg_color"];
$postcard_border_color = $row["p.postcard_border_color"];
$postcard_font_color = $row["p.postcard_font_color"];
$postcard_font_face = $row["p.postcard_font_face"];
$postcard_sender_name = $row["p.postcard_sender_name"];
$postcard_sender_email = $row["p.postcard_sender_email"];
$postcard_recipient_name = $row["p.postcard_recipient_name"];
$postcard_recipient_email = $row["p.postcard_recipient_email"];
$postcard_headline = $row["p.postcard_headline"];
$postcard_message = $row["p.postcard_message"];
$cat_id = $row['i.cat_id'];
$image_media_file = $row[i.'image_media_file'];

echo <<<END
<table cellspacing="0" cellpadding="1" align="center" border="0">
  <tbody>
    <tr>
      <td bgcolor="$postcard_border_color"><table cellspacing="0" cellpadding="10" bgcolor="$postcard_bg_color" border="0">
  <tbody>
    <tr>
      <td valign="top"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">$postcard_date</font><br><a href="/details.php?image_id=$image_id" target="_blank"><img src="/data/media/$cat_id/$image_media_file" border="0"></a><br>
        <br> <font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">$postcard_recipient_name - </font>
<a href="mailto:$postcard_recipient_email"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">$postcard_recipient_email</font></a></td>
      <td valign="top" width="200" height="250"><div align="right"><img src="/templates/myleeneklass/images/stamp.gif" border="0"></div>
        <br> <br> <b><font face="$postcard_font_face" color="$postcard_font_color" size="4">$postcard_headline</font></b><br>
        <br> <font face="$postcard_font_face" color="$postcard_font_color" size="2">$postcard_message</font><br>
        <br> <font face="$postcard_font_face" color="$postcard_font_color" size="2">$postcard_sender_name</font><br> <a href="mailto:$postcard_sender_email"><font
                  face="$postcard_font_face" color="$postcard_font_color" size="2">$postcard_sender_email</font></a></td>
    </tr>
  </tbody>
</table></td>
    </tr>
  </tbody>
</table><br>
END;
}  

?>

Thanks in advance

Carl

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« Reply #1 on: May 20, 2003, 01:57:46 AM »
Sorry for posting in the wrong forum, I just realised  :oops:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Plugin] Postcard Viewer
« Reply #2 on: May 20, 2003, 02:22:02 AM »
Quote from: uksoreeyes
Sorry for posting in the wrong forum, I just realised  :oops:
no, not wrong forum, unless u dont wont to publish it ;) :lol:
$row["p.blah-blah-blah"] must be without p. ;)
also, this line might give u error:
$image_media_file = $row[i.'image_media_file'];
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« Reply #3 on: May 20, 2003, 03:52:22 AM »
Ok I've removed all the p's and that i from the $row...

Now When I execute the script I get the following error:
Quote

Parse error: parse error in \www\myleeneklass.com\htdocs\admin\plugins\postcard.php on line 48


On line 48 is: ?>

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Plugin] Postcard Viewer
« Reply #4 on: May 20, 2003, 04:20:31 AM »
I hope u didnt remove quote along with p. from
$row['image_media_file'];
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« Reply #5 on: May 20, 2003, 04:31:07 AM »
nope this is how it stands
Code: [Select]
$image_media_file = $row['image_media_file'];
Its just the image display I have problems with, I can have all the other information displayed on the page from the postcards table except for the image.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Plugin] Postcard Viewer
« Reply #6 on: May 20, 2003, 04:34:56 AM »
well, anyway, the error u showed above usualy accure when u lost a quote ( ' or " ) or a bracket ( } )
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« Reply #7 on: May 20, 2003, 06:19:13 AM »
Ok, finally got it right after an hour of neck ache lol. I don't know what I done but I changed a few things and it worked. Obviously there's improvements that can be made to the mod but I'll leave that to the people who know how. I've just set up the basics and it does its job.

--------------------------------------------------------------------
Installation:

- Create a new directory called plugins in your admin folder
- Extract the zip and copy the file postcard_view.php to the new plugins directory
- Log in to your Control Panel, a new link should appear in the left navigation frame
- Click it to view your postcards

Download postcard_view.zip
--------------------------------------------------------------------

I hope everyone finds this mod useful.

Carl

[EDITED by V@no]
The attached file below is a fixed version that works on servers with register_globals turned off.
« Last Edit: January 21, 2006, 11:19:56 PM by V@no »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Plugin] Postcard Viewer
« Reply #8 on: May 20, 2003, 06:52:19 AM »
very nice!
but by default I had problem with displaying images...
now working great
thx!
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Plugin] Postcard Viewer
« Reply #9 on: May 20, 2003, 07:03:14 AM »
I don't have time to look at it all but, this change will eliminate the need to hard code the database name.
Code: [Select]
<?php // PLUGIN_TITLE: Postcard Viewer

$nozip 1;
define('IN_CP'1);

define('ROOT_PATH'"./../../");
require(
ROOT_PATH.'admin/admin_global.php');

function 
display_results() {
global 
$site_db;

$sql "SELECT * FROM ".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i WHERE p.image_id = i.image_id ORDER BY postcard_id DESC";
$result $site_db->query($sql);
while($row $site_db->fetch_array($result))
{
 
   $postcard_id $row["postcard_id"];
$postcard_date date("D d M, Y g:i a"$row["postcard_date"]);
$image_id $row["image_id"];
$postcard_bg_color $row["postcard_bg_color"];
$postcard_border_color $row["postcard_border_color"];
$postcard_font_color $row["postcard_font_color"];
$postcard_font_face $row["postcard_font_face"];
$postcard_sender_name $row["postcard_sender_name"];
$postcard_sender_email $row["postcard_sender_email"];
$postcard_recipient_name $row["postcard_recipient_name"];
$postcard_recipient_email $row["postcard_recipient_email"];
$postcard_headline $row["postcard_headline"];
$postcard_message $row["postcard_message"];
$cat_id $row['cat_id'];
$image_media_file $row['image_media_file'];

echo <<<END
<table cellspacing="0" cellpadding="1" align="center" border="0">
  <tbody>
    <tr> 
      <td bgcolor="
$postcard_border_color"><table cellspacing="0" cellpadding="10" bgcolor="$postcard_bg_color" border="0">
  <tbody>
    <tr> 
      <td valign="top"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">
$postcard_date</font><br><a href="../../../details.php?image_id=$image_id" target="_blank"><img src="../../../data/media/$cat_id/$image_media_file" border="0"></a><br> 
        <br> <font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">
$postcard_recipient_name - </font>
<a href="mailto:
$postcard_recipient_email"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">$postcard_recipient_email</font></a></td>
      <td valign="top" width="200" height="250"><div align="right"><img src="../../../templates/default/images/stamp.gif" border="0"></div>
        <br> <br> <b><font face="
$postcard_font_face" color="$postcard_font_color" size="4">$postcard_headline</font></b><br> 
        <br> <font face="
$postcard_font_face" color="$postcard_font_color" size="2">$postcard_message</font><br> 
        <br> <font face="
$postcard_font_face" color="$postcard_font_color" size="2">$postcard_sender_name</font><br> <a href="mailto:$postcard_sender_email"><font 
                  face="
$postcard_font_face" color="$postcard_font_color" size="2">$postcard_sender_email</font></a></td>
    </tr>
  </tbody>
</table></td>
    </tr>
  </tbody>
</table><br>
END;
}
}
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="ltr">
<head>
     <title>4images - Control Panel</title>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <link rel="stylesheet" href="../../admin/cpstyle.css">
</head>
<body>
<?php display_results(); ?>
</body>
</html>
Interesting mod.  Be careful of privacy issues.
« Last Edit: January 21, 2006, 11:15:12 PM by V@no »

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« Reply #10 on: May 20, 2003, 07:42:03 AM »
I have updated the file now, thanks guys.

Offline toto1

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • http://www.gifanimer.com
[Plugin] Postcard Viewer
« Reply #11 on: May 20, 2003, 09:17:00 AM »
Parse error: parse error, expecting `','' or `';'' in /usr/local/www/data.users/xxxx/www/admin/plugins/postcard_view.php on line 33

 :?  :?

Offline uksoreeyes

  • Full Member
  • ***
  • Posts: 117
    • View Profile
    • http://www.myleeneklass.com
[Plugin] Postcard Viewer
« Reply #12 on: May 20, 2003, 02:07:18 PM »
Make sure there is no spaces after the echo <<<END and END;

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Plugin] Postcard Viewer
« Reply #13 on: May 20, 2003, 03:05:37 PM »
Cool.  :)

Offline Apollo13

  • Addicted member
  • ******
  • Posts: 1.093
    • View Profile
[Plugin] Postcard Viewer
« Reply #14 on: May 20, 2003, 04:42:22 PM »
well great think no question, but i think with this plugin u hurt the data security...