Gossamer Forum
Home : Products : Links 2.0 : Customization :

Password MOD Help !!!

Quote Reply
Password MOD Help !!!
Sorry if this is a double posting, but I searched for 1 hour and I couldn't find any answer in this. I use the password MOD for Templates, and I made all the code changes, double checked them, made the modify_first.html template and all the other things, and when I am completing the ID and password request, i get a general error (Error Modifying Resource) message instead of entering the modify.html page. Why??? Please, help me

Thanks in advance

Quote Reply
Re: Password MOD Help !!! In reply to
Hi Shardon

In modify.cgi its the call to site_html_modify_failure that generates the 'Error Modifying Resource' template, (modify_error.html).

In modify.cgi there are two calls to site_html_modify_failure each with an error message. The first is 'Unknown link ID...' The second 'Pasword invalid...'

You should have had one of these error messages which should help pinpoint the problem.

Without anything else to go on I would suggest you check that the case of the word 'password' in $in{'password'} matches what you have as the name of your password field in the form.



George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
No....the case is correct. By the way, I just saw something: There is a line in modify.cgi which says:

if ($rec{$db_key} eq $in{'ID'}) {

I do not know much about perl, but I am using the keywords MOD in which I have defined a db field named key. Could this be a conflict in the field request causing this problem to appear??

What should I do?

Thanks for your time.

Regards,
Shardon


Quote Reply
Re: Password MOD Help !!! In reply to
Hi Shardon

$db_key is defined in links.def and = 'ID' hence you could change $rec{$db_key} to read $rec{'ID'} to see if you have a conflict.

I don't think there is a conflict but if you list your MOD definition I'll check it out.

Moving on a little you are in the right area... The two lines:-
if ($rec{$db_key} eq $in{'ID'}) {
if ($rec{'Password'} eq $in{'password'}) {

are where you can find out what is going on. The first requires that the record ID be equal to the ID passed by
the form. The second requires that the password in the database for the record is equal to the password passed by the form.

You didn't say what your error message was. This would help.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
the message was too generic: Error Modifying Resource. That means the script never checked the values of the two fields, right? I think that there 's something else heppening......damn.....

Thanks

Regards,
Shardon

Quote Reply
Re: Password MOD Help !!! In reply to
No - it means the script found something wrong when it checked the fields but the error message isn't getting to 'modify_error.html'. This is another problem however its best to stick with the first.

Try hard coding the ID and the password values into sub main just to see what happens eg; after
local (%in) = &parse_form;
add
$in{'ID'} = 'XX';
$in{'password'} = 'ZZZZZZ';
where XX and ZZZZZZ are the actual ID and password in the database.

If this works you can comment out each line in turn, (using the #), just to isolate which is causing the problem.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
Well...I did it....and caused a very wide group of nasty effects:

1. With both as constants it works perfectly
2. With the password as constant it displays the form and then shows the error upon submission (Error modifying Resource)
3. With the ID as constant it causes the above error without even displaying the form...

Hope the above helps you help me

The following is the links.def file, maybe can help. Check these things about the db_key

# -------------
# Links
# -------------
# Links Manager
#
# File: links.def
# Description: Contains the database definition for links.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.01
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================

# Database Definition: LINKS
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 175, 1, '', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 1, '', ''],
'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'],
City => [14, 'alpha', 40, 75, 1, '', ''],
Area => [15, 'alpha', 40, 75, 1, '', ''],
Phone => [16, 'alpha', 10, 75, 0, '', ''],
Key => [17, 'alpha', 40, 500, 1, '', ''],
isBest => [18, 'alpha', 0, 5, 0, 'No', ''],
Password => [19, 'alpha', 10, 10, 1, '', '']


);

# Database file to use -- defined in links.cfg.
$db_file_name = $db_links_name;
# Counter file to use -- defined in links.cfg.
$db_id_file_name = $db_links_id_file_name;
# The column name for the database key.
$db_key = 'ID';
# Database delimeter.
$db_delim = '|';
# Title used in admin output.
$html_title = 'Links Database';
$html_object = 'Link';

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$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;
$db_city = 14; $db_area = 15; $db_phone = 16;
$db_isbest = 18; $db_password = 19;
# Field number to sort links by:
$db_sort_links = 1;

# Field names you want to allow visitors to search on:
@search_fields = (1,2,5, 17);

# System defaults. When adding new links or modifying links, these fields
# can not be overwritten by a user.
%add_system_fields = (
isNew => 'No',
isPopular => 'No',
isBest => 'No',
Hits => '0',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes'
);


# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
ReceiveMail => 'Yes,No',
isBest => 'Yes,No'
);




# Hash of column names to radio values. If you use &build_radio_field, it will
# make a <INPUT TYPE="RADIO"> tag for you using the options specified in the hash.
%db_radio_fields = ( );

