Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Pop Image

(Page 1 of 2)
> >
Quote Reply
Pop Image
I am alittle embarrased to admit that I have messed up the Popular/Cool Image mod.

I decided to press forward and integrate the Yahoo style template, but in configuring the new site_html_templates.pl somehow overlooked something.

I got the 3 level new graphics going and do have the
Code:
$popimg = '<img src="http://mysite/images/cool.gif" border="0">';
just below the new graphics definitions and just above the
%globals

But I am getting a "Unkown Tag: popimg" on the pages.

As I recall wasn't there something in the
Code:
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

And or elsewhere?

I searched for the documentation on the mod, but cannot find it in the Resource Section or the forum.

I have three backups of the site_html_templates.pl but somehow they don't have any more references than the image definition above.

The only files that have been changed are the site_html_templates.pl and the temolates.

The link.html has:
Code:
<%if isPopular%><a href="<%build_cool_url%>"><%popimg%></a><%endif%>

Can you point me to the mod, or offer the fix?

Thanx

------------------
BruceS

[This message has been edited by BruceS (edited January 19, 2000).]
Quote Reply
Re: Pop Image In reply to
You need to define the popimg tag in the sub site_html_link routine in the site_html_templates.pl file, with the following codes:

Code:
popimg => $popimg,

Also, make sure that in the global variables that you have the following tag defined:

Code:
build_cool_url => $build_cool_url,

I REALLY hope this helps.

BTW: You can search this forum for your user name to find previous Threads that you have created.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
 Smile Smile That was it!

Haven't implemented yet, but Yes that was what I missed, and couldn't find.
Code:
BTW: You can search this forum for your user name to find previous Threads that you have created.

I searched all the threads for "cool" "pop", and "popimg" but nothing came up.

If I asked this in a previous thread, I do not recall

But thanks none the less!

BTW I just searched by username, and the only thread that came up was this one!
(all forums/any date)

And now on to the password issue, I emailed widget requesting more on the password mod he showed us and we discussed, but haven't heard back!

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
Widgetz is busy...and he selectively responds to email messages he receives...may be you will be one of the lucky ones to receive a response.

Smile

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
Cool image is working...... Thanx Smile

Re: Widgetz, I hope he does! this is important to me as a user id and password system will save a lot of time and trouble for all.

I see that there is a password retrieval system at Gossamer Threads, wouldn't it be nice to work that one into Links?

Thanks again for your assistance!

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
There is actually a LINK INFORMATION retrieval mod in the Resource Center, which can be modified with whatever fields you use with modifying your links in the modify.cgi file.

Look at the following URL:

vlib.anthrotech.com/bin/password.cgi

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
I have that one working very nicely, thank you, now it's the user name/password I am trying to figure out.

Again, anyone could hack this one if they could figure out the owner's email ie: webmaster@foo.com

then they'd get and be able to modify someone elses (the competition's) information!

But if there was a unique user name and password attached to a link, like widget's, we'd be off and running!

I'd like one step more as in the "forget your password?" above this textarea!
Code:
<A HREF="forum.cgi?action=lostpw">Forget your password?</A>
Smile

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
All you have to do is the following:

1) Add two fields: Username and Password to your links.def file. Remember you will need to add two delimiters to the end of your database as placemarkers for these fields in your existing database.

2) Then add these fields to your add and modify template files.

3) Then in the forget password script, use email address, but send the Username and Password information.

4) Password protect with .htaccess the /data/ directory, so that people cannot access your database.

I do have another LINKS project where I am using Username and Password:

Add Form:
www.anthrotech.com/cgibin/madagascar/links/add.cgi

Modify Form:
www.anthrotech.com/cgibin/madagascar/links/modify.cgi

REALLY hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------







[This message has been edited by Eliot (edited January 20, 2000).]

