Re: perl / MySql application overview question

2003-08-14 Thread Wiggins d'Anconia
Hughes, Andrew wrote:
I have a multi-table MySQL database that holds different pieces of
information that will all be displayed on a web page template.  The general
principle is that non web people will be able to populate web pages through
an admin panel.  The data in all of the MqSQL tables will be entered by the
user through forms on the web and bought into a page template using the
unique id for each page.
The user will login with a username and password.  This information will
then be stored in a session using Apachee::Session and a cookie.  The first
form that the user submits will contain general information about the page
itself.  All of this information will be stored in one row in the table and
a unique id will be generated in MySQL for that webpage.  Subsequent forms
will request other information for different areas of that one page.  I plan
on relating all of the information in the rest of the tables to build that
one page back to the specific page based on that page's unique id that was
generated.  I was planning on doing that by somehow getting that generated
unique id into the cookie immediately after it is generated in the MySQL
database.  Then, every time information is added to another table that
relates back to the webpage, I will enter that id from the cookie in the
MySQL insert statement.
Here are my questions:
Is this a proper approach?
If not, what is a better / correct approach?
If it is, how would I go about it? 

I am not asking for someone to do it for me.  I was just wondering if there
were some terms / buzzwords / tutorials that I should follow up on.
This sounds like a common approach and certainly a viable one. In 
general you are talking about precisely what an RDBMS is for and the 
tables you refer to are in general called lookup tables.  In other words 
you store the main record in a master table then you lookup into another 
table based on a unique id from the master.

One item you will want to look into is a join clause. A join clause 
allows you to combine fields from multiple tables in a single select 
statement so that you don't have to do multiple independent selects to 
retrieve the same effect, but that is OT for this forum, but have a look 
at the MySQL documentation for JOIN.

As for retrieving the ID generated by an auto increment in MySQL if you 
are using DBI (which I hope you are) then you can using something like 
the following after an insert:

my $newid = $sth-{'Database'}-{'mysql_insertid'};
unless ($newid) {
   # handle error here
}
Though this may not be portable to other engines, but it saves you the 
pain of having to do multipe statements in an atomic manner (locking), etc.

You will run into other design problems as you go along, and a lot of 
questions, that really can't be avoided without experience, but overall 
your design is fairly sound for some applications and obviously you have 
given it some or a lot of thought before starting, which is usually the 
critical and first mistake made (aka to dive right in).

Good luck,

http://danconia.org

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


Re: Perl line breaks

2003-08-14 Thread Camilo Gonzalez
Yech, what a mess. I think you may need to escape the question mark and 
or dots. In any case, why try to escape such an unwieldy string? Why not 
use a heredoc? Laziness is the mark of a good programmer.

Mike Harrison wrote:

I was trying to find a log file to look at.  I guess half the problem is I
am using a hosting service, and it is on a Microsoft IIS server (Windows
NT-based I think, but definitely not UNIX).  I will have to ask the hosting
admin where I might find a log file...
Here is the part of the perl script that I start printing things to the
browser (see previous message for the html.pm script that contains the
HTML_header and HTML_ender subroutines):
my $header = 'Successful update';
my $msg = h2Your preferences have been updated
successfully.../h2hrbrbrbr;
# Finally, put up a HTML document announcing that the update was successful.
HTML_header($header);
print body\n;
print center\n;
print $msg\n;
print pReturn to the a href=\amtest.pl?uname=$uname\
onMouseover=\window.status='Back to account management'; return true\
onMouseout=\window.status=''; return true\Account Management/a
page/p\n;
print /center\n;
HTML_ender;
Note that I have also tried using print qq| ... | code as well.

I am now getting a CGI error message along the lines of
Cannot find a string terminator '' in ... line ... (the line above starting
with print p... .  I can't find a problem with that line???
Thanks for your help so far guys!  I am losing a bit of sleep on this one :(
Regards,
Mike.
-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 06 August, 2003 2:30 AM
To: Jon Hogue
Cc: Mike Harrison; 'Andrew Brosnan'; [EMAIL PROTECTED]
Subject: Re: Perl line breaks
For troubleshooting a script you can take a look in the server's log file
and you will find there any error.
Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]
- Original Message -
From: Jon Hogue [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]
Cc: Mike Harrison [EMAIL PROTECTED]; 'Andrew Brosnan'
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 4:19 PM
Subject: Re: Perl line breaks


 

...and you don't need to print the HTML header in the BEGIN {} block.
You can just print it at the top of the perl program or in the middle of
   

the
 

program but before anything else is printed.
   

if something is dieing in a module you are loading, you will never know
about it because it will never get to the Content-Type and therefore never
send anything good to your browser. if you use a BEGIN block, you might
catch things that happen in modules you load. i wouldn't recommend doing
that for your normal script, but it is a useful troubleshooting tool.


 



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


Re: Perl line breaks

2003-08-14 Thread Octavian Rasnita
What web server is installed on that computer?
Some web servers need to use non parsed header scripts (NPH) and I heard
that this is the case with MS IIS if this is the web server.

The line break is not very important for perl scripts under Windows. I use
only the Unix end of line (lf) under Windows for my perl scripts and they
work fine.
I don't know if they would be working the same if I will be using Mac end of
lines, but with Unix end of line they work fine.

I guess you should send that script to the list...

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Mike Harrison [EMAIL PROTECTED]
To: 'Andrew Brosnan' [EMAIL PROTECTED]; Mike Harrison
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 3:07 AM
Subject: RE: Perl line breaks


Hi Andrew,

1. Yes, I am using the same headers as the perl program that works, so don't
think it is that - I will check that there is a blank line between the
'Content-Type:...' line and the next.

2. My first line in the perl program is: #!perl -w (being a Windows-based
server, it doesn't require the full path.  The -w to warn of errors/mistakes
etc.)

