freelanceprogrammers.org Forum Index » Perl

Help with password protection adaptation (also about a great


View user's profile Post To page top
altordai Posted: Sun Jul 04, 2004 8:04 am


Joined: 04 Jul 2004

Posts: 1
Help with password protection adaptation (also about a great
Hello,


I am a new user of http://baseportal.com
It`s a free database portal, great features (database limit=4GB,
supports any Perl script, 6 database templates to use).
I can recommend it to anyone who needs a database.
But it has no "helpdesk" type support.

I want to have password protection to my database:
for users to be able to modify and/or delete only their own entries,
and only to read, search, and sort the other entries.

My problem is that I am a beginner in Perl (looked around just to put
up a database, and that`s how I found unexpectedly "baseportal).
I can not implement the solution given there (in the "Library"
section at "baseportal.com") for the "Password protection".
The problem is when I want to adapt it... because for that I assume
you must know Perl...

Here is the address of my trial database:

http://baseportal.com/cgi-bin/baseportal.pl?htx=/wnct/main

(Search can be done after 6 variables, and sorting can be done after
6 variables too)

Here is the script I used for my trial database (I constructed it
upon a template given in baseportal.com):

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

<do action=all

localparams=+

db=main

range^=0,25

searchfields=Id,Country,Region,Location,DOB/G,Nr

listfields=Id,Country,Region,Location,DOB/G,Nr,Occupation

allfields=Id,Country,Region,Location,First Name,WNC
ID,DOB/G,Nr,Occupation,Email,Website ,Date

formfields=Country,Region,Location,First Name,WNC
ID,DOB/G,Nr,Occupation,Email,Website ,Date,Password

showsort=Id,Country,Region,Location,DOB/G,Nr

showamount=all

selectbrowse=top
buttonbrowse=top
pagebrowse=top
indexbrowse=top

convert_html=Password

border=1 spacing=1 padding=2
gridcolor=912400

datasize=2
datacolor=000000
databack=F0F0F0
databack2=E0E0E0
dataalign=middle

headface=Arial headsize=2 headcolor=DA2400 headback=FFDADA
headalign=middle

textface=Arial textsize=2
textcolor=000000 listtype=list

language=en

detail=linktop

search=linktop

input=linktop>

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

Here is how looks the example given at "baseportal", what I want to
adapt:
http://baseportal.com/baseportal/baseportal/lib/password2/phone_number
s

And here is the script given for it:
------------------------------------------------------------------

<perl>

put if %_put;

if($Id ne "")
{
get "Id==$Id";

if($xName)
{
if($Password eq $xPassword)
{
mod "Id==$Id", ["Name",$xName,"Phone number",$xPhone];
out "<b>Entry modified...</b>";
} else
{
out "<b>Wrong password!</b>";
}
} else
{

out <<EOF;
<h3>Modify Entry</h3>

<table>

<form action="/cgi-bin/baseportal.pl?htx=$htx&Id=$Id" method="post"
enctype="multipart/form-data">

<input type=hidden name="htx=" value="$htx">
<input type=hidden name="Id=" value="$Id">

<tr><td>Name:</td><td><input type="text" name="xName="
value="$Name"></td></tr>

<tr><td>Phone number:</td><td><input type="text" name="xPhone="
value="$_loop{`Phone number`}"></td></tr>

<tr><td>Password:</td><td><input type="password"
name="xPassword="></td></tr>

<tr><td></td><td><input type=submit value="Submit"> </td></tr>
</form></table>

EOF

}

out "<p><a href="$_link">New entry</a>";

} else
{
out "<h3>New entry</h3>";
out "You can modify your entry with the chosen password later on.";

init; get;
list "add";
}

get;

out "<h3>List of all entries</h3>";

out "<table><tr><td>Name</td><td>Phone number</td></tr>";
while(get_next)
{
out "<tr><td><a href="$_link&Id=$_id">$Name</a></td><td>$_loop
{`Phone number`}</td></tr>";
}
out "</table>";


</perl>

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

What I have to change in this example script to adapt it, and what I
have to change in my original code to keep all the initial output and
all the previous functions intact (the searchability and
sortability)?
Plus what I have to introduce to prevent postings instead of text of
pictures and in HTML?
-----------------------------------------------

Thanks for any possible help :)!!!
Alex

PS: or you may suggest another password protection solution...
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help