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

modify.cgi: user modify mod

(Page 2 of 2)
> >
Quote Reply
Re: modify.cgi: user modify mod In reply to
Robert,

You can pick up the files at the following address:

http://jsu7785.hypermart.net/sql/

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: modify.cgi: user modify mod In reply to
Thank you Eliot.
Your help is appreciated.

------------------
Robert Blackstone
Webmaster of Scato Search
www.scato.com
Quote Reply
Re: modify.cgi: user modify mod In reply to
No problem...Robert.

Smile

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: modify.cgi: user modify mod In reply to
Hello,

I have tried this modification, but I can't figure out how to get the system to then forward me to the add or modify template depending on whether the user came from modify.cgi or add.cgi.

It just says you are now logged into the system.

Anyone have an idea? Please help.

------------------
James L. Murray
PaintballCity.com
The Yahoo of Paintball
www.paintballcity.com
AIM: Paintball City







Quote Reply
Re: modify.cgi: user modify mod In reply to
that's what the to stuff was about..

here.. in user.cgi sub login_user

replace...

Code:
print $in->header( -cookie => [$session_cookie, $user_cookie] );
&site_html_login_success ( $user_r, $in );

with

Code:
if ($in->param('to')) {
print $in->redirect( -cookie => [$session_cookie, $user_cookie], -uri => ("$LINKS{build_root_url}" . $in->param('to')) );
}
else {
print $in->header( -cookie => [$session_cookie, $user_cookie] );
&site_html_login_success ( $user_r, $in );
}

then in modify.cgi and add.cgi.. replace

Code:
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$ENV{'SCRIPT_NAME'}") and return;

with

Code:
my $encurl = "$ENV{'SCRIPT_NAME'}?$ENV{'QUERY_STRING'}";
$encurl =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$encurl") and return;

then in login.html.. in the form.. add

Code:
<%if to%>
<input type="hidden" name="to" value="<%to%>">
<%endif%>

jerry

[This message has been edited by widgetz (edited April 22, 2000).]

[This message has been edited by widgetz (edited April 22, 2000).]
Quote Reply
Re: modify.cgi: user modify mod In reply to
Hello Jerry,

I could not find the following code in your add.cgi and modify.cgi files I pulled from your site:
Code:
my $encurl = "$ENV{'SCRIPT_NAME'}?$ENV{'QUERY_STRING'}";
$encurl =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$encurl") and return;

to replace with:
Code:
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$ENV{'SCRIPT_NAME'}?$ENV{'QUERY_STRING}") and return;

Any ideas?

Maybe those filesn your site that AntroRules pointed us to are not the correct files?

------------------
James L. Murray
PaintballCity.com
The Yahoo of Paintball
www.paintballcity.com
AIM: Paintball City


[This message has been edited by Ground Zero (edited April 22, 2000).]
Quote Reply
Re: modify.cgi: user modify mod In reply to
i fixed the instructions..

what i did was i was copying and pasting both replace and with codes and i edited the wrong one..

jerry
Quote Reply
Re: modify.cgi: user modify mod In reply to
Ok...it still doesn't work for some reason. It doesn't forward me to the modify page or the add form.

Check it out at http://www.medinfolinks.com/cgi-local/links/add.cgi

Widgetz, maybe you can forward me your email address so that I can email you my code, if you would be so kind. This mod is really cool and I would love to use it. My email address is info@virtuetech.com

Or even talk to me on AIM at "Paintball City"

Thanks.



------------------
James L. Murray
PaintballCity.com
The Yahoo of Paintball
www.paintballcity.com
AIM: Paintball City







Quote Reply
Re: modify.cgi: user modify mod In reply to
FYI:

If anyone is using this Mod, I had to hack some of the codes widgetz (Jerry Su) provided to make the redirection work properly....

Here is what I did....The username check codes in the sub main routine in both the modify.cgi and add.cgi file should look like the following:

Code:

# Get user information.
my $s = $in->param('s') || $in->cookie('s');
$USER = &authenticate ($s);
if (! defined $USER) {
my $encurl = "$ENV{'SCRIPT_NAME'}";
print $in->redirect("$LINKS{build_user_url}?to=$encurl") and return;
}


2) The else statement in the sub main in the user.cgi file should look like the following:

Code:

else {
print $in->header();
my $username = $in->cookie('Username') || '';
my $to = $in->param('to'); &site_html_login_form ( { Username => $username, to => $to,}, $dynamic);
}


Notice the bolded codes...The to variable has to be defined in order for the parameter to be passed from the add and modify forms.