[This message has been edited by Eliot (edited January 20, 2000).]
Quote Reply
Re: Pop Image In reply to
That looks great, but before I screw up the db
(I tried a find and replace on it to change the dates (Backdate) when I was having build problems and my editor screwed it up somehow - didn't notice and save it, what a mess)

I may do it manually or take it into access ...... haven't decided. There are over 700 links in the db so here's the Q's...

If I do it manually: As I recall, the last field is for "email update choice" and If I recall correctly, there is not a pipe following the field data (yes / no) so each line-end would look like....
Code:
|yes| |

or would it look like...
Code:
|yes| &#0124; &#0124;


And here's where I am looking for a suggestion......

Again, of the 700 + existing links probably 500 were place there by me originally from other sources, and I will invite them by email to submit their choice of username, password, more detail, etc.

I guess it probably is not a good idea to leave the fields blank, for existing links or do you suggest I put something in that I can retrieve on behalf of the first 700?

Perhaps, I should repeat their Id in both fields?

I hope you are understanding where I am going with this? And can advise on a plan!

If I need to, I will generat some sort of A1,A2,B1,B2 system or something. What do you suggest?




------------------
BruceS

[This message has been edited by BruceS (edited January 20, 2000).]
Quote Reply
Re: Pop Image In reply to
In terms of adding fields, there is a FAQ in the database that include codes for "upgrading" existing databases. If not use the following script:

Code:
#!/usr/local/bin/perl
# -------------------------------------------
#You must EDIT YOUR links.def script BEFORE entering these variable and running this script!
#Put the default value of the new field here. Leave Blank for no default.
$field_default = "";

#Put the new field number here.
$new_field = "26";

#Put the last field number here.
$total_fields = "27";

#Change these value to match your settings
require "../db_utils.pl";
require "../links.def";


#You shouldn't have to edit below this line
#------------------------------------------
$nfm1 = $new_field - 1;


$ENV{'REQUEST_METHOD'} and (print "Content-type: text/plain\n\n");
open (DB, "</path/to/links.db") or print "Unable to open links database 'links.db'. Reason: $!" and exit;
print "\tOpening output file . . .\n";
open (DBOUT, ">/path/to/links2.db") or print "Unable to open output database. Make sure data dir is chmod 777 temporarily. Reason: $!" and exit;
print "\n\n\tProcessing records\n";
while (<DB> ) {
(/^#/) and next LINE; # Skip comment Lines.
(/^\s*$/) and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@rec_in = &split_decode($_);
# Copy ID, Title, URL, Date and Category
for $i (0 .. $nfm1) {
$rec_out[$i] = $rec_in[$i];
}
# Add New Field
$rec_out[$new_field] = "$field_default";
# Copy the rest of old links.db to new links2.db
for $i ($new_field .. $total_fields) {
$rec_out[$i + 1] = $rec_in[$i];
}
print DBOUT &join_encode(&array_to_hash(0, @rec_out));
}
print "\tDone.\n\n";
close DB;
close DBOUT;
print "Database saved it as links2.db.\n";
print "Change permissions back to 755 on the data directory.\n\n";
print "You must rename 'links2.db' to 'links.db before using with Links v2.\n";
print "It is recommend you save the original 'links.db' before renaming.\n\n";

FIRST...add the first field to your links.def file.

THEN...

1) Save this file as upgrade.cgi.
2) Change the following information:

$field_default = "";

(if want a default value for the field, enter it between the double quotes.)

$new_field = "26";

Change this to the field number of your new field.

$total_fields = "27";

require...

You may have to change this to the path where your db_utils.pl and links.def files are located. (You may have to use the complete absolute path to these files.)

/path/to

Change this to the complete absolute path where your database file is located. Same thing for where your links2.db will be built.

Note: You will have to edit this file twice for each field you are adding!

3) Upload this script to your server.
4) Change the permission of the file to 755 (rwxr-xr-x).
5) Rename your links2.db to link.db.
6) Then follow these steps again for the other field you are adding.

Hope this helps.

BTW: This particular script has been referenced in more than one thread in both the Discussion and Modification Forums.

Wink

Keep in mind that this is a security fix for smaller databases. Adding these fields will add a bunch of data into your database. I would recommend using maxlength restrictions for both of these fields.

Regards,


------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------







[This message has been edited by Eliot (edited January 20, 2000).]
Quote Reply
Re: Pop Image In reply to
WOW thanks! Smile I will take a look at the FAQ's first, but then probably use yours!

A couple of clarifications first though.....

Code:
$field_default = "";

(if want a default value for the field, enter it between the double quotes.)

$new_field = "26";

Change this to the field number of your new field.

$total_fields = "27";
1) I believe this has already been done (field numbers) in the code you provided, and I assume that this is the current number of fields in the existing links2 program (I obviously haven't added any yet!)

2) As I mentioned above, I am wondering about setting any default values.
Example - Say I set
UserId as "Your User ID Here" and
The Password Field as "Your Password Here" as defaults!

In use, if someone emails a request to establish initial control over an existing entry eg: Let's say I have "foo.com" already there but the owner of "foo.com" wants to take control.

I give them the ID and password (above). They would then get access to all the ones with that default setting! Yes/No?

AND
Code:
require...

You may have to change this to the path where your db_utils.pl and links.def files are located. (You may have to use the complete absolute path to these files.)

