php-general Digest 17 Dec 2003 14:21:06 -0000 Issue 2478

Topics (messages 172844 through 172878):

saving resource objects
        172844 by: Michael Lewis
        172845 by: Tom Rogers
        172846 by: Justin Patrin
        172847 by: Michael Lewis
        172848 by: Michael Lewis
        172849 by: Tom Rogers
        172850 by: Justin Patrin

Line breaks in PHP.
        172851 by: Philip J. Newman
        172853 by: Justin French
        172854 by: Philip J. Newman

Anyone Do RecordStore Dreamweaver/PHP?MySQL Tutorial from Macromedia's Site?
        172852 by: stiano.optonline.net

str_replace vs. preg_replace speed
        172855 by: Shawn McKenzie
        172856 by: David T-G
        172859 by: Shawn McKenzie

Trying to make my session code smarter
        172857 by: Gerard Samuel
        172860 by: Justin Patrin
        172873 by: Gerard Samuel

Re: remote file open problem
        172858 by: pravidya.netzero.com
        172861 by: Chris

Getting the CTRL T value
        172862 by: Terence
        172863 by: Jason Wong
        172864 by: Terence
        172865 by: Jason Wong

Regex to grab a Windows Path from a String...
        172866 by: sumbry.sumbry.com
        172867 by: Sven
        172868 by: Marek Kilimajer
        172874 by: sumbry.sumbry.com

Where'd my session go??
        172869 by: Anthony
        172871 by: Marek Kilimajer

Re: Internal Searches on Windows 2000 Server / Apache
        172870 by: Raditha Dissanayake

problem compiling with openssl support
        172872 by: Jon Hill
        172875 by: Adam Maas
        172876 by: Jon Hill

Inserting function into mail()???
        172877 by: Tristan.Pretty.risk.sungard.com
        172878 by: Pavel Jartsev

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I posted this on the PHP-DB list and then realized it was a more general
question about PHP than DB so I am posting it here also hoping someone can
help.

I have a fairly common problem that I have not been able to find the
solution for in the documentation and FAQs. I have to access a MSSQL box
from a LAMP box using PHP. That part works fine (thank you freetds.org). I
need to display results from user queries 10 at a time with the basic NEXT
and BACK logic. I can use the mssql_data_seek function to move amongst the
record set. The problem is how do I save the results variable between web
page updates? I cannot save the record set variable in my session because it
always returns as zero. Consider the following code:

