Gossamer Forum
Quote Reply
edit user
hello

I get an signup_edit script from garfac (http://www.bcdb.com) and it works fine in 2.03
in 2.04 nothing works.

Who can help me, the edit user profile is for me an essential tool.

here is the source code written by Garfac.

-----------------------------------------------------------

#!/usr/bin/perl
# ==================================================================
# Links SQL - enhanced directory management system
#
# Website : http://gossamer-threads.com/
# Support : http://gossamer-threads.com/scripts/support/
# Revision : $Id: user.cgi,v 1.20 2000/12/22 23:24:29 dave Exp $
#
# Copyright (c) 2000 Gossamer Threads Inc. All Rights Reserved.
# Redistribution in part or in whole strictly prohibited. Please
# see LICENSE file for full details.
# ==================================================================

use strict;
use lib '/opt/guide/www.ridesworld.com/cgi-bin/ridesworld/admin';
use Links::Authenticate;
use Links qw/$IN $DB $CFG $USER/;
use Links::Build;
use Links::SiteHTML;

main();

sub main {
# --------------------------------------------------------------
# Wrap in a subroutine to prevent possible mod_perl probs.
my $page = $IN->param('g') || '';
$IN->param('d' => 1);
$page =~ s,^/*,,g;
$page =~ s,/*$,,g;

# Figure Out what the heck to do....
CASE: {
($page =~ 'Edit') and do { generate_edit_page (); last CASE; };
($page =~ 'Postit') and do { generate_success_page (); last CASE; };
($page =~ m,^\s*$,) and do { generate_home_page (); last CASE; };

};
}

sub generate_edit_page {
# --------------------------------------------------------
# Generate the Edit User Profile Page

print $IN->header();
my $user_name = $IN->param('Username');
my $user_db = $DB->table('Users');
my $sth;

if (!$user_name) {
$user_name eq "No User Logged In";
print $IN->header();
print Links::SiteHTML::display ('login', { error => Links::language('USER_BADLOGIN'), Username => $user_name });
return;
}

my $sth = $user_db->get ($user_name, 'HASH');

my $username = $sth->{'Username'};
my $email = $sth->{'Email'};
my $location = $sth->{'Location'};
my $occupation = $sth->{'Occupation'};
my $website = $sth->{'Website'};
my $status = $sth->{'Status'};
my $e_visible = $sth->{'E_Visible'};
my $join_date = $sth->{'Date'};
my $rm = $sth->{'ReceiveMail'};

# Make sure it is not a GEEK getting in under the radar!

if ($status eq 'Not Validated') {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('USER_NOTVAL') });
return;
}

if ($website eq 'http://') {
$website = '';
}
print Links::SiteHTML::display ('edit_profile', { username => $username, email => $email, location => $location, occupation => $occupation, website => $website, e_visible => $e_visible, join_date => $join_date, rm => $rm } );
}

sub generate_success_page {
# --------------------------------------------------------
# Logs a user in, and creates a session ID.
# lower case is field from form, Upper is previous/from DB

print $IN->header();
my $username = $IN->param('username');
my $password = $IN->param('password');
my $password1 = $IN->param('password1');
my $password2 = $IN->param('password2');
my $e_visible = $IN->param('e_visible');
my $location = $IN->param('location');
my $occupation = $IN->param('occupation');
my $website = $IN->param('website');
my $rm = $IN->param('rm');
my $user_db = $DB->table('Users');
my $sth;


if (!$username) {
$username eq "No User Logged In";
print $IN->header();
print Links::SiteHTML::display ('login', { error => Links::language('USER_BADLOGIN'), Username => $username });
return;
}
my $sth = $user_db->get ($username, 'HASH');

if (!$sth) {
$username eq "No User Registered";
print $IN->header();
print Links::SiteHTML::display ('login', { error => Links::language('USER_BADLOGIN'), Username => $username });
return;
}

my $Username = $sth->{'Username'};
my $Password = $sth->{'Password'};
my $Status = $sth->{'Status'};

# Make sure it is not a GEEK getting in under the radar!
if ($Status eq 'Not Validated') {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('USER_NOTVAL') });
return;
}

# Compare Passwords, make sure the Geek is real.
if ($password ne $Password) {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('USER_NOPASS') });
return;
}

# See if we are updating Passwords, since we are doing password sorts of thangs...
if ($password1) {
if ($password1 ne $password2) {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('USER_NOPASSMATCH') });
return;
}
else {
$password = $password1;
}
}

# Remove HTML tags from the Entry

$password =~ s/>/>/g;
$password =~ s/</</g;
$location =~ s/>/>/g;
$location =~ s/</</g;
$occupation =~ s/>/>/g;
$occupation =~ s/</</g;
$website =~ s/>/>/g;
$website =~ s/</</g;

# What the hey, if they are this far, lets write the [bleep!] into our db!
$user_db->update ( { Password => $password,
ReceiveMail => $rm,
Location => $location,
Occupation => $occupation,
Website => $website,
E_Visible => $e_visible
}, { Username => $Username }) or die "Can't Update: $GT::SQL::error";

print Links::SiteHTML::display ('profile_success', { username => $Username } );
}

sub generate_home_page {
# --------------------------------------------------------
# Display the home page.
#
print $IN->header();
print Links::Build::build('home', {} );
}

1;



Quote Reply
Re: edit user In reply to
the problem I have is blank pages.

The SiteHTML en Build modules are rewrites in linksSQLK 2.04
But How can I solve this problem,
any suggestions??? It's very urgent.