I will need to wait till tonight before sending some of the perl program and
header info...

Cheers,
Mike.


-Original Message-
From: Andrew Brosnan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 05 August, 2003 10:03 AM
To: Mike Harrison
Cc: [EMAIL PROTECTED]
Subject: Re: Perl line breaks


On 8/5/03 at 9:32 AM, [EMAIL PROTECTED] (Mike Harrison)
wrote:

 Hello all,

 Well, I have spent the last few nights messing around trying to work
 out why one of my PERL programs doesn't work.

s/Perl/PERL/

 With one program, I am getting an error message as follows:

 CGI Error The specified CGI application misbehaved by not returning a
 complete set of HTTP headers. The headers it did return are:

How are you creating your headers? Perhaps you could show that here.


 My question is:  Are line breaks important with PERL programs

With headers they are:
print Content-Type: text/html\n\n #-- blank line required

 does anybody know why I am getting this error?

Maybe Perl does. Did you ask?:
use warnings;



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



Re: Flock and Sleep

2003-08-14 Thread Oliver Schnarchendorf
On Fri, 8 Aug 2003 02:32:05 +0500, Sara wrote:
 open(NUMBER,data.txt);
 flock (NUMBER, 2);
 close (NUMBER);
 closing a file automatically removes the lock??
The answer is yes. When you close files they will automatically 
un-locked.

One thing though, you might want to use the fcntl module which imports 
the following flock constants:

# Importing flock constants:
# (LOCK_SH, LOCK_EX, LOCK_NB and LOCK_UN)
use fcntl ':flock'; 

 My second question is how I can delay the execution of a script (If 
 two users trying to execute the same script) for 30 sec by using 
 sleep function? and If I implement sleep function in my script . 
 Do I really need to use 'flock' in my script or there is no need then.
It depends in which environment you want to run your script. If it only 
needs to run in the *nix world you might want your script to:

(a) check for a file (-e)
(b) if file doesn't exist, create it and write the scripts PID 
(getpid() or $$ or $PID or $PROCESS_ID) into it
(c) if the file is found read the PID and ping the PID for existance 
(sending a signal with kill()) [*]
(d) if PID exists you will wait 30 seconds (sleep()) and go back to 
(c) or wait for the other script to finish (waitpid()).
(e) once your script gets the ok from (a) or (d) you can goto (b).

If you are interested in another solution which will die () if the same 
script is already running, just ping me by email.

thanks
/oliver

[*] You might want to install a signal handler in your script that will 
ignore the send signal though. E.g.:

local $SIG{INT} = 'IGNORE';


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



Re: Regex and Email address.

2003-08-14 Thread Wiggins d'Anconia
Would be interesting to see which is faster, there is that whole regex 
engine thing. Of course to say that there are no letters isn't strictly 
fair because you would need two lines of comments stating what you are 
doing ;-)... depending on the context...

http://danconia.org

Hall, Scott wrote:
Regexes are always more fun :)  How else can you write a program with almost
no letters.
$email =~ s/(?[EMAIL PROTECTED]).*$/.../;

perldoc perlre

search for 'look-behind'

Scott

-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 10:36 PM
To: Sara
Cc: [EMAIL PROTECTED]
Subject: Re: Regex and Email address.
Sara wrote:

Simple Regex problem

How you will convert 

$email = [EMAIL PROTECTED];

TO

$email = [EMAIL PROTECTED];

using Regex.



Well this isn't necessarily a regex issue, TMTOWTDI,

my $email = '[EMAIL PROTECTED]';
$email = substr($email, 0, (index($email,'@')+2));
print Email: $email...\n;
perldoc -f index
perldoc -f substr
...of course having said that you *can* do it with a regex ;-) 

my $email = '[EMAIL PROTECTED]';
$email =~ s/^([EMAIL PROTECTED]).*/$1/;
print Email: $email...\n;
HTH,

http://danconia.org




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


Re: Perl line breaks

2003-08-14 Thread Octavian Rasnita
It depends how is set the web server to execute the programs that will
process the CGI scripts.
By default Apache is set to need the shebang line and it doesn't use the
registry settings, but this can be changed.

...and you don't need to print the HTML header in the BEGIN {} block.
You can just print it at the top of the perl program or in the middle of the
program but before anything else is printed.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Jonathan Hogue [EMAIL PROTECTED]
To: Mike Harrison [EMAIL PROTECTED]; 'Andrew Brosnan'
[EMAIL PROTECTED]; Mike Harrison [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 4:21 AM
Subject: RE: Perl line breaks



2. My first line in the perl program is: #!perl -w (being a Windows-based
server, it doesn't require the full path.  The -w to warn of
errors/mistakes
etc.)