3) The conditional "to" statements at the end of the sub login_user routine should look like the following:

Code:


if (!$to) {
print $in->header( -cookie => [$session_cookie, $user_cookie] );
my $title_linked = &build_linked_cgi_title ("User Login/Login Success");
&site_html_login_success ({Username => $user, title_linked => $title_linked, {%$user_r}}, $in, $dynamic);
}
else {
print $in->redirect(-cookie => [$session_cookie, $user_cookie], -uri => $to);
}


Notice the uri configuration.

4) Then the following codes do work in the login.html template file:

Code:

<%if to%>
<input type="hidden" name="to" value="<%to%>">
<%endif%>


With these codes, the modify.cgi and add.cgi modifications work. However, there are some other changes I've made to the modify.cgi to make the ID pass from the selection form to the modify form. When I work out all the kinks with the codes, I will post them.

Regards,

Eliot Lee

Quote Reply
Re: modify.cgi: user modify mod In reply to
Okay...I figured out the missing codes in the sub modify that was causing the unblessed param error. I changed the following codes:

Code:

&site_html_modify_form ($rec, $dynamic);


to the following:

Code:

&site_html_modify_form ({%$rec}, $in, $dynamic);


BTW: I have also added the following features in the modify.cgi Mod:

1) If the user only has one Link in the database, then the modify_form pops up without having to select it from the table. If the user has more than one link, then they can select the links from the display screen.

2) I also added radio buttons for the ReceiveMail fields.

Anyway...if you want either of these hacks, let me know...and I will post the codes.

Regards,

Eliot


Quote Reply
Re: modify.cgi: user modify mod In reply to
In Reply To:
# Get user information.
my $s = $in->param('s') || $in->cookie('s');
$USER = &authenticate ($s);
if (! defined $USER) {
my $encurl = "$ENV{'SCRIPT_NAME'}";
print $in->redirect("$LINKS{build_user_url}?to=$encurl") and return;
}
this won't allow for the form input to be inputted when redirecting..

ie: modify.cgi?ID=12&Title=Hello
will return to modify.cgi.. my original would actually return there..



Jerry Su
Quote Reply
Re: modify.cgi: user modify mod In reply to
In Reply To:
&site_html_modify_form ({%$rec}, $in, $dynamic);
umm.. first off.. dynamic is suppose to contain the contents of $in if it is dynamic.. ie : page.cgi..

also.. {%$rec} is the same thing as $rec..

by defining a hash in {} you are creating a hash reference.. $rec is a hash reference.. by putting a % in front of it you are dereferencing the hash reference.. so....... {%$rec} is... first of dereferencing the hash reference $rec and then referencing it again... which is............ stupid..

by putting $in in place of dynamic is obviously going to fix the problem.. but if the page isn't dynamic.. it is not suppose to contain anything..

you should just try and make the...

my $dynamic = $in->param('d') ? $in : undef;

line... to..

my $dynamic = $in->param('d') ? $in : "";

or something.. same meaning..

Jerry Su
Quote Reply
Re: modify.cgi: user modify mod In reply to
Thanks for your feedback, Jerrysu. However, I kept getting unblessed param error using the codes you suggested...so that is why I came up with the solution I posted.

Regards,

Eliot Lee

Quote Reply
Re: modify.cgi: user modify mod In reply to
Not true...It will redirect to the modify form after the user logs in. Using your codes, the user is never redirected to the modify or add forms. They are redirected to the "login success" page...so, the codes I posted allows redirection to the correct script to occur.

Regards,

Eliot Lee

Quote Reply
Spanning Problem In reply to
I have worked out most of the kinks in this modification...really cool, BTW (Jerry). However, I have a problem with the spanning pages. If I click on the page number link, the page reloads with the first set of links. I have looked through the sub toolbar routine and also similar sub calls in other scripts (like search.cgi) and there does not seem to be any syntax errors in the modify.cgi script. However, the spanning results do not work.

Any ideas will be greatly appreciated.

Thanks in advance.

Regards,

Eliot

Quote Reply
Re: Spanning Problem In reply to
argh.. wrong answer.. some other script unrelated..



Jerry Su
Quote Reply
Re: Spanning Problem In reply to
Nice thought, jerry. However, it didn't work. In fact, the script crashed using GET.

Any other ideas will be appreciated.

Thanks.

Regards,

Eliot Lee

Quote Reply
Re: Spanning Problem In reply to
Eliot,

I tried to apply this mod, starting at the top of the file, and going down through the messages, back tracking where possible.

Here are a few things I found that didn't work with your version, probably due to mods you made prior to making these changes:

