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).]
Subject Author Views Date
Thread Password Modify mod - Done tmoretti 6137 Dec 23, 1999, 7:07 PM
Post Re: Password Modify mod - Done
Ground Zero 6049 Dec 23, 1999, 7:18 PM
Post Re: Password Modify mod - Done
tmoretti 6069 Dec 23, 1999, 7:49 PM
Post Re: Password Modify mod - Done
Robert 6061 Dec 25, 1999, 5:33 PM
Post Re: Password Modify mod - Done
Robert 6075 Dec 25, 1999, 5:36 PM
Post Re: Password Modify mod - Done
tmoretti 6049 Dec 25, 1999, 5:37 PM
Post Re: Password Modify mod - Done
tmoretti 6042 Dec 25, 1999, 5:41 PM
Post Re: Password Modify mod - Done
Robert 6037 Dec 25, 1999, 5:55 PM
Post Re: Password Modify mod - Done
tmoretti 6054 Dec 25, 1999, 6:36 PM
Post Re: Password Modify mod - Done
Robert 6064 Dec 25, 1999, 6:39 PM
Post Re: Password Modify mod - Done
Robert 6051 Dec 25, 1999, 7:01 PM
Post Re: Password Modify mod - Done
tmoretti 6055 Dec 26, 1999, 3:13 AM
Post Re: Password Modify mod - Done
Robert 6072 Dec 26, 1999, 5:53 AM
Post Re: Password Modify mod - Done
widgetz 6045 Dec 29, 1999, 12:03 PM
Post Re: Password Modify mod - Done
Robert 6040 Jan 2, 2000, 2:05 PM
Post Re: Password Modify mod - Done
Alex404 6073 Jan 11, 2000, 3:42 AM
Post Re: Password Modify mod - Done
Fortune 6060 Jan 11, 2000, 4:28 AM