As long as I put this script into the same folder as db_utils.pl and links.def I assume setting it at:
Code:
require "db_utils.pl";
require "links.def";
Will do the trick! Yes?

Finally,
Code:
I would recommend using maxlength restrictions for both of these fields.
Did I see a setting for this somewhere in one of the scripts, or is setting maxlength in the form going to do it?

------------------
BruceS


[This message has been edited by BruceS (edited January 20, 2000).]
Quote Reply
Re: Pop Image In reply to
1) Yes...those are fields in a previously used upgrade script...I have actually scaled back my primary LINKS database and have added a second database for Editor reviews of links...I do not want to go into that now....

2) About your default values...That is up to you...I would keep them simple and short! If you assign everyone the same password and username, then yes...they can conceivable access each other records...as we discussed before in your other Thread...Yet if you give them their ID, username, and password...this should be sufficient. They can then modify their link information, including username and password in the modify.cgi script.

If you put the script in the same folder as the required files, then yes...it should work.

Good luck,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------







[This message has been edited by Eliot (edited January 20, 2000).]

[This message has been edited by Eliot (edited January 20, 2000).]
Quote Reply
Re: Pop Image In reply to
Perhaps this thread shoulf be renamed or split as it has obviously detoured from the original issue!

Does moderator have that ability?

Do we care?

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
Please don't ignore previous questions about user id and password assignments in links.db, but I may have answered my own question re the filed number assignments in the links.def
Here's what's there:
Code:
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes']
);
So I would add to the bottom:
Code:
'Password' => [14, 'alpha', 20, 20, 1, '', ''],
In thinking this through, It seems like the use of a User Id might be redundant. They could simply use the "Contact Name for this purpose because, unless, I make use of "Detailed Pages", it would never be revealed anyway, but even if it was, the password would always be the private "key" to the information.

Yes?

Assuming all above is correct, then I set the upgrade.cgi
Code:
$field_default = "Replace with your Password";
$new_field = "14";
$total_fields = "15";
The default actually is written to the links.db doesn't it? (not just show up in admin)

Then I save a copy of the links.db for safety, make changes to links.def, run upgrade.cgi, rebuild the database, and add the password field into the add and modify templates, and configuration for the password.cgi

But, I think maybe, I need a little help here:
In the password.cgi
Code:
#***********************************************************
# Use the info in links.def to find the values you want.
# These are the default values. If you have added fields, then
# make sure that you define it by $db_newfield = 14; and then
# to get the value, you can call it by $data[$db_newfield]
#
# $db_category = 4; $db_modified = 3; $db_url = 2;
# $db_hits = 8; $db_isnew = 9; $db_ispop = 10;
# $db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
# $db_votes = 12; $db_rating = 11; $db_mail = 13;
#**********************************************************

open (MAIL_RECIP, "|$MAIL_PROGRAM");

print MAIL_RECIP "To: $email\n";
print MAIL_RECIP "From: $admin\n";
print MAIL_RECIP "Subject: Web Site Information Request\n";

print MAIL_RECIP "You have requested your web site information for $email.\n";

print MAIL_RECIP "Resource ID: $data[0]\n";
print MAIL_RECIP "Title : $data[$db_title]\n";
print MAIL_RECIP "URL : $data[$db_url]\n";
print MAIL_RECIP "Category : $data[$db_category]\n";
print MAIL_RECIP "Description : $data[5]\n\n";
print MAIL_RECIP "Contact Name : $data[$db_contact_name]\n";
print MAIL_RECIP "Contact Email : $data[$db_contact_email]\n";

close(MAIL_RECIP);

} # end of foreach
I am confused by
Code:
If you have added fields, then
# make sure that you define it by $db_newfield = 14; and then
# to get the value, you can call it by $data[$db_newfield]
DO I add
Code:
$db_mail = 14;
AND
Code:
print MAIL_RECIP "Password : $data[$db_Password]\n";
Or am I over training?

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
You are overthinking this problem totally!

First of all:

Code:
User Name: <input type="text" name="Contact Name">

You can link this email form from the modify template files to let people know that if they have not already added a site, but would like to modify a resource that they fill out the mail form. The mail form will not touch your modified.db or links.db. It will be intensive on your part to verify the emails you receive to make sure that it is actually the person who owns the link. But this is the only solution I have for you.

I think you are making this a bigger problem then it is.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
Sorry to be a pest, but...

Maybe the get password form should require the link ID number and have defaut "User Id here" and "Password here"

The link number is never displayed, is it?

So They email me with a request for control, and I send them back the link ID along with an instruction to replace "User Id here" and "Password here" with their own.