Code:
$to is undefined..... in the code 'tweaks" you made above, since you
are assigning my $to = $in->param{'to'}; in two places.

.

## the following is one of your routines?
my $title_linked = &build_linked_cgi_title ("User Login/Login Success");


## the following is also one of your local $LINKS tags:
print $in->redirect("$LINKS{build_user_url}?to=$encurl") and return;
If this is a real requested mod, then it would pay for either you or jerry to sit down, and create a new message, with all the steps, that work on a generic links install -- pointing out what needs to be added to make it fancy.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Spanning Problem In reply to
In Reply To:

$to is undefined..... in the code 'tweaks" you made above, since youare assigning my $to = $in->param{'to'}; in two places.


Welp...I had to do that because it is used in both the sub main and sub login_user routines.

In Reply To:

## the following is one of your routines?my $title_linked = &build_linked_cgi_title ("User Login/Login Success");


Thanks for pointing this out...yes, it is a unique sub that I created that is a copy of the sub build_linked_title, but replaces $dir with $ENV{SCRIPT_NAME}. Sorry about that.

In Reply To:

# the following is also one of your local $LINKS tags:print $in->redirect("$LINKS{build_user_url}?to=$encurl") and return;


Right...which is easy to create with editing Links.pm and HTML_Templates.pm.

But my main point of my preceding posts is that the Mod did not work with the "out-of-box" codes that Jerry provided.

But it now works fine for me....Wink

In Reply To:

If this is a real requested mod, then it would pay for either you or jerry to sit down, and create a new message, with all the steps, that work on a generic links install -- pointing out what needs to be added to make it fancy.


Well...depending on the new version features...this Mod may be null and void...but I will keep this Mod in place since I will not be upgrading to Links v.1.2 or whatever the next version is called until it is stable...

Regards,

Eliot Lee

Regards,

Eliot Lee

Quote Reply
Re: Spanning Problem In reply to
I left out a part to the above... I wasn't griping, I can get it to work, I just wanted to point out what I found so that someone trying to install it knows what to look for. This mod, and even the mods to it, is still not an 'out of the script' modification to get working.

I just changed the variables to the standard paths already in links, and just assigned $to back to the $in->param('to') variable.... with 'my', etc.

Remember, "my" scopes the variables per "block" of code, which can be in a loop, in an "if" or subroutine, etc. If you scope 'my $to' inside a code block, you could theoretically define it multiple times in any given subroutine, and definitely multiple times in each source file. If you are going to do that, it would pay to pull it out and define it at the top of each subroutine -- or better yet, at the top of 'main' and then it would be available to each subroutine via scope.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Spanning Problem In reply to
Thanks for the suggestion, pugdog...But I tried that and when I went to login...I got an Unknown Tag: to in the login screen...so, when I added the second defined variable $to, it worked.

Regards,

Eliot Lee

Quote Reply
Re: Spanning Problem In reply to
You've probably done other things to your code.

I'm hacking a fairly unmodified version.

I'm really hoping that I can get the new user functions working with the old code... that would be the best interim functioning during the transition.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Spanning Problem In reply to
Uh...I used the original user.cgi file (and applied the codes from this Thread) and the linked modified modify.cgi script in this Thread and...The script would not work until I added the previously posted codes. Wink

Regards,

Eliot Lee

Quote Reply
Re: Spanning Problem In reply to
first off...

the redirection codes should look like this..

Code:
my $s = $in->param('s') || $in->cookie('s');
$USER = &authenticate ($s);
if (! defined $USER) {
my $encurl = "$ENV{'SCRIPT_NAME'}?$ENV{'QUERY_STRING'}";
$encurl =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%02x",ord($1))/eg;
print $in->redirect("$LINKS{db_cgi_url}/user.cgi?to=$encurl") and return;
}
plus.. the forms use method GET not POST..

and last but not least..

Code:
&site_html_modify_form ($rec, $in, $dynamic);
.... umm.. of course that would work.. but its not suppose to be like that.. if its not dynamic.. $dynamic would be undefined.. so it goes to site_html_modify_form.. where it gets this..

Code:
my $style = defined $dynamic ? $dynamic->param('t') : undef;
which is...

Code:
my $style;
if (defined $dynamic) {
$style = $dynamic->param('t');
}
else {
$style = undef;
}
so if dynamic isn't defined it won't be used.. so obviously it is not a bug.. just something wrong with your copy of the coding.. maybe even your version of perl.. almost every HTML_Templates.pm subroutine uses that.. so its not a bug and your 'fix' is simply just some stupid way (that works) of getting by the problem..

Jerry Su
> >