<?php
session_start();
include("localsettings.php");
$s = mssql_connect($Server, $User, $Pass) or die("Couldn't connect to SQL
Server on $Server");
mssql_select_db($SDB, $s) or die("Couldn't open database $SDB");
$sql="select * from products where prod_id='95038'";
$ress=mssql_query($sql) or die(mssql_get_last_message());
$_SESSION['ress']=$ress;
print $ress."\n";
$ress=$_SESSION['ress'];
print $ress."\n";
?>

The first time I print RESS is comes back as RESOURCE OBJECT #12, the second
time as 0. When I look in the session file, it is zero.

Help!

How can I pass this variable and its contents so they are usable to the next
web page?

Thanks in advance.

Michael

--- End Message ---
--- Begin Message ---
Hi,

Wednesday, December 17, 2003, 12:15:24 PM, you wrote:
ML> I posted this on the PHP-DB list and then realized it was a more general
ML> question about PHP than DB so I am posting it here also hoping someone can
ML> help.

ML> I have a fairly common problem that I have not been able to find the
ML> solution for in the documentation and FAQs. I have to access a MSSQL box
ML> from a LAMP box using PHP. That part works fine (thank you freetds.org). I
ML> need to display results from user queries 10 at a time with the basic NEXT
ML> and BACK logic. I can use the mssql_data_seek function to move amongst the
ML> record set. The problem is how do I save the results variable between web
ML> page updates? I cannot save the record set variable in my session because it
ML> always returns as zero. Consider the following code:

ML> <?php
ML> session_start();
ML> include("localsettings.php");
ML> $s = mssql_connect($Server, $User, $Pass) or die("Couldn't connect to SQL
ML> Server on $Server");
ML> mssql_select_db($SDB, $s) or die("Couldn't open database $SDB");
ML> $sql="select * from products where prod_id='95038'";
ML> $ress=mssql_query($sql) or die(mssql_get_last_message());
ML> $_SESSION['ress']=$ress;
ML> print $ress."\n";
ML> $ress=$_SESSION['ress'];
ML> print $ress."\n";
?>>

ML> The first time I print RESS is comes back as RESOURCE OBJECT #12, the second
ML> time as 0. When I look in the session file, it is zero.

ML> Help!

ML> How can I pass this variable and its contents so they are usable to the next
ML> web page?

ML> Thanks in advance.

ML> Michael


The connection to the database will close at the end of the request so your
resource will no longer be valid. You will have to rerun the query again.
If there is some way to identify each row then change the query to always get an
id that is higher than the last one you read (that is the one you save in the
session) a bit like this

$last_id =0;
if(isset($_SESSION['last_id'])) $last_id = $_SESSION['last_id'];
$sql = "SELECT * FROM table WHERE id > '$last_id' order by id";
//do query
$x =0
while(get_reults && $x < 10){
        //do whatever
        $x++;
}
$_SESSION['last_id'] = id;

-- 
regards,
Tom

--- End Message ---
--- Begin Message --- Michael Lewis wrote:

How can I pass this variable and its contents so they are usable to the next web page?


The short answer is that you can't pass resources back and forth between pages. You could consider passing the current index, rerunning the query, and seeking to the new index.

OR, you could have it all done for you with:
http://pear.php.net/package/DB_Pager

Not only does this do you "paging" for you, it gets you started using DB, a database abstraction class that gives you a standard interface for all databases, lots of useful utility functions, and allows you to switch databases if you need to with minimal change to your code.

Or if you don't want ot use DB, you can just use the Pager:
http://pear.php.net/package/Pager

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
Thanks for the info, Tom. That explains it. I can't really run the query
again because of time and the size of the database. There is currently over
200,000,000 records in some of the tables. The subsets I get are generally
small. What my current thinking is, is to grab the info I need into a
temporary table and just run my search against the temporary table (taking
all records) and seeking to the correct position for display. I was trying
to avoid this if the information about my previous query was available
somewhere.

Michael

----- Original Message -----
From: "Tom Rogers" <[EMAIL PROTECTED]>
To: "Michael Lewis" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, December 16, 2003 9:25 PM
Subject: Re: [PHP] saving resource objects


> Hi,
>
> Wednesday, December 17, 2003, 12:15:24 PM, you wrote:
> ML> I posted this on the PHP-DB list and then realized it was a more
general
> ML> question about PHP than DB so I am posting it here also hoping someone
can
> ML> help.
>
> ML> I have a fairly common problem that I have not been able to find the
> ML> solution for in the documentation and FAQs. I have to access a MSSQL
box
> ML> from a LAMP box using PHP. That part works fine (thank you
freetds.org). I
> ML> need to display results from user queries 10 at a time with the basic
NEXT
> ML> and BACK logic. I can use the mssql_data_seek function to move amongst
the
> ML> record set. The problem is how do I save the results variable between
web
> ML> page updates? I cannot save the record set variable in my session
because it
> ML> always returns as zero. Consider the following code:
>
> ML> <?php
> ML> session_start();
> ML> include("localsettings.php");
> ML> $s = mssql_connect($Server, $User, $Pass) or die("Couldn't connect to
SQL
> ML> Server on $Server");
> ML> mssql_select_db($SDB, $s) or die("Couldn't open database $SDB");
> ML> $sql="select * from products where prod_id='95038'";
> ML> $ress=mssql_query($sql) or die(mssql_get_last_message());
> ML> $_SESSION['ress']=$ress;
> ML> print $ress."\n";
> ML> $ress=$_SESSION['ress'];
> ML> print $ress."\n";
> ?>>
>
> ML> The first time I print RESS is comes back as RESOURCE OBJECT #12, the
second
> ML> time as 0. When I look in the session file, it is zero.
>
> ML> Help!
>
> ML> How can I pass this variable and its contents so they are usable to
the next
> ML> web page?
>
> ML> Thanks in advance.
>
> ML> Michael
>
>
> The connection to the database will close at the end of the request so
your
> resource will no longer be valid. You will have to rerun the query again.
> If there is some way to identify each row then change the query to always
get an
> id that is higher than the last one you read (that is the one you save in
the
> session) a bit like this
>
> $last_id =0;
> if(isset($_SESSION['last_id'])) $last_id = $_SESSION['last_id'];
> $sql = "SELECT * FROM table WHERE id > '$last_id' order by id";
> //do query
> $x =0
> while(get_reults && $x < 10){
>         //do whatever
>         $x++;
> }
> $_SESSION['last_id'] = id;
>
> --
> regards,
> Tom
>
>

--- End Message ---
--- Begin Message ---
Thanks, Justin. I'll look into it.

Michael

----- Original Message -----
From: "Justin Patrin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 16, 2003 9:28 PM
Subject: [PHP] Re: saving resource objects


> Michael Lewis wrote:
> >
> > How can I pass this variable and its contents so they are usable to the
next
> > web page?
> >
>
> The short answer is that you can't pass resources back and forth between
> pages. You could consider passing the current index, rerunning the
> query, and seeking to the new index.
>
> OR, you could have it all done for you with:
> http://pear.php.net/package/DB_Pager
>
> Not only does this do you "paging" for you, it gets you started using
> DB, a database abstraction class that gives you a standard interface for
>   all databases, lots of useful utility functions, and allows you to
> switch databases if you need to with minimal change to your code.
>
> Or if you don't want ot use DB, you can just use the Pager:
> http://pear.php.net/package/Pager
>
> --
> paperCrane <Justin Patrin>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi,

Wednesday, December 17, 2003, 12:32:25 PM, you wrote:
ML> Thanks for the info, Tom. That explains it. I can't really run the query
ML> again because of time and the size of the database. There is currently over
ML> 200,000,000 records in some of the tables. The subsets I get are generally
ML> small. What my current thinking is, is to grab the info I need into a
ML> temporary table and just run my search against the temporary table (taking
ML> all records) and seeking to the correct position for display. I was trying
ML> to avoid this if the information about my previous query was available
ML> somewhere.

ML> Michael

With that many records a temp table is definitely the way to go :)

-- 
regards,
Tom

--- End Message ---
--- Begin Message --- If you're doing a large JOIN (which slows things down) you might try writing it all as multiple queries in PHP and having PHP join it together. It *may* be faster, especially for many joins.
--- End Message ---
--- Begin Message ---
Question:

When you hit enter in a text box is that classified as a \n?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- On Wednesday, December 17, 2003, at 03:10 PM, Philip J. Newman wrote:

Question:

When you hit enter in a text box is that classified as a \n?


generally, yes.

depending on the client platform, it might be an \r\n or \r (I've heard)...

justin
--- End Message ---
--- Begin Message ---
Ok thats cool, guess i'll look for both, and only one in the data

----- Original Message ----- 
From: "Justin French" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, December 17, 2003 5:35 PM
Subject: Re: [PHP] Line breaks in PHP.


> On Wednesday, December 17, 2003, at 03:10  PM, Philip J. Newman wrote:
> 
> > Question:
> >
> > When you hit enter in a text box is that classified as a \n?
> >
> 
> generally, yes.
> 
> depending on the client platform, it might be an \r\n or \r (I've 
> heard)...
> 
> justin
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On the second page of the tutorial text, it says: "From the
RecordStorePHPStart folder copy the database, called 'recordstorePHP' ... "
I don't see any such file. Anyone know where I can find it, or whether the
name's different from what the tutorial calls it?

Thank you.

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

--- End Message ---
--- Begin Message ---
I will run some benchmarks (even though they may be flaky), but what would
be the fastest execution?

$search = array(
            "<!-- [$cmd] -->",
            "<!--[$cmd]-->",
            "<!-- {".$cmd."} -->",
            "<!--{".$cmd."}-->",
            "{".$cmd."}",
        );
$replace = STARTPHP." $action ".ENDPHP;
$tmpcontent = str_replace($search, $replace, $tmpcontent);


Or, if I created one expression that handled all of the five $search items
(since they are similar) and used preg_replace()?

Thanks!
-Shawn

--- End Message ---
--- Begin Message ---
Shawn, et al --

...and then Shawn McKenzie said...
% 
% I will run some benchmarks (even though they may be flaky), but what would
% be the fastest execution?
...
% 
% Or, if I created one expression that handled all of the five $search items
% (since they are similar) and used preg_replace()?

The manual says

  Tip: preg_replace(), which uses a Perl-compatible regular
  expression syntax, is often a faster alternative to ereg_replace().

but nothing about str_replace.  Are you curious, going for absolutely
best performance, or just being efficient?  If the latter, I'd lean more
toward writing your code the same way all of the time for uniformity and
simplicity.


% 
% Thanks!
% -Shawn


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
For clarification, I'm looking for execution speed.

In the example below, $cmd may be a 100 plus item array and I loop through
the code below for each $cmd.  So maybe I execute the code below 100 or more
times.

Thanks!
-Shawn

"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I will run some benchmarks (even though they may be flaky), but what would
> be the fastest execution?
>
> $search = array(
>             "<!-- [$cmd] -->",
>             "<!--[$cmd]-->",
>             "<!-- {".$cmd."} -->",
>             "<!--{".$cmd."}-->",
>             "{".$cmd."}",
>         );
> $replace = STARTPHP." $action ".ENDPHP;
> $tmpcontent = str_replace($search, $replace, $tmpcontent);
>
>
> Or, if I created one expression that handled all of the five $search items
> (since they are similar) and used preg_replace()?
>
> Thanks!
> -Shawn

--- End Message ---
--- Begin Message ---
Currently in my code, if a user is blocking cookies (for what ever reason that 
may be), it keeps generating session ids for each page load.
Is there a way to ignore and/or work around these "users"??

Thanks

--- End Message ---
--- Begin Message --- Gerard Samuel wrote:

Currently in my code, if a user is blocking cookies (for what ever reason that may be), it keeps generating session ids for each page load.
Is there a way to ignore and/or work around these "users"??

Thanks

You can turn on URL rewriting for sessions. I'm not sure where it is just now....just search the PHP docs.

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
On Wednesday 17 December 2003 01:33 am, Justin Patrin wrote:
> You can turn on URL rewriting for sessions. I'm not sure where it is
> just now....just search the PHP docs.
>

Yes I know about this feature.
Unfortunately, its an insecure feature.
http://us2.php.net/manual/en/ref.session.php
http://us2.php.net/manual/en/
install.configure.php#install.configure.enable-trans-sid

Any other ideas???

--- End Message ---
--- Begin Message ---
Hello,
I have a HTML form through which I upload a file from the user's PC to the server.  
But my PHP script gives  the error:
Warning: fopen(C:\local path to\filename): failed to open stream: No such file or 
directory 
Note:  I cannot use the POST method in HTML is because my webhost supports only GET 
method. Also I do not want to use FTP.

My observations: The $_FILES does not get populated also.

Somebody please help.  Thanks a lot.

//////////////// HTML SCRIPT /////////////////////////////  
My HTML script:

<form name="uploadForm" method=GET enctype="multipart/form-data" action="upload.php" 
onsubmit="return fileLoad_validate()">
        <input type="hidden" name="MAX_FILE_SIZE" value="30000">
        <input type="file" name="Filename" size=69></p>
        
        <input type=submit name=B value="Upload File">
</form>

/////////////////// PHP SCRIPT ///////////////////////////
My PHP script upload.php:
<?php

error_reporting(E_ALL); 
$Filename = $_REQUEST['Filename'];
$Filename = rtrim($Filename);
$Filename = stripslashes($Filename);

$f_hdl = fopen ($Filename, "r");
if(!$f_hdl)
{
        print("Could not find your file. Try Again OR Report Error");
        print("<A HREF=goBack.html>Go BACK</A>");
        exit;
}

?>

///////////// end of php script ////////////////////////////////////

--- End Message ---
--- Begin Message ---
I suggest you read http://www.php.net/manual/en/features.file-upload.php

The GET method shouldn't work (though it may be possible). In all likelihood
your browser is just sending the local filename as a string and not
attempting to upload the file at all.

You need to use the Array $_FILES['Filename'] to access the various bits of
data about the file. Try doing print_r($_FILES); in upload.php to see if
it's there.

I would guess that a host that does not allow the POST method would not
allow file uploads at all.

CHris
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 9:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP: remote file open problem



Hello,
I have a HTML form through which I upload a file from the user's PC to the
server.  But my PHP script gives  the error:
Warning: fopen(C:\local path to\filename): failed to open stream: No such
file or directory
Note:  I cannot use the POST method in HTML is because my webhost supports
only GET method. Also I do not want to use FTP.

My observations: The $_FILES does not get populated also.

Somebody please help.  Thanks a lot.

//////////////// HTML SCRIPT /////////////////////////////
My HTML script:

<form name="uploadForm" method=GET enctype="multipart/form-data"
action="upload.php" onsubmit="return fileLoad_validate()">
        <input type="hidden" name="MAX_FILE_SIZE" value="30000">
        <input type="file" name="Filename" size=69></p>

        <input type=submit name=B value="Upload File">
</form>

/////////////////// PHP SCRIPT ///////////////////////////
My PHP script upload.php:
<?php

error_reporting(E_ALL);
$Filename = $_REQUEST['Filename'];
$Filename = rtrim($Filename);
$Filename = stripslashes($Filename);

$f_hdl = fopen ($Filename, "r");
if(!$f_hdl)
{
        print("Could not find your file. Try Again OR Report Error");
        print("<A HREF=goBack.html>Go BACK</A>");
        exit;
}

?>

///////////// end of php script ////////////////////////////////////

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi all,

Can someone point me in the direction of getting the CTRL T value (^T) into
a string?
I need it for a line break on a system call, "net send".
Something along the lines of
"net send computer_name line 1 ^T line 2 ^T line 3".
>From what I've seen the Dec# is 20 and the Hex# is 14, but I have no idea
how to get it
into the ^T.

Thanks!
Terence

--- End Message ---
--- Begin Message ---
On Wednesday 17 December 2003 16:06, Terence wrote:

> Can someone point me in the direction of getting the CTRL T value (^T) into
> a string?
> I need it for a line break on a system call, "net send".
> Something along the lines of
> "net send computer_name line 1 ^T line 2 ^T line 3".
> From what I've seen the Dec# is 20 and the Hex# is 14, but I have no idea
> how to get it
> into the ^T.

echo "A tab between this\tand this";

manual > Types > Strings

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"I'd love to go out with you, but I'm taking punk totem pole carving."
*/

--- End Message ---
--- Begin Message ---
No, that's to add a tab, I am looking for CTRL (control) + T

Thanks anyway,
Terence

----- Original Message ----- 
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 17, 2003 4:14 PM
Subject: Re: [PHP] Getting the CTRL T value


On Wednesday 17 December 2003 16:06, Terence wrote:

> Can someone point me in the direction of getting the CTRL T value (^T)
into
> a string?
> I need it for a line break on a system call, "net send".
> Something along the lines of
> "net send computer_name line 1 ^T line 2 ^T line 3".
> From what I've seen the Dec# is 20 and the Hex# is 14, but I have no idea
> how to get it
> into the ^T.

echo "A tab between this\tand this";

manual > Types > Strings

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"I'd love to go out with you, but I'm taking punk totem pole carving."
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Wednesday 17 December 2003 16:23, Terence wrote:
> No, that's to add a tab, I am looking for CTRL (control) + T

Sorry, misunderstood the question.

Try this:

  $CTRLTAB = chr(20); // assumming that's the code CTRL-T
  echo "net send computer_name line 1 {$CTRLTAB} line 2 {$CTRLTAB} line 3";

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I suppose that in a few hours I will sober up. That's such a sad
thought. I think I'll have a few more drinks to prepare myself.
*/

--- End Message ---
--- Begin Message ---
My regex skills are serious lacking and after scouring the net for
relevant links I'm a bit stuck.  I've got a textarea field where I pull
user input from, and I'd like to search this entire field for a Windows
Directory Path (ex. C:\Documents\Blah).

Basically my users are allowed to specify HTML img tags in this textarea
and I'd like to make sure that they don't reference any images that are on
their local hard drive (which many of them are doing and then thinking
the HTML that I generate from that actually works when it doesn't).

Suggestions?

-- 
"Don't 'kill -9' the SYSVMSG"
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] schrieb:
My regex skills are serious lacking and after scouring the net for
relevant links I'm a bit stuck.  I've got a textarea field where I pull
user input from, and I'd like to search this entire field for a Windows
Directory Path (ex. C:\Documents\Blah).

Basically my users are allowed to specify HTML img tags in this textarea
and I'd like to make sure that they don't reference any images that are on
their local hard drive (which many of them are doing and then thinking
the HTML that I generate from that actually works when it doesn't).

Suggestions?

hi,

i would start like this:

1. get the entire src-param of your img tag:

<?php
$regex = '/src="([^"])"/';
?>

this should search for everything between the two doubleqoutes and give it as $match[1] if working with this param in preg_match().

2. check this string for url or local path:

some possibilities are, to check for backslashes, as they are only allowed in win-paths, not in url. or to check whether your path starts with a letter, followed by a colon ('/[a-zA-Z]:/') as the local root (drive letter). if both is false assume that it's a relative or absolute url.
the other (better?) way is, to check generally, whether it's a valid url according to rfc1738 (a local win-path isn't). maybe there are existing functions?

hth SVEN
--- End Message ---
--- Begin Message --- if(preg_match('/<img[^>]+src[ ]*=[ ]*(|"|\')[a-z]{1}:\\\/i', $string)) echo "local links used";

[EMAIL PROTECTED] wrote:

My regex skills are serious lacking and after scouring the net for
relevant links I'm a bit stuck.  I've got a textarea field where I pull
user input from, and I'd like to search this entire field for a Windows
Directory Path (ex. C:\Documents\Blah).

Basically my users are allowed to specify HTML img tags in this textarea
and I'd like to make sure that they don't reference any images that are on
their local hard drive (which many of them are doing and then thinking
the HTML that I generate from that actually works when it doesn't).

Suggestions?


--- End Message ---
--- Begin Message ---
> > My regex skills are serious lacking and after scouring the net for
> > relevant links I'm a bit stuck.  I've got a textarea field where I pull
> > user input from, and I'd like to search this entire field for a Windows
> > Directory Path (ex. C:\Documents\Blah).

> if(preg_match('/<img[^>]+src[ ]*=[ ]*(|"|\')[a-z]{1}:\\\/i', $string))
> echo "local links used";

This worked beautifully.  Thanks a bunch.

-- 
"Don't 'kill -9' the SYSVMSG"
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I've got an issue with an app I wrote.  I store some information about the
user and if they are logged into the app in session variables.  The problem
is that if they leave the app idle for a while ( about an hour) the session
information is lost, so the user is prompted to log back into the
application.  I checked session.cookie_lifetime and it's set to 0.  The
client side is IE 5.5 or 6.  What could be causing the session to be lost?
Thanks for your help :)

- Anthony

--- End Message ---
--- Begin Message --- It's the garbage collector - session.gc_maxlifetime setting. The setting is server wide, unless you use your own session storage functions.

Anthony wrote:

I've got an issue with an app I wrote.  I store some information about the
user and if they are logged into the app in session variables.  The problem
is that if they leave the app idle for a while ( about an hour) the session
information is lost, so the user is prompted to log back into the
application.  I checked session.cookie_lifetime and it's set to 0.  The
client side is IE 5.5 or 6.  What could be causing the session to be lost?
Thanks for your help :)

- Anthony


--- End Message ---
--- Begin Message --- Last time i used it was three years ago. It was pretty good then. A discussion of aspseek or mnogosearch specifics would take us outside the scope of this list.

Chris wrote:

Thanks for the response.

I can't seem to find ASPSeek available for Windows at all. Did you say they
had one?

The windows version of mnoGoSearch looks like it could be suitable. Do any
of you have any experience with it? This isn't a large website (maybe a few
hundred pages), but it needs to work reliably and quickly.

Thanks once again,
Chris

-----Original Message-----
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 4:42 PM
To: Chris; PHP List



--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

--- End Message ---
--- Begin Message ---
Hi

I cannot manage to compile openssl support into php.

my configuration line is

CPPFLAGS='-I/usr/local/include/' ./configure 
--with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr 
--with-gettext-dir=/usr --with-gd --with-png-dir=/usr --with-zlib-dir=/usr 
--with-jpeg-dir=/usr --with-gd-native-ttf --enable-magic-quotes 
--enable-calendar --enable-ftp --enable-wddx --with-openssl=/usr


configure always complains that it cannot find evp.h
evp.h IS located in /usr/local/include/openssl

I have tried a vairety of variations to try and get it to work. Perhaps I have 
not set CPPFLAGS properly or I need something else?

hope someone can show me the way.

Jon

--- End Message ---
--- Begin Message --- Jon Hill wrote:
Hi

I cannot manage to compile openssl support into php.

my configuration line is

CPPFLAGS='-I/usr/local/include/' ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr --with-gettext-dir=/usr --with-gd --with-png-dir=/usr --with-zlib-dir=/usr --with-jpeg-dir=/usr --with-gd-native-ttf --enable-magic-quotes --enable-calendar --enable-ftp --enable-wddx --with-openssl=/usr


configure always complains that it cannot find evp.h evp.h IS located in /usr/local/include/openssl

I have tried a vairety of variations to try and get it to work. Perhaps I have not set CPPFLAGS properly or I need something else?

hope someone can show me the way.

Jon


Your last flag is incorrect. --with-openssl needs to be /usr/local

It's looking in /usr/include for evp.h

Adam
--- End Message ---
--- Begin Message ---
cheers Adam,

that now works

Jon

On Wednesday 17 December 2003 13:29, Adam Maas wrote:
> Jon Hill wrote:
> > Hi
> >
> > I cannot manage to compile openssl support into php.
> >
> > my configuration line is
> >
> > CPPFLAGS='-I/usr/local/include/' ./configure
> > --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr
> > --with-gettext-dir=/usr --with-gd --with-png-dir=/usr
> > --with-zlib-dir=/usr --with-jpeg-dir=/usr --with-gd-native-ttf
> > --enable-magic-quotes
> > --enable-calendar --enable-ftp --enable-wddx --with-openssl=/usr
> >
> >
> > configure always complains that it cannot find evp.h
> > evp.h IS located in /usr/local/include/openssl
> >
> > I have tried a vairety of variations to try and get it to work. Perhaps I
> > have not set CPPFLAGS properly or I need something else?
> >
> > hope someone can show me the way.
> >
> > Jon
>
> Your last flag is incorrect. --with-openssl needs to be /usr/local
>
> It's looking in /usr/include for evp.h
>
> Adam

--- End Message ---
--- Begin Message ---
Ok, here's my code that I want to pick a random line from a text file, and 
then mail myself 10 times with a different line each time...
But It simply won't work...
Anyone know why?

<?
    function randomline($filename) {
    $file = file($filename);
    srand((double)microtime()*1000000);
    $abc = $file[rand(0,count($file))];
    }
$i = 0;
while (2 > $i) {
$abc = randomline('text.txt');
mail("[EMAIL PROTECTED]", "$abc", "$abc", "From: [EMAIL PROTECTED]");
$i++;
}
?>

<HTML>
<BODY>
Mails sent!
</BODY>
</HTML>

*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************


--- End Message ---
--- Begin Message --- Tristan Pretty wrote:
Ok, here's my code that I want to pick a random line from a text file, and then mail myself 10 times with a different line each time...
But It simply won't work...
Anyone know why?

...
while (2 > $i) {
...


Seems that this "while"-loop will execute only 2 times.. not 10. Maybe this is the reason.

--
Pavel a.k.a. Papi

--- End Message ---

Reply via email to