Would that work? then I could have a default "User Id here" and "Password here"
in the links.db

Thoughts?

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
That sounds like a better proceedure, and I am prepared (I hope) for the additional work to validate users.

Code:
if you have not already added a site, but would like to modify a resource you may apply for privilidges by filling out this form:

<form method=post...etc>
Email Address: <input type="text" name="email"><br>
Contact Name: <INPUT TYPE="TEXT" NAME="Contact Name" VALUE="" SIZE=25 MAXLENGTH=25><br>
Password: <INPUT TYPE="PASSWORD" NAME="Password" VALUE="" SIZE=13 MAXLENGTH=13><P>
We will verify your information and contact you when you are approved!
Regarding the use of the recommend.cgi, should I rename the script in case I wish to utilize the Recommend Feature on the links.

I looked at your madagascar pages and I bet this really helps propogate your traffic!

------------------
BruceS

[This message has been edited by BruceS (edited January 21, 2000).]
Quote Reply
Re: Pop Image In reply to
1)

Quote:
I guess you are suggesting that if soemone sees a link and wishes for privilidges, that they use the recommend.cgi to email me the request, yes? Then I manually input their password, and reply that they are approved, yes?

YES.

2) The codes you are using in the Modify Forms are fine. However, you will now have to edit the modify.cgi script to recognize the following fields:

Email Address (already does that)
Contact Name (need to edit to recognize this field)
Password (need to edit to recognize this field)

RATHER than

Link ID
Link URL
Contact Email

3) About the Recommend It! script...You will have to use two different copies of script:

a) For users to recommend sites to other users.

b) For users to send you an email message about modifying a site.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
I am sorry, I know I am a pest, and I do appreciate your following this through with me.

I did not mean to rename any of the fields, if that is what you thought!

I realize that I would need to add the password field where ever necessary, but I do not intend to change any others.
Quote:
2) The codes you are using in the Modify Forms are fine. However, you will now have to edit the modify.cgi script to recognize the following fields:

Email Address (already does that)
Contact Name (need to edit to recognize this field)
Password (need to edit to recognize this field)

RATHER than

Link ID
Link URL
Contact Email
I guess I am not clear about modifying the modify.cgi script. Are you suggesting that by doing so, the input would be there waiting for me to validate in the admin interface rather than needing to replace anything in the link itself?

That would automate the process, but how would it affect new submissions?

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
Uh...The modify.cgi script should be used for people who have ALREADY added links into your database!

Look in the file! Do you see the following Fields:

LinkID
CurrentURL
Contact Email

Welp...you need to change these fields to the fields you are using in the MODIFY FORM!

I don't know how to make this more clear and understandable for you. I have been VERY patient up to this point.

Wink

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
Yes, you have been patient! So far!

I was not suggesting changing those fields but adding another form in the modify template for users who's websites were listed but had no pre-existing administration over their listing.

I guess I see that that would have been redundant on the modify template. However, I guess that I ALSO have to update the ADD template too! so all would become consistant, which means also changing the add.cgi to accomodate the "password field", now doesn't it?

I was avoiding changing how the links are submitted and maintained, so since all these changes are becoming necessary, am I unaware of any others?

------------------
BruceS

[This message has been edited by BruceS (edited January 21, 2000).]
Quote Reply
Re: Pop Image In reply to
Not at this time....

Good luck!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
Just to verify!

I am adding the password field to links.def as
Code:
Password => [14, 'alpha', 20, 20, 1, 'Lee39', "]

1) No comma because it is the last field, yes?
2) Is there a format definition needed, or suggested for a password field?

------------------
BruceS
Quote Reply
Re: Pop Image In reply to
If you are putting your database file in a .htaccess protected directory, then you can leave the password in plain text.

If not, then we will have to figure out something that will allow users to input a password, have it stored in an encrypted form, and then have people be able to receive the actual plain text password via email.

The encryption part is not hard, but sending the password in plain text from an encrypted format is the hard part.

The easiest thing to do is put your links.db file in a password protected directory and leave the password in plain text.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Pop Image In reply to
I added htaccess to data directory. I am sure that that will be enough!

BUT I just finished modifying the links.def and then tried the new upgrade.cgi and got a "Premature End of Script headers" error.

I have just added #!/usr/local/bin/perl

use CGI::Carp qw(fatalsToBrowser);

To see what's going on.

I set data premissions to 777 and upgrade.cgi to 755, but can't see anything else weird in the script.

I changed the paths to db_utils.pl and links.def to the full path, but?

Frown

------------------
BruceS
> >