Regular Expression

2002-12-10 Thread Wagner
Hello,

I have this regular expression:

$List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/;

It checks for a string like this: number*word/number*word

But it only accept integer number...

Does anybody knows how to change it to accept decimal numbers like 0.1???

Thanks,
Wagner Garcia Campagner

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RES: Regular Expression

2002-12-10 Thread Wagner
Hi Joel,

Ok... it is working just as i want...

No problem if the number is 1.8.6.5.4.3

Thanks,
Wagner Garcia Campagner


-Mensagem original-
De: Joel Hughes [mailto:[EMAIL PROTECTED]]
Enviada em: terça-feira, 10 de dezembro de 2002 12:21
Para: 'perl cgi'
Assunto: RE: Regular Expression


Hi Wagner,
This should do the trick...
$List =~ /^(?:([\d|\.]+)\*)?(\w+)\/(?:([\d|\.]+)\*)?(\w+)$/;

Basically looks like you need a character class to accept a '.' as well.

(However, this reg exp looks like it will let thru 100.0.0.1 is a
number!)


Joel


-Original Message-
From: Wagner [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 16:03
To: 'perl cgi'
Subject: Regular Expression


Hello,

I have this regular expression:

$List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/;

It checks for a string like this: number*word/number*word

But it only accept integer number...

Does anybody knows how to change it to accept decimal numbers like
0.1???

Thanks,
Wagner Garcia Campagner

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.408 / Virus Database: 230 - Release Date: 24/10/2002


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.408 / Virus Database: 230 - Release Date: 24/10/2002



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




editing script

2001-09-13 Thread Wagner

Hello,

I'm editing a script that produces a .png image, i want it to turn it into a
.html doc.

My first doubt is that i can't put the image in the html doc. The image is
stored in $im and i don't know how to put it in the doc.

ex:
print "Content-type text/html\n\n";
print ";

I'm also trying to put this image in a file this way:

$file = 'c:\image.png';
open (INFO, ">$file");
print INFO "$im->png";
close (INFO);

But it doesn't work...

The second doubt is how can i put the content of a variable in the doc. For
example, if i have a valiable:

$file = 'c:\dir\asdf.asd',

Then i try to put in the doc this way:

print "$file";

But when i run it apears $file in the .html doc and i wanted to see
c:\dir\asdf.asd

Thanks in advance,
Wagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: editing script

2001-09-13 Thread Wagner

Hi Gunther;

I've tryed to save the picture in the file but it didn't work.

The script is going as an attachment for you to take a look. My
modifications are in the end of the file.

Thank for your help in advance,
Wagner

-Original Message-
From: Gunther Birznieks [mailto:[EMAIL PROTECTED]]
Sent: quinta-feira, 13 de setembro de 2001 10:26
To: Wagner; [EMAIL PROTECTED]
Subject: Re: editing script


At 08:44 AM 9/13/2001 -0300, Wagner wrote:
>Hello,
>
>I'm editing a script that produces a .png image, i want it to turn it into
a
>.html doc.
>
>My first doubt is that i can't put the image in the html doc. The image is
>stored in $im and i don't know how to put it in the doc.
>
>ex:
>print "Content-type text/html\n\n";
>print ";

Not unless $im is a URL and even then you may want to consider quoting it.
You can't just dump binary data inside an HTML document. So $im must be a
URL not the binary data of an image.

>I'm also trying to put this image in a file this way:
>
>$file = 'c:\image.png';
>open (INFO, ">$file");
>print INFO "$im->png";
>close (INFO);
>
>But it doesn't work...

It's possible that you want to turn binmode on INFO...

binmode(INFO) before printing a binary image to it.

>The second doubt is how can i put the content of a variable in the doc. For
>example, if i have a valiable:
>
>$file = 'c:\dir\asdf.asd',
>
>Then i try to put in the doc this way:
>
>print "$file";
>
>But when i run it apears $file in the .html doc and i wanted to see
>c:\dir\asdf.asd

$file should interpolate fine if you truly did use double-quotes in your
print statement, but I think it is possible that you should cut and paste
exactly what you used because you seem a bit confused, and I am afraid that
it's possible that you're information is not relayed exactly as you say you
typed your tests out.


 gb.pl

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


FW: formating variables

2001-09-18 Thread Wagner

Hi:

i've got a simple question:

I have a variable $var and its value is 345.678975 (for example).
How can i format $var to became 345.67 only two digits after the
point...

Another question... my script is generating a html document and i want to
put the following text: US$
How can i put the $ symbol? The script interpert it as a variable and i just
want the caracter...

Thanks in advance,
Wagner.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




aanother simple question

2001-09-20 Thread Wagner

Hi,

I have another simple question:
In my script i have a variable $host that is a string... I'm trying to do a
conditional like this:

if ($host == 'access_1') {
  $host1 = 'ACESSO 1' ;}
elsif ($host == 'access_2') {
  $host1 = 'ACESSO 2' ;}

The problem is that $host1 aways get the first valur (ACCESSO 1) even if its
value is access_2...

I may be doing some mistake in the if line

Thanks,
Wagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




redirection with perl

2001-09-26 Thread Wagner

Hi,

I want to do a redirection based on a variable

for example:

if ($name eq 'invader') {

redirection to some URL ;

}

What do i have to put in the middle line to do the redirection...

In javascript i would put: location.href=url

but in perl i don't know what to put...

Thanks in advance
Wagner.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Boolean operators...

2001-09-28 Thread Wagner

Hi,

I'm trying to do a comparisson with boolean operators and it is not
working...

Example:
$user1
$user2
$password1
$password2 (this are the variables)...

The comparisson:

if (( $user1 ne "myself" || $password1 ne "pass1") && ( $user2 ne "yourself"
|| $password2 ne "pass2")) {

print "dfdfsafsa";

}

it is not working is these boolean operators right???

Thanks in advance,
Wagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: security in perl

2001-10-11 Thread Wagner Garcia Campagner

Hi,

Thanks everybody for the help...

I think I have the solution...

This site doesn't need so much security so I'm not worryed if someone is
using a sniffer...

I just don't want everyone to do "view source" and see the password in plain
text so i'm going to use md5 or sha-1 to solve it.

Thank again,
Wagner.

-Original Message-
From: Brent Michalski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 11, 2001 1:22 PM
To: Wagner Garcia Campagner
Cc: [EMAIL PROTECTED]
Subject: Re: security in perl



Please forgive the formatting of this message, I am using Lotus Notes (nuff
said)...

First off, this is NOT a "Perl security issue".  It doesn't matter what
language you do this in, the results would be the same...

Now, if you want to pass a username and password securely, you'll want to
use SSL as well as any other methods you may choose.  If you do not use
SSL, your username and password are sent, unencrypted, to the website.
This may not be a worry for you depending on what the site is.

So, how do you send the information, so that someone can't just view the
source and see it?  Well, one way would be to send the information in a
cookie.  By using a cookie, your typical, average, user will not know how
to find it.  If you want to "100%" (really no such thing) securely send
username and password information, you are going to have to get into
certificates and such...


In mine & Kevin Meltzer's book, "Writing CGI Applications with Perl", we
spend quite a bit of time on security and all of the code examples use the
-T (taint) method to prevent you from inadvertently leaving holes open...


Hope this helps,

Brent







"Wagner Garcia
Campagner" To: <[EMAIL PROTECTED]>
 Subject: security in perl

10/10/01 10:04
AM






Hi,

I have three web pages, for example: login.html, page1.pl and page2.pl...

In the first page i send the username and the password to the page1.pl
through FORM POST METHOD:







USER:

PASSWORD:








So i get this in page1.pl as follos:


$name = param('username');
$pass = param('passwd');

if (($name eq 'gest') && ($pass eq 'password'))

Only if user=guest and pass=password the page is displayed otherwise it is
redirected to another page...

Now what i want to do is send this username and password to the
page2.html...

I'm doing like this:







The problem is when i do "view source" on the page1.pl I can see the
username and the password in plain text


Is there a way for me to pass this information to page2.pl without everyone
see it when "view source" is used???


Thanks in advance and forgive me for this long text,


Wagner.


 --
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Auto Submit

2001-10-16 Thread Wagner Garcia Campagner

Hi,

I have a weird question and i don't know if it is possible to be done,
but... let's try.

I have a login page and then i send the user and the password to another
script that analyse this information.

What i want to do in this script is the following:

If the user is not user1 or user2 i will open again the login page but i
want to post a parameter to this login page telling the user that it is
his/her second try.

For example (this is the second script):

If (($user ne 'user1') || ($user ne 'user2')) {
$try = 2;

#THIS IS THE WAY THAT I AM DOING BUT I DON'T WANT THE USER TO CLICK
#ON THE SUBMIT BUTTON WHEN IT HAPPENS, I WANT IT TO AUTO SUBMIT...

print "Content-type:text/html\n\n";
print <



EndOfHTML
}

Thanks again,
Wagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




variables using blank spaces

2001-12-04 Thread Wagner Garcia Campagner

Hi,

I have a varilable:

$var = 'asdf asdf asdf';   #using blank spaces

Then i send it to another script like this:



The problem is when i get it back the value became:

$var = asdf

It stops in the first blank space is there a way for me to recover all
the variable??

Thanks in advance,
Wagner Garcia Campagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: encrypt Pass

2001-12-06 Thread Wagner Garcia Campagner

Hi Christo,

you can use MD5 or Sha-1

read the documentation on the topic: Digest

Thanks,
Wagner.

-Original Message-
From: Christo Rademeyer [mailto:[EMAIL PROTECTED]]
Sent: quinta-feira, 6 de dezembro de 2001 13:04
To: [EMAIL PROTECTED]
Subject: encrypt Pass


Hi how must I go to encrypt my passwd on my adduser I wrote?
Thanx
Christo

PS! is it make salt or something like that ?
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




problems with gd.pm

2001-12-12 Thread Wagner Garcia Campagner

Hi,

I'm trying to compile a script that is using gd.pm.

But it seems that this library is not installed in my activestate version
(5.6.1.629).

Is there a way for me to use this script with this version of activestate or
use another library?

Thanks in advance,
Wagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




auto-submit question again....

2001-12-13 Thread Wagner Garcia Campagner

Hi,

I've got another question about auto-submit a form.

For example:

I have a script that dysplay a radio button with names of diferent scripts
on my server...
(script1.pl; script2.pl; script3.pl,..)

When a user selects a script and click on the submit button i would like to
redirect to the selected script but sending some variables too i can't
do that i'm thinking about it for days and can't find a solution.

Thanks in advance,
Wagner Garcia Campagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Script expiring

2001-12-21 Thread Wagner Garcia Campagner

Hi,

I have a scheduled task that generate a script each 10 minutes

The problem is the following:

When i access this script via browser it is ok... but when the task runs, it
apear in the screen that the script produced no output... So i have to
reload it... is there a way to avoid it???

Thanks in advance,
Wagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




formating variables again...

2001-10-01 Thread Wagner Garcia Campagner

Hi,

I have a variable $var = 34.5678

If I

printf ("%.2f", $var);

Then $var = 34.56

Is there a way for me to format $var to became 34,56 instead of 34.56 ???

Thanks,
Wagner.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




formating variables again...

2001-10-01 Thread Wagner Garcia Campagner

Hi,

I have a variable $var = 34.5678

If I

printf ("%.2f", $var);

Then $var = 34.56

Is there a way for me to format $var to became 34,56 instead of 34.56 ???

Thanks,
Wagner.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




End of File

2001-11-08 Thread Wagner Garcia Campagner

Hi,

I don't know how to tell perl EOF, i am doing a search in a file like this:


$username eq 'wagner';
$file = 'c:\file';

open(INFO, $file);
do
{
$lines = ;
chop $lines;
}
while ($lines !~/$username/);
close(INFO);


The problem is if the file doesn't have a line with the word "wagner" it
become a infinte looping

The while statement should be:

while (($linhas !~/$username/) || EOF);

But how is the correct sintax for EOF?

Thanks in advance,
Wagner Garcia Campagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Remove a specific line from a file

2001-11-14 Thread Wagner Garcia Campagner

Hi,

how can i remove a specific line from a txt file

the file is list of users this way:

user1
user2
user3
..
..
..
userN

In my script i have the following:

$remove eq 'user3';  (for example)

so how can i tell perl to remove the third line of this file

Thanks in advance,
Wagner Garcia Campagner

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




testing for special caracters...

2001-11-19 Thread Wagner Garcia Campagner

Hi,

I'm trying to test a variable for special caracters... but i'm not having
success...

I'm doing:

if ($var =~ \w) {

..

}

But it doesn't work.

Thanks in advance,
Wagner Garcia Campagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




file permissions

2001-11-20 Thread Wagner Garcia Campagner

Hi,

I'm trying to copy a file to another preserving the file permissions (i'm
using NT 4.0).