I think in Windows, -w isn't enough. The #!perl line is ignored in most
windows installations/configurations , and the file association is used
instead.

Therefore, you should do this explicately.
use warnings;

Also, with some webservers doing the following as your first line in the
script will catch almost all errors. (Works in IPlanet, but not Apache. Not
sure about Windows)
BEGIN { print Content-Type: Text/HTML\n\n; }




--
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]



RE: Perl line breaks

2003-08-14 Thread Mike Harrison
I was trying to find a log file to look at.  I guess half the problem is I
am using a hosting service, and it is on a Microsoft IIS server (Windows
NT-based I think, but definitely not UNIX).  I will have to ask the hosting
admin where I might find a log file...

Here is the part of the perl script that I start printing things to the
browser (see previous message for the html.pm script that contains the
HTML_header and HTML_ender subroutines):

my $header = 'Successful update';
my $msg = h2Your preferences have been updated
successfully.../h2hrbrbrbr;

# Finally, put up a HTML document announcing that the update was successful.
HTML_header($header);
print body\n;
print center\n;
print $msg\n;
print pReturn to the a href=\amtest.pl?uname=$uname\
onMouseover=\window.status='Back to account management'; return true\
onMouseout=\window.status=''; return true\Account Management/a
page/p\n;
print /center\n;
HTML_ender;

Note that I have also tried using print qq| ... | code as well.

