Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Password Modify mod - Done

Quote Reply
Password Modify mod - Done
Hi there. About a month ago, I made this mod to my site. I decided to wait to release it just to make sure it was compatible with Links SQL 1.1. Here is some instructions:

First of all, you need to have a field in your database with the name Password, that contains the password for the link.

Then, in your modify.cgi you should change your sub main with this one:
Code:
sub main {
# ---------------------------------------------------
# Determine what to do.
#
my $in = new CGI;
my $dynamic = $in->param('d') ? $in : undef;
%in = %{&cgi_to_hash($in)};
print $in->header('text/html');

if ($in->param('modify')) {
&process_form ($in, $dynamic);
}
else {
if ($in->param('SiteID') =~ /^\d+$/) {
my $db = new Links: BSQL $LINKS{admin_root_path} . "/defs/Links.def";
my $rec = $db->get_record ($in->param('SiteID'), 'HASH');

$rec or &site_html_modify_first ( { erro => "ID Unknow", SiteID => $in->param('SiteID'), Password => $in->param('Password') } ) and return;

if ($rec->{'ID'} eq $in->param('SiteID')) {
if ($rec->{'Password'} eq $in->param('Password')) {
my ($name, $category);
my $id = $rec->{'CategoryID'};
# If we don't have an id, and can't generate a list, let's send the user a message.
if (! $id and ! $LINKS{db_gen_category_list}) {
&site_html_error ( { error => "Please first go to the category that you want the listing to be in and click from there." }, $dynamic);
}
else {
if ($id) {
$name = &get_category_name ($id);
$name ?
($category = "$name <input type=hidden name='CategoryID' value='$id'>") :
($category = &get_category_list ());
$category = &get_category_list ($id);
}
else { $category = &get_category_list (); }
&site_html_modify_form ( { %$rec, Category => $category, %in }, $dynamic);
}
&site_html_modify_form ( $rec, { Category => $category } ) and return;
}
else {
&site_html_modify_first ( { erro => "Wrong password", SiteID => $in->param('SiteID'), Password => $in->param('Password') } );
}
}
else {
&site_html_modify_first ( { erro => "ID Unknow", SiteID => $in->param('SiteID'), Password => $in->param('Password') } );
}
}
else {
&site_html_modify_first ( { SiteID => '', Password => ''} );
}
}
}
# ==============================================================

The next step, is to modify your templates.
You need and template called modify_first.html. You can use this code:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>

<head>
<title><%site_title%>: Modify a Resource</title>
<link rel=stylesheet href="<%css%>" type="text/css" title="style sheet">
</head>
<body>

<h1><%site_title%>: Modify a Resource</h1>

<%include header.txt%>

<form action="<%db_cgi_url%>/modify.cgi" method="POST">
<p>Before anything, you should provide us your ID and Password:</p>
<%if erro%>
<p>There was an error: <font color="red"><%erro%></font></p>
<%endif%>
<div class="margin">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td align="right" valign="top">ID:</td>
<td><input name="SiteID" value="<%SiteID%>" size="50"></td></tr>
<tr><td align="right" valign="top">Password:</td>
<td><input name="Password" value="<%Password%>" size="50"></td></tr>
<tr><td></td><td><input type="SUBMIT" name="modify" value="Modify Resource"></td></tr>
</table>
</div>
</form>

<%include footer.txt%>
</body>
</html>

Well, then you need to edit modify.html template, to show the site info. To do this, open your file, and where you find the form html code, you should modify where is value="" to value="<%Field%>" changing Field to the field it correspond.

Well, I know this is an ugly explanation, but if something dont work, or you dont get it, please tell me.

Also, you may add, if you want, the codes to show the user his/her password, in the email, and the other things. Also you should add and option to the user in the add*.html templates. So he/she can guive a password to the system.

Again, if you dont understand something, ask me, than I will guive more details.

See ya!

[This message has been edited by tmoretti (edited December 23, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
You rock! Smile

I'm going to try to install this tonight. Thanks again.

Happy Holidays!

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Password Modify mod - Done In reply to
if you have any problem installing it, please tell me, i havend tested my instructions...
Quote Reply
Re: Password Modify mod - Done In reply to
I will try your mod now and hope i wont have anything to ask :-)

BTW: May you tell me, how you get a single var from the db? If i could get the ID and the password; i could rewrite the mailing-mod, cause people always forget their data, so i want to email it them like in my 2.0 before.

Robert

PS: Another ugly thing in this board is the UBB-Code; still now i have got how to write
new Links: BSQL, but i never know if something else is wrong in a posted code.

[This message has been edited by Robert (edited December 25, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
Im afraid you have forgotten the sub:

&site_html_modify_first ...

Robert
Quote Reply
Re: Password Modify mod - Done In reply to
Well, I have already made a script to send the user password and ID, if you want it, please email me!
Quote Reply
Re: Password Modify mod - Done In reply to
Yes I forgot to sat that. So:
In HTML_Templates.pm add the following code:

Code:
sub site_html_modify_first {
# --------------------------------------------------------
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('modify_first.html', {
num => int (rand (10000)),
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}

And also add &site_html_modify_first to @EXPORT at the top!

Cheers
Quote Reply
Re: Password Modify mod - Done In reply to
See full instructions for the mod at
www.adeva.de/links.htm

Robert

[This message has been edited by Robert (edited December 26, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
The num => ... i use for my banners, so, its useless for most of you!!!

Thats it!
Quote Reply
Re: Password Modify mod - Done In reply to
:-)

[This message has been edited by Robert (edited December 26, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
:-(

[This message has been edited by Robert (edited December 26, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
Ok, I will test these days my instructions, and I will come up with a page with all the instructions, and then I publish it here for you!
Quote Reply
Re: Password Modify mod - Done In reply to
:

[This message has been edited by Robert (edited December 26, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
i'd like to show you guys something.. i had wanted to do this in Links 2.0 but since it didn't come with a USER Database.. i would have to make one first .. Smile

anyways..

go to

www.pdamania.com/modify.cgi

it should ask for you to login..

login with

u: jsu7785
p: test

it should bring you back to modify.cgi and this user has one item that he/she can modify..

now.. go to

www.pdamania.com/user.cgi?to=/modify.cgi

and login as

u: pdamania
p: test

this user has 5 things that he/she can modify..

you are required to be logged in when using add.cgi so it tracks down your username and then adds it to the Username field in the database.. Contact Name and Email are unknown cause I am using the contact name and email from the User Database..

so.. what do you think? i also have a delete.cgi all ready.. but i am planning on just mixing into modify.cgi

jerry

[This message has been edited by widgetz (edited December 29, 1999).]
Quote Reply
Re: Password Modify mod - Done In reply to
I have done the password-modify to my links, but dont have a clue how i can get all data (ID and password) to a user, who insert his email to a form.

Have someone (tmoretti said he did it, but dont answer my questions for the mod) an idea how to do?
Quote Reply
Re: Password Modify mod - Done In reply to
Hi Widgetz

Your mod is great! It is solving the problem i was working on.

Could you mail it to me or post it in this forum?

Thanks, Alex
Quote Reply
Re: Password Modify mod - Done In reply to
Hi Alex404,
If you are looking for modify.cgi, it is here:
http://www.gossamer-threads.com/...um9/HTML/000497.html

[This message has been edited by Fortune (edited January 11, 2000).]