I'm using use File::Copy;

But when i copy a file to another the new file do not get the same
permissions as the old one...

I'm also trying to use syscopy ($file1, $file2);

but i got no success...

Thanks in advance,
Wagner Garcia Campagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




file permissions

2001-11-22 Thread Wagner Garcia Campagner

Hi,

I'm trying to copy a file to another preserving the file permissions (i'm
using NT 4.0).

I'm using File::Copy;

But when i copy a file to another the new file do not get the same
permissions as the old one...

I'm also trying to use syscopy ($file1, $file2);

but i got no success...

Thanks in advance,
Wagner Garcia Campagner


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




deleting a file

2001-11-23 Thread Wagner Garcia Campagner

Hi,

Sorry for the stupid question, but i didn't find in the FAQ.

What is the sintax to delete a file???

Thanks in advance,
Wagner Garcia Campagner

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




security in perl

2001-10-10 Thread Wagner Garcia Campagner



Hi,I have three web pages, for example: login.html, 
page1.pl and page2.pl...In the first page i send the username and the 
password to the page1.pl through FORM POST METHOD:USER:PASSWORD:So 
i get this in page1.pl as follos:$name = param('username');$pass = param('passwd');if 
(($name eq 'gest') && ($pass eq 'password'))Only if 
user=guest and pass=password the page is displayed otherwise it is 
redirected to another page...Now what i want to do is send this username 
and password to the page2.html...I'm doing like this:
The problem is when i do "view source" on the page1.pl I can see the 
username and the password in plain text
Is there a way for me to pass this information to 
page2.pl without everyone see it when "view source" is used???
Thanks in advance and forgive me for this long 
text,
Wagner.
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]