I am now getting a CGI error message along the lines of
Cannot find a string terminator '' in ... line ... (the line above starting
with print p... .  I can't find a problem with that line???

Thanks for your help so far guys!  I am losing a bit of sleep on this one :(
Regards,
Mike.


-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 06 August, 2003 2:30 AM
To: Jon Hogue
Cc: Mike Harrison; 'Andrew Brosnan'; [EMAIL PROTECTED]
Subject: Re: Perl line breaks


For troubleshooting a script you can take a look in the server's log file
and you will find there any error.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Jon Hogue [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]
Cc: Mike Harrison [EMAIL PROTECTED]; 'Andrew Brosnan'
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 4:19 PM
Subject: Re: Perl line breaks




...and you don't need to print the HTML header in the BEGIN {} block.
You can just print it at the top of the perl program or in the middle of
the
program but before anything else is printed.

if something is dieing in a module you are loading, you will never know
about it because it will never get to the Content-Type and therefore never
send anything good to your browser. if you use a BEGIN block, you might
catch things that happen in modules you load. i wouldn't recommend doing
that for your normal script, but it is a useful troubleshooting tool.





RE: Urgent Question (Deployed code gone wrong!)

2003-08-14 Thread [EMAIL PROTECTED]
good question. here are some sample scripts which should help... 

the first one asks, how many elements are in a list if they are all undef
#!/usr/local/bin/perl
if ( (undef, undef) == 0 ) { print 'it is 0' }

run this, and you'll see that it prints 'it is 0'.

here's a second one that tests what happens when you get data back. it runs
11 times, and keeps going until it gets only undefs
#!/usr/local/bin/perl
my ($count, $thing, $otherthing);
while( ($thing, $otherthing) = foo ) {
$count++;
}
print the loop ran $count times\n;
sub foo {
return ( 1, 2 );
}

change the routine to this. it runs through the loop 0 times
sub foo {
return;
}

what if only 1 element is returned? it still runs 11 times.
sub foo {
return ( 1 );
}

what if 1 element is undef, but the second element is defined? it still
runs 11 times.
sub foo {
return (undef, 1 );
}

therefore, your code should work like you expect. i would still test it in
a test environment before making changes to prod.


Original Message:
-
From: Greenhalgh David [EMAIL PROTECTED]
Date: Mon, 11 Aug 2003 21:13:39 +0100
To: [EMAIL PROTECTED]
Subject: Urgent Question (Deployed code gone wrong!)


A quick question about a while loop.

I have a simple code that searches database for all entries and puts 
one of the fields into a select box on the output page. However, due to 
a mistake in my untaint routine (which I've fixed) if a visitor entered 
their name in Japanese characters, the entry into the data base is 
blank. That means that my simple while loop:

while ($name=$sth-fetchrow_array()) {
print option$name/option;
}

stops when it hits the blank name. I can also select the ID number..

while (($name, $ID)=$sth-fetchrow_array()) {
print .option$name/option;
}



mail2web - Check your email from the web at
http://mail2web.com/ .



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



perl script as binary

2003-08-14 Thread Sven Bentlage
Hi everyone!

I`m looking for a way to compile a perl script into an executable 
binary for a WIN2000 system (no(!) perl installed).

Is there a way to get this working?

Thanks for your help in advance

Sven

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


Selecting using regular expressions

2003-08-14 Thread Octavian Rasnita
Hi all,

I want to select all the content of a table from a file using regular
expressions (and not a module).
Can you give me some hints about how can I do this?

For example I have the following text:

table ...
tr...td.../tdtd.../td/tr
tr...td.../tdtd.../td/tr
trtd table... /table/tdtd.../td/tr
/table

As you see, I could find more other tables included in this table and I
usually don't know how many are they nor at what level they are included.

Thank you for any hints.

Of course, I am not expecting this selection to be possible with a single
regular expression line, but... who knows.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]



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



Re: Urgent Question (Deployed code gone wrong!)

2003-08-14 Thread Greenhalgh David
eBay, Thanks.  I learnt something there.

Equally, thanks to Bob, nice solution which I also didn't know.

Dave

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


Re: Why executable?

2003-08-14 Thread fliptop
On Mon, 11 Aug 2003 at 22:36, Octavian Rasnita opined:

[snip]
OR:I've tried chmodding the perl script to 755, and I've tried running it
OR:with:
OR:
OR:$ script.pl
OR:
OR:...but it didn't want to run, telling me that there is no command
OR:script.pl, even though the script has a shebang line in it.

you may want to try it again by specifying './script.pl' because if the 
directory '.' is not in your PATH, it won't find the file.


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



Re: Why executable?

2003-08-14 Thread zentara
On Mon, 11 Aug 2003 11:33:40 +0300, [EMAIL PROTECTED] (Octavian Rasnita)
wrote:

Hi all,

Does anyone know why the perl scripts need to have the execute permission
under Unix?

I am asking this because I've seen that the PHP files don't need this
permission.

Couldn't perl just read a text file (doesn't matter if it has an execute
permission or not), interpret it and execute it just like PHP does with its
programs?

perl scripts can be done the same way

You can take any perl script, and remove the shebang line, chmod it to
644 , and run it like perl scriptname

The way PHP is setup, the PHP interpreter is executable and calls it's
readonly scripts.



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



Re: Regex and Email address.

2003-08-14 Thread Wiggins d'Anconia
Sara wrote:
Simple Regex problem

How you will convert 

$email = [EMAIL PROTECTED];

TO

$email = [EMAIL PROTECTED];

using Regex.

Well this isn't necessarily a regex issue, TMTOWTDI,

my $email = '[EMAIL PROTECTED]';
$email = substr($email, 0, (index($email,'@')+2));
print Email: $email...\n;
perldoc -f index
perldoc -f substr
...of course having said that you *can* do it with a regex ;-) 

my $email = '[EMAIL PROTECTED]';
$email =~ s/^([EMAIL PROTECTED]).*/$1/;
print Email: $email...\n;
HTH,

http://danconia.org

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


Why executable?

2003-08-14 Thread Octavian Rasnita
Hi all,

Does anyone know why the perl scripts need to have the execute permission
under Unix?

I am asking this because I've seen that the PHP files don't need this
permission.

Couldn't perl just read a text file (doesn't matter if it has an execute
permission or not), interpret it and execute it just like PHP does with its
programs?

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]



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



Re: Selecting using regular expressions

2003-08-14 Thread Wiggins d'Anconia
Octavian Rasnita wrote:
Hi all,

I want to select all the content of a table from a file using regular
expressions (and not a module).
Can you give me some hints about how can I do this?
Uh, use a module.

For example I have the following text:

table ...
tr...td.../tdtd.../td/tr
tr...td.../tdtd.../td/tr
trtd table... /table/tdtd.../td/tr
/table
As you see, I could find more other tables included in this table and I
usually don't know how many are they nor at what level they are included.
Thank you for any hints.

Of course, I am not expecting this selection to be possible with a single
regular expression line, but... who knows.
Short of using a module, check the source code for a module as it will 
show you at least how to go about it... but then, you would be using a 
module

I am not trying to be snotty here, but parsing *any* set of 
medium-complex strings is difficult, there are to many factors, but 
something like HTML is incredibly difficult, which is why there are 
robust modules to do it for you.

If you know your data is going to be fairly structured then about the 
simplest would be to grab everythiung that is not between  and .

http://danconia.org

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


Urgent Question (Deployed code gone wrong!)

2003-08-14 Thread Greenhalgh David
A quick question about a while loop.

I have a simple code that searches database for all entries and puts 
one of the fields into a select box on the output page. However, due to 
a mistake in my untaint routine (which I've fixed) if a visitor entered 
their name in Japanese characters, the entry into the data base is 
blank. That means that my simple while loop:

while ($name=$sth-fetchrow_array()) {
print option$name/option;
}
stops when it hits the blank name. I can also select the ID number..

while (($name, $ID)=$sth-fetchrow_array()) {
print .option$name/option;
}
Since this is deployed code, I would like to know if this will work 
before I try it. Will the loop stop when $name is blank, or will it 
keep running because $ID is NOT blank and stop only when both are blank?

Thanks

Dave

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


Re: Why executable?

2003-08-14 Thread Ovid
And as a word of caution, some like to add '.' to their path in order to save typing 
an extra two
letters ('./' in front of the file name).  Don't do this, though, as this is a major 
security
hole.

Using google to search for 'current directory path linux security hole' for many 
examples of this
hole.

Cheers,
Ovid
--- fliptop [EMAIL PROTECTED] wrote:
 On Mon, 11 Aug 2003 at 22:36, Octavian Rasnita opined:
 
 [snip]
 OR:I've tried chmodding the perl script to 755, and I've tried running it
 OR:with:
 OR:
 OR:$ script.pl
 OR:
 OR:...but it didn't want to run, telling me that there is no command
 OR:script.pl, even though the script has a shebang line in it.
 
 you may want to try it again by specifying './script.pl' because if the 
 directory '.' is not in your PATH, it won't find the file.
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


=
Silence is Evilhttp://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid   http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: Why executable?

2003-08-14 Thread Octavian Rasnita
Hmm, are you telling that I can create a perl file and name it file.html,
file.php, or even file.asp, and use a shebang line in it, then it will be
parsed as a perl file?
Or I need to use extensions that are not set in the server's conf file to be
parsed as other types?

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Randal L. Schwartz [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Kristofer Hoch [EMAIL PROTECTED]
Sent: Monday, August 11, 2003 7:35 PM
Subject: Re: Why executable?


 Kristofer == Kristofer Hoch [EMAIL PROTECTED] writes:

Kristofer This is what I do for security on my webserver.  I don't have the
Kristofer shebang line in my scripts.  The webserver has a list of approved
perl
Kristofer script extensions.  When it runs across a file with this
extension, the
Kristofer web server executes it with perl.  Otherwise, it treats the file
as if
Kristofer it is text/html.

And if you are required to include that extension as part of your
URL, you are actually *decreasing* the security of your webserver, not
increasing it.

You should never be able to guess the implementation language by
looking at a URL.  Wrong.  Wrong.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!

--
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]



RE: perl / MySql application overview question

2003-08-14 Thread Hughes, Andrew
Thanks for the detailed answer.  I have dealt with JOIN clauses briefly in
the past, but not in this context.  I will have to revisit on my own.  As
far as grabbing the unique id, I am definitely going to use the DBI module
for contacting MySQL.  When I am looking at your piece of code, I had a few
questions though.  Let's say that I use this code to connect and insert data
into table called pageInfo in a database called Project.

pageInfo Table:
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY
pageName VARCHAR(200)
pageTitle TEXT
pageContent TEXT

my $dbh = WebDB::connecteclub ();
$sth = $dbh-prepare(insert into pageInfo(id, pageName, pageTitle, 
pageContent) values(?,?,?,?)) or die;
$sth-execute(undef, $cgi-param('pageName'), $cgi-param('pageTitle'),
$cgi-param('pageContent')) or die;

How would the suggested code below then grab that generated id from the
record created by the process above?  Also, let's say that there are two
people who submit the form at the same moment.  Will this code be able to
ensure that the correct id is selected to be stored into the cookie?

my $newid = $sth-{'Database'}-{'mysql_insertid'};
unless ($newid) {
# handle error here
}

Thanks,
Andrew

-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 7:46 PM
To: Hughes, Andrew
Cc: '[EMAIL PROTECTED]'
Subject: Re: perl / MySql application overview question


Hughes, Andrew wrote:
 I have a multi-table MySQL database that holds different pieces of
 information that will all be displayed on a web page template.  The
general
 principle is that non web people will be able to populate web pages
through
 an admin panel.  The data in all of the MqSQL tables will be entered by
the
 user through forms on the web and bought into a page template using the
 unique id for each page.
 
 The user will login with a username and password.  This information will
 then be stored in a session using Apachee::Session and a cookie.  The
first
 form that the user submits will contain general information about the page
 itself.  All of this information will be stored in one row in the table
and
 a unique id will be generated in MySQL for that webpage.  Subsequent forms
 will request other information for different areas of that one page.  I
plan
 on relating all of the information in the rest of the tables to build that
 one page back to the specific page based on that page's unique id that was
 generated.  I was planning on doing that by somehow getting that generated
 unique id into the cookie immediately after it is generated in the MySQL
 database.  Then, every time information is added to another table that
 relates back to the webpage, I will enter that id from the cookie in the
 MySQL insert statement.
 
 Here are my questions:
 Is this a proper approach?
 If not, what is a better / correct approach?
 If it is, how would I go about it? 
 
 I am not asking for someone to do it for me.  I was just wondering if
there
 were some terms / buzzwords / tutorials that I should follow up on.
 

This sounds like a common approach and certainly a viable one. In 
general you are talking about precisely what an RDBMS is for and the 
tables you refer to are in general called lookup tables.  In other words 
you store the main record in a master table then you lookup into another 
table based on a unique id from the master.

One item you will want to look into is a join clause. A join clause 
allows you to combine fields from multiple tables in a single select 
statement so that you don't have to do multiple independent selects to 
retrieve the same effect, but that is OT for this forum, but have a look 
at the MySQL documentation for JOIN.

As for retrieving the ID generated by an auto increment in MySQL if you 
are using DBI (which I hope you are) then you can using something like 
the following after an insert:

my $newid = $sth-{'Database'}-{'mysql_insertid'};
unless ($newid) {
# handle error here
}

Though this may not be portable to other engines, but it saves you the 
pain of having to do multipe statements in an atomic manner (locking), etc.

You will run into other design problems as you go along, and a lot of 
questions, that really can't be avoided without experience, but overall 
your design is fairly sound for some applications and obviously you have 
given it some or a lot of thought before starting, which is usually the 
critical and first mistake made (aka to dive right in).

Good luck,

http://danconia.org

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



Installing a module from CPAN

2003-08-14 Thread David Granas
Hi,

Im trying to install the Graphics-Simple module from CPAN on ActivePerl but 
can't seem to get it to work.  I ran the PPM install Graphics-Simple which 
worked ok, but then I tried to run the test program gt1.pl and it gave me an 
error about not having the Gtk module.  I then went to CPAN to try to 
install Gtk but I can't get it to work.  The first step in installing it - I 
think - is to type perl Makefile.pl in the directory, but it gives me an 
error about package gtk was needed but not detected and that gtk-config is 
not a command.  So my basic question is whether this is the way to install 
CPAN modules on ActivePerl, and if there are any other things I should try.  
Thanks for any help,

Dave

_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus

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


RE: Perl line breaks

2003-08-14 Thread Jonathan Hogue

2. My first line in the perl program is: #!perl -w (being a Windows-based
server, it doesn't require the full path.  The -w to warn of errors/mistakes
etc.)
I think in Windows, -w isn't enough. The #!perl line is ignored in most 
windows installations/configurations , and the file association is used 
instead.

Therefore, you should do this explicately.
use warnings;
Also, with some webservers doing the following as your first line in the 
script will catch almost all errors. (Works in IPlanet, but not Apache. Not 
sure about Windows)
BEGIN { print Content-Type: Text/HTML\n\n; }



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


RE: Regex and Email address.

2003-08-14 Thread Hall, Scott
Regexes are always more fun :)  How else can you write a program with almost
no letters.

$email =~ s/(?[EMAIL PROTECTED]).*$/.../;

perldoc perlre

search for 'look-behind'

Scott

-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 10:36 PM
To: Sara
Cc: [EMAIL PROTECTED]
Subject: Re: Regex and Email address.


Sara wrote:
 Simple Regex problem
 
 How you will convert 
 
 $email = [EMAIL PROTECTED];
 
 TO
 
 $email = [EMAIL PROTECTED];
 
 using Regex.
 

Well this isn't necessarily a regex issue, TMTOWTDI,

my $email = '[EMAIL PROTECTED]';
$email = substr($email, 0, (index($email,'@')+2));
print Email: $email...\n;

perldoc -f index
perldoc -f substr

...of course having said that you *can* do it with a regex ;-) 

my $email = '[EMAIL PROTECTED]';
$email =~ s/^([EMAIL PROTECTED]).*/$1/;
print Email: $email...\n;

HTH,

http://danconia.org


-- 
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]



Re: Perl line breaks

2003-08-14 Thread Jon Hogue

...and you don't need to print the HTML header in the BEGIN {} block.
You can just print it at the top of the perl program or in the middle of the
program but before anything else is printed.
if something is dieing in a module you are loading, you will never know 
about it because it will never get to the Content-Type and therefore never 
send anything good to your browser. if you use a BEGIN block, you might 
catch things that happen in modules you load. i wouldn't recommend doing 
that for your normal script, but it is a useful troubleshooting tool.



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


RE: Regex and Email address.

2003-08-14 Thread Hall, Scott
Comments??  Who needs comments?  My code is 'self-documenting' LOL

Scott

PS:  The regex engine is your friend.

-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 8:08 PM
To: Hall, Scott
Cc: [EMAIL PROTECTED]
Subject: Re: Regex and Email address.


Would be interesting to see which is faster, there is that whole regex 
engine thing. Of course to say that there are no letters isn't strictly 
fair because you would need two lines of comments stating what you are 
doing ;-)... depending on the context...

http://danconia.org

Hall, Scott wrote:
 Regexes are always more fun :)  How else can you write a program with
almost
 no letters.
 
 $email =~ s/(?[EMAIL PROTECTED]).*$/.../;
 
 perldoc perlre
 
 search for 'look-behind'
 
 Scott
 
 -Original Message-
 From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 05, 2003 10:36 PM
 To: Sara
 Cc: [EMAIL PROTECTED]
 Subject: Re: Regex and Email address.
 
 
 Sara wrote:
 
Simple Regex problem

How you will convert 

$email = [EMAIL PROTECTED];

TO

$email = [EMAIL PROTECTED];

using Regex.

 
 
 Well this isn't necessarily a regex issue, TMTOWTDI,
 
 my $email = '[EMAIL PROTECTED]';
 $email = substr($email, 0, (index($email,'@')+2));
 print Email: $email...\n;
 
 perldoc -f index
 perldoc -f substr
 
 ...of course having said that you *can* do it with a regex ;-) 
 
 my $email = '[EMAIL PROTECTED]';
 $email =~ s/^([EMAIL PROTECTED]).*/$1/;
 print Email: $email...\n;
 
 HTH,
 
 http://danconia.org
 
 

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



Re: Why executable?

2003-08-14 Thread Octavian Rasnita
Oh, but I guess this is a little security improvement, not?
But now... another related question.

If the shebang line is not needed by the web server (if I will define an
action to run perl in httpd.conf), is the shebang line used for something
else?

I've tried chmodding the perl script to 755, and I've tried running it with:

$ script.pl

...but it didn't want to run, telling me that there is no command script.pl,
even though the script has a shebang line in it.

Oh, do you know if I can specify the action for running .pl files and .cgi
files with perl in a .htaccess file?

Thanks.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Kristofer Hoch [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 11, 2003 5:04 PM
Subject: Re: Why executable?


This is what I do for security on my webserver.  I don't have the
shebang line in my scripts.  The webserver has a list of approved perl
script extensions.  When it runs across a file with this extension, the
web server executes it with perl.  Otherwise, it treats the file as if
it is text/html.

Kristofer.
--- zentara [EMAIL PROTECTED] wrote:
 On Mon, 11 Aug 2003 11:33:40 +0300, [EMAIL PROTECTED] (Octavian
 Rasnita)
 wrote:

 Hi all,
 
 Does anyone know why the perl scripts need to have the execute
 permission
 under Unix?
 
 I am asking this because I've seen that the PHP files don't need
 this
 permission.
 
 Couldn't perl just read a text file (doesn't matter if it has an
 execute
 permission or not), interpret it and execute it just like PHP does
 with its
 programs?

 perl scripts can be done the same way

 You can take any perl script, and remove the shebang line, chmod it
 to
 644 , and run it like perl scriptname

 The way PHP is setup, the PHP interpreter is executable and calls
 it's
 readonly scripts.



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



=
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GIT d s+:++ a C++ UL++ US+ P+++ L++
W+++ w PS PE t++ b+ G e r+++ z
--END GEEK CODE BLOCK--

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--
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]



RE: perl script as binary

2003-08-14 Thread Bob Showalter
Sven Bentlage wrote:
 Hi everyone!
 
 I`m looking for a way to compile a perl script into an executable
 binary for a WIN2000 system (no(!) perl installed).
 
 Is there a way to get this working?

I use ActiveState's PerlApp for this. It's really very nice.
It bundles everything into a single self-contained .exe file 
you can deploy to PC's. No need for Perl to be installed on
them.

http://www.activestate.com/Products/Perl_Dev_Kit/

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



RE: Urgent Question (Deployed code gone wrong!)

2003-08-14 Thread Bob Showalter
Greenhalgh David wrote:
 A quick question about a while loop.
 
 I have a simple code that searches database for all entries and puts
 one of the fields into a select box on the output page. However, due
 to a mistake in my untaint routine (which I've fixed) if a visitor
 entered their name in Japanese characters, the entry into the data
 base is blank. That means that my simple while loop:
 
 while ($name=$sth-fetchrow_array()) {

You have a subtle bug here. It should be:

   while (($name)=$sth-fetchrow_array()) {

This forces the assignment to be in list context. That way, the while()
condtion will be true if fetchrow_array returned any values, or false if it
returned an empty list. That would make the blank value not terminate your
loop.

 print option$name/option;
 }
 
 stops when it hits the blank name. I can also select the ID number..
 
 while (($name, $ID)=$sth-fetchrow_array()) {
 print .option$name/option;
 }
 
 Since this is deployed code, I would like to know if this will work
 before I try it. Will the loop stop when $name is blank, or will it
 keep running because $ID is NOT blank and stop only when both are
 blank? 

The loop will keep running as long as fetchrow_array returns a row, even if
both columns are blank.

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



Re: Why executable?

2003-08-14 Thread Kristofer Hoch
 You should never be able to guess the implementation language by
 looking at a URL.  Wrong.  Wrong.

I couldn't agree more.  None of my scripts are executed directly...IE
there is not script called 'index.pl'.  Alternatly, I use HTML::Mason
for dynamic web content.  The Mason handler calls the scripts and does
something meaningful with the information it gets back.


 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
 777 0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
 training!
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


=
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GIT d s+:++ a C++ UL++ US+ P+++ L++ 
W+++ w PS PE t++ b+ G e r+++ z
--END GEEK CODE BLOCK--

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: Why executable?

2003-08-14 Thread Camilo Gonzalez
Okay then, how should scripts be called? Let's say I'm using a form. 
What would the action be?

Kristofer Hoch wrote:

You should never be able to guess the implementation language by
looking at a URL.  Wrong.  Wrong.
   

I couldn't agree more.  None of my scripts are executed directly...IE
there is not script called 'index.pl'.  Alternatly, I use HTML::Mason
for dynamic web content.  The Mason handler calls the scripts and does
something meaningful with the information it gets back.
 

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   



=
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GIT d s+:++ a C++ UL++ US+ P+++ L++ 
W+++ w PS PE t++ b+ G e r+++ z
--END GEEK CODE BLOCK--

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
 



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


Re: Why executable?

2003-08-14 Thread Randal L. Schwartz
 Octavian == Octavian Rasnita [EMAIL PROTECTED] writes:

Octavian Hmm, are you telling that I can create a perl file and name
Octavian it file.html, file.php, or even file.asp, and use a shebang
Octavian line in it, then it will be parsed as a perl file?

Octavian Or I need to use extensions that are not set in the server's
Octavian conf file to be parsed as other types?

It all depends on the way you configure your server.

For example, with Apache, anything below a ScriptAlias directory is
automatically interpreted with mod_cgi, regardless of the extension.  So,
if I have in my httpd.conf:

ScriptAlias /cgi /some/unix/path

and then put my Perl script register into /some/unix/path/register
with the right shebang line and executable bit set, I can invoke

http://my.host.example.com/cgi/register

and it runs my script.  You can't tell what implements it.  In fact,
you could even make it register.html for all that it matters (none!).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Premature end of script headers Linux with Fat32 filesystem

2003-08-14 Thread Tim Brom
I dual-boot my computer and I have three partitions, an NTFS partition 
for Windows XP Pro, an ext3 filesystem for Linux (Red Hat Linux 9.0) and 
a Fat32 filesystem for my data (because FAT32 is the only filesystem 
both OS's play nicely with). I keep the data that I want shared stored 
on this FAT32 partition, including all the files for my websites. 
Whenever I try to access a script off of the FAT32 partition, I get a 
'Premature end of script headers' error message. I can copy the script 
verbatim onto the ext3 filesystem and it works fine, and it works fine 
on my web host's server. Does anyone know why I am getting this error 
message only when the file is coming from a FAT32 filesystem? Thanks.

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


perl / MySql application overview question

2003-08-14 Thread Hughes, Andrew
I have a multi-table MySQL database that holds different pieces of
information that will all be displayed on a web page template.  The general
principle is that non web people will be able to populate web pages through
an admin panel.  The data in all of the MqSQL tables will be entered by the
user through forms on the web and bought into a page template using the
unique id for each page.

The user will login with a username and password.  This information will
then be stored in a session using Apachee::Session and a cookie.  The first
form that the user submits will contain general information about the page
itself.  All of this information will be stored in one row in the table and
a unique id will be generated in MySQL for that webpage.  Subsequent forms
will request other information for different areas of that one page.  I plan
on relating all of the information in the rest of the tables to build that
one page back to the specific page based on that page's unique id that was
generated.  I was planning on doing that by somehow getting that generated
unique id into the cookie immediately after it is generated in the MySQL
database.  Then, every time information is added to another table that
relates back to the webpage, I will enter that id from the cookie in the
MySQL insert statement.

Here are my questions:
Is this a proper approach?
If not, what is a better / correct approach?
If it is, how would I go about it? 

I am not asking for someone to do it for me.  I was just wondering if there
were some terms / buzzwords / tutorials that I should follow up on.

Thanks,
Andrew

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



Re: perl script as binary

2003-08-14 Thread Octavian Rasnita
No, you don't need to add any dll files (at least with ActiveState Perl
Developer kit).
The perl interpreter is included in the .exe file by default. If you want
you can choose to not include it and only in that case the perl.dll file
needs to be  used.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
[EMAIL PROTECTED]



- Original Message -
From: Jonathan E. Hogue [EMAIL PROTECTED]
To: 'Sven Bentlage' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 14, 2003 3:09 PM
Subject: RE: perl script as binary


I've had some luck with perl2exe in the past. If I remember correctly,
you also have to deliver a couple of .dll's with the executable. Can you
turn the app into a web app? You might have more luck with that.
http://www.indigostar.com/perl2exe.htm

-Original Message-
From: Sven Bentlage [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 8:28 AM
To: [EMAIL PROTECTED]
Subject: perl script as binary



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



Flock and Sleep

2003-08-14 Thread Sara
(sub get_number {
open(NUMBER,data.txt);
flock (NUMBER, 2);

Do blah blah blah

close (NUMBER);

closing a file automatically removes the lock?? or should I have to unlock it by 
placing

flock (NUMBER, 8);
close (NUMBER);

My second question is how I can delay the execution of a script (If two users trying 
to execute the same script) for 30 sec by using sleep function? and If I implement 
sleep function in my script . Do I really need to use 'flock' in my script or 
there is no need then.

Thanks.

 


Regex and Email address.

2003-08-14 Thread Sara
$recipient_email = [EMAIL PROTECTED];

When you send email using yahoo groups, it will show the recpient mail
address after sending mail like this...

Mail successfully sent to [EMAIL PROTECTED]

anybody can help me how to do it? that it will hide the domain except for
showing one character after @.

I know I am poor at Regex (too poor).

Thanks for any input.

Sara.







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



Re: Regex and Email address.

2003-08-14 Thread Sara
Simple Regex problem

How you will convert 

$email = [EMAIL PROTECTED];

TO

$email = [EMAIL PROTECTED];

using Regex.

Thanks,
Sara.

  - Original Message - 
  From: gregg 
  To: Sara 
  Cc: [EMAIL PROTECTED] 
  Sent: Wednesday, August 06, 2003 6:59 AM
  Subject: Re: Regex and Email address.


  I'm not clear on what you're trying to do. I recommend reading Mastering Regular 
Expressions by O'Reilly press. 

  http://www.oreilly.com/catalog/regex/

  I am currently reading it. I am not associated with O'Reilly press, I assure you. ;-)

  Gregg Allen
  Blessed are they who expect nothing, 
  for they shall not be disappointed.
  Nietsche 


  On Wednesday, August 6, 2003, at 09:25 PM, Sara wrote:


$recipient_email = [EMAIL PROTECTED];

When you send email using yahoo groups, it will show the recpient mail
address after sending mail like this...

Mail successfully sent to [EMAIL PROTECTED]

anybody can help me how to do it? that it will hide the domain except for
showing one character after @.

I know I am poor at Regex (too poor).

Thanks for any input.

Sara.

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