# Maximum number of hits returned in a search. Can be overridden in the search
# options.
$db_max_hits = 10;

# Use the built in key tracker.
$db_key_track = 1;

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
@db_cols = ();
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}

1;


----------------
Regards,
Shardon
Quote Reply
Re: Password MOD Help !!! In reply to
It looks like you have a fault in modify_first.html and I think it will be the name of the password field.

The second problem where error messages aren't being shown, (all you get is Error Modifying Resource), is probably in modify_error.html. I think it will be around the place where you should have:-

<table border=0 width=95% bgcolor=#000000>
<tr>
<td>

<table border=0 width=100% bgcolor=#FFFFFF cellspacing=1 cellpadding=4>

<tr>
<td bgcolor="#F1DBD6"><font face="Times New Roman" size=3><b>Error Modifying Link</b></font>
</td>
</tr>

<tr>
<td bgcolor="#F7F7F7">
<font face="Times New Roman" size=2><b>
<p>There were the following errors trying to modify your Link:</p>
<p><strong><font color=red><b><%error%></b></font></strong></p>

</b></font>
</tr>
</td>
</table>

If you find anything in these two files and manage to clear them then we can move on to an emerging problem where you can't submit the modified record. I think this is an error in modify.html on the form that is submitted. I think once again it is something to do with the password field, maybe the name again.

I looked through your links.def and can't see anything wrong with it.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
hmm....i tried your code in the modify_error.html and it showed the following errors:

There were the following errors trying to modify your Link:


Title (Can not be left blank)
URL (Can not be left blank)
Category (Can not be left blank)
Description (Can not be left blank)
Contact Name (Can not be left blank)
Contact Email (Can not be left blank)
City (Can not be left blank)
Area (Can not be left blank)
Key (Can not be left blank)
Password (Can not be left blank)

Why is that while the form doesn't contain these fields???
damn

Regards,
Shardon

Quote Reply
Re: Password MOD Help !!! In reply to
I mentioned something. If I make modify_first.shtml a standalone file and run it from the browser, it works perfectly. But, now is not attached to the links and I don't know if this should solve the problem. That means the problem is that because it's running from the modify.cgi script causes all that stuff??

Regards,
Shardon


Quote Reply
Re: Password MOD Help !!! In reply to
Believe it or not we are getting somewhere. You are now getting the correct error messages so one fault is fixed.

I take it you can now click on 'Modify', enter an ID and password, click on 'submit' and get the modify.html form presented? If so you have cleared another fault and your last problem is down to the form in modify.html

If not then the error is in the modify_first.html line saying <INPUT TYPE="submit" NAME="Submit" VALUE="Send">... Change NAME="Submit" to NAME="Modify" and see what happens.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
Actually, now everything works ok, but the problem now is that if i submit the final form, i am getting the login page again instead of the modify_success.html
Why?

Quote Reply
Re: Password MOD Help !!! In reply to
It is all ok now...

Thank you very much for spending your time for me

Regards,
Shardon

Quote Reply
Re: Password MOD Help !!! In reply to
Shardon

In Reply To:
Actually, now everything works ok, but the problem now is that if i submit the final form, i am getting the login page again instead of the modify_success.html
Why?
Could you tell me how did you fix the above problem? I am having the same problem.


Regards,

Pagla

Quote Reply
Re: Password MOD Help !!! In reply to
Actually there was a stupid error for that one with me. I was using the same html as the add page and i forgot the add.cgi in the form action. Anyway, i think all the problems were encountered because of field name problems and submit names errors....

Regards,
Shardon

Quote Reply
Re: Password MOD Help !!! In reply to
Glad to see that everything has worked out.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
I am still having the same problem. After submitting final modification I got modify_error.html page instead of modify_success.html.

Regards,
Pagla

Quote Reply
Re: Password MOD Help !!! In reply to
Hi Pagla

What error messages are you getting?

If you tell me the URL of your links home page I think we could sort this out a little faster.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
Hi george_b,

Thank you for asking. I found the problem. It was a very silly mistake. I added lots of in my database and one of them is City State.

In my modify.html I had <INPUT NAME="City State" VALUE="<%CityState%>" SIZE="40"> and the correct one should be <INPUT NAME="CityState" VALUE="<%CityState%>" SIZE="40"> according to my links.def

Thanks again for your concern.


Regards,
Pagla

Quote Reply
Re: Password MOD Help !!! In reply to
Hi Pagla

Nice to see things working out.

George E.D. Burville
Ed: www.appbe.com
Quote Reply
Re: Password MOD Help !!! In reply to
So, everyone is happy with this thread :))

Seeya folks

Regards,
Shardon

Quote Reply
Re: Password MOD Help !!! In reply to
 
Yup!

Thank you both.

Regards,
Pagla