4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Plugins => Topic started by: uksoreeyes 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.
<?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
-
Sorry for posting in the wrong forum, I just realised :oops:
-
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'];
-
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:
Parse error: parse error in \www\myleeneklass.com\htdocs\admin\plugins\postcard.php on line 48
On line 48 is: ?>
-
I hope u didnt remove quote along with p. from
$row['image_media_file'];
-
nope this is how it stands
$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.
-
well, anyway, the error u showed above usualy accure when u lost a quote ( ' or " ) or a bracket ( } )
-
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 (http://soreeyes.myby.co.uk/scripts/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.
-
very nice!
but by default I had problem with displaying images...
now working great
thx!
-
I don't have time to look at it all but, this change will eliminate the need to hard code the database name.
<?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.
-
I have updated the file now, thanks guys.
-
Parse error: parse error, expecting `','' or `';'' in /usr/local/www/data.users/xxxx/www/admin/plugins/postcard_view.php on line 33
:? :?
-
Make sure there is no spaces after the echo <<<END and END;
-
Cool. :)
-
well great think no question, but i think with this plugin u hurt the data security...
-
Yeah. I think there is an expectation of privacy when someone sends a postcard. When I visit a site, I wouldn't want someone else peeking at a postcard I had sent.
-
the same think is with emails... On my site u can send freemails... But i dont log them
-
I can see what you mean. You can always place a message on the postcards page stating to visitors that their postcards may be viewed by the administrator.
I wrote this mod more for security of my visitors. With about 97% of my visitors being under the age of 17, it's important that I keep my eyes open for anything that may seem odd. When there's children involved it's my job as an administrator to make sure they are kept safe on my site and that they don't see anything that is unfit.
But naturally if this wasn't the case and I ran a site which involved more mature visitors I personally wouldn't bother logging messages, because it's a full time job and I'm basically not really interested in what people have to say in their private conversations.
-
great mod :D but how can i see all postcards, it shows me only the last 5.
-
great mod :D but how can i see all postcards, it shows me only the last 5.
postcards automaticaly deletes after time set in the settings.
-
worked like a charm for me!
One question, when I installed it, and clicked the "postcard Viewer" link, it showed me 2 cards from a week ago already.... how far back does it go?
-
@veno: i looked in the postcard_view.php and in the 4images control panel (settings) but i can´t find the time set! where can i find it? is it possible to make it without time limit or is this not good for performance?
-
Look inside includes/constants.php
// Days postcards will be held in the database
define('POSTCARD_EXPIRY', 10);
-
Look inside includes/constants.php
// Days postcards will be held in the database
define('POSTCARD_EXPIRY', 10);
THX!
-
8) 8) 8) 8) 8) Well, great mod! Thanks!
-
danke für den tollen mod. genau das habe ich schon länger gesucht ...
-
:lol: Just al little question: is it possible to sort the postcarts by date and time? The newest at top!
Thanks...
-
:lol: Just al little question: is it possible to sort the postcarts by date and time? The newest at top!
Thanks...
Find in postcard_view.php:
ORDER BY postcard_id DESC
Change to:
ORDER BY postcard_date DESC
Carl
-
Nice MOD :D :wink:
-
i get only an error message :(
Parse error: parse error, unexpected '&', expecting T_PAAMAYIM_NEKUDOTAYIM or '(' in /home/www/marcomarten.com/htdocs/gallery/admin/plugins/postcard_view.php on line 7
-
i get only an error
Parse error: parse error, unexpected '&', expecting T_PAAMAYIM_NEKUDOTAYIM or '(' in /home/www/marcomarten.com/htdocs/gallery/admin/plugins/postcard_view.php on line 7
I get the same error
-
Bei mir kam auch immer diese Fehlermeldung.
Ich habe den Code vom "Modified Card Viewer" entsprechend angepasst und nun klappt es 8)
:arrow: Datei siehe Zip-File
Viele Grüße
kleiner_Hobbit
-
If I may leave my inputs, even though the last english post was on sept 15 2005, I'd like to comment on something.
This paragraph :
<?php // PLUGIN_TITLE: Postcard Viewer
$nozip = 1;
define('IN_CP', 1);
$root_path = (eregi("\/plugins\/", $PHP_SELF)) ? "./../../" : "./../";
define('ROOT_PATH', $root_path);
require(ROOT_PATH.'admin/admin_global.php');
show_admin_header();
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 = get_media_code($row['image_media_file'], $image_id, $cat_id, $row['image_name']);
$template = TEMPLATE_PATH;
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">$image_media_file</a><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="$template/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;
}
}
display_results();
show_admin_footer();
?>
should rather be re-coded like this :
<?php // PLUGIN_TITLE: Postcard Viewer
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', '../../');
require(ROOT_PATH.'admin/admin_global.php');
show_admin_header();
if ($action == "") {
$action = "postcards_view";
} ###### End of if statement.
if ($action == "postcards_view") {
function display_results() {
global $site_db, $table_menu, $site_sess;
$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 = get_media_code($row['image_media_file'], $image_id, $cat_id, $row['image_name']);
$table_menu = "";
$table_menu .= "
<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=\"".$site_sess->url(ROOT_PATH."details.php?&".URL_IMAGE_ID)."\" target=\"_blank\">".$image_media_file."</a><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=\"".get_gallery_image("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>
";
echo $table_menu;
unset ($table_menu);
} ###### End of while statement.
} ###### End of function statement.
$disp_results = (function_exists('display_results')) ? display_results() : '';
unset ($disp_results);
show_admin_footer();
} ###### End of if statement.
?>
Tell me if you still have these error messages after replacing this block. ;)
-
Great job, now it works.
Thank you TheOracle! :D
-
Great job, now it works.
Thank you TheOracle! :D
Excellent. Glad to see it worked out fine for you. The first codings gave me the creaps a little. 8O :mrgreen:
-
sorry i am not an advance user but i got the code and put it to site as card_viewer.php and run it and i got the error
Warning: main(../../admin/admin_global.php): failed to open stream: No such file or directory in D:\Inetpub\vhosts\gulce.net\httpdocs\card_viewer.php on line 8
Fatal error: main(): Failed opening required '../../admin/admin_global.php' (include_path='.;./includes;./pear') in D:\Inetpub\vhosts\gulce.net\httpdocs\card_viewer.php on line 8
Not sure if i make a mistake. Can you help?
-
@maninblue: (thought it was maninblack :mrgreen:)
Simply play with this bolded part below :
define('ROOT_PATH', '../../');
from your file.
Hint: If you have another plugin file, from inside the plugins folder, simply copy that line and copy it into your new one. ;)
-
now it works i change it:)
note: men sometimes wear blue also (not an alien buster)
-
sorry i am not an advance user but i got the code and put it to site as card_viewer.php and run it and i got the error
Warning: main(../../admin/admin_global.php): failed to open stream: No such file or directory in D:\Inetpub\vhosts\gulce.net\httpdocs\card_viewer.php on line 8
Fatal error: main(): Failed opening required '../../admin/admin_global.php' (include_path='.;./includes;./pear') in D:\Inetpub\vhosts\gulce.net\httpdocs\card_viewer.php on line 8
Not sure if i make a mistake. Can you help?
You didnt follow properly the installation instructions:
http://www.4homepages.de/forum/index.php?topic=5769.msg24828#msg24828
The file must be placed in admin/plugins/ folder not into your 4images root.