Re: [PHP] help with preg_replace please

2003-03-25 Thread Jason Paschal
what that guy said, or use ereg_replace instead of preg_...





From: Jason Wong <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [PHP] help with preg_replace please
Date: Wed, 26 Mar 2003 14:08:44 +0800
On Wednesday 26 March 2003 13:59, Justin French wrote:

> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> /usr/local/apache/htdocs/lib/lib_string.inc on line 218
>
> Using this code:
> $str =
> preg_replace("!([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])!ei", 
"
> href=\"{$1}://{$2}{$3}\">{$2}{$3}", $str);

You seem to be using ereg syntax in a PCRE function! Replace them with 
their
proper PCRE counterparts.

Eg to match alphanumeric:

 [0-9|a-z|A-Z]  // off the top of my head, untested

etc.

--
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
--
/*
Real Users never know what they want, but they always know when your 
program
doesn't deliver it.
*/

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


_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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


Re: [PHP] help with preg_replace please

2003-03-25 Thread Jason Wong
On Wednesday 26 March 2003 13:59, Justin French wrote:

> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> /usr/local/apache/htdocs/lib/lib_string.inc on line 218
>
> Using this code:
> $str =
> preg_replace("!([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])!ei", " href=\"{$1}://{$2}{$3}\">{$2}{$3}", $str);

You seem to be using ereg syntax in a PCRE function! Replace them with their 
proper PCRE counterparts.

Eg to match alphanumeric:

 [0-9|a-z|A-Z]  // off the top of my head, untested

etc.

-- 
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
--
/*
Real Users never know what they want, but they always know when your program
doesn't deliver it.
*/


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



[PHP] help with preg_replace please

2003-03-25 Thread Justin French
Hi,

Total newbie on reg exps, and even worse with preg!!!

I get the following error:

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
/usr/local/apache/htdocs/lib/lib_string.inc on line 218

Using this code:
$str = 
preg_replace("!([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])!ei", "{$2}{$3}", $str);


Can anyone point to the problem?


The aim is to perform functions on $2 & $3.

TIA
Justin French


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



Re: [PHP] NewB Q on Arrays.

2003-03-25 Thread Frappy John
> What i want to be able to do is determine if a certain
> user has watched a movie. 

If you want to check the log to see if a single user has 
viewed a particular movie, then include the user and movie 
in the select statement:

select uid, mvid from mvlogtbl where uid = $userID and mvid 
= $movieID

If mysql_num_rows > zero, then user has watched this movie.

Better still:

select count(uid) from mvlogtbl where uid = $userID and 
mvid = $movieID

Here one row will be returned containing the number of 
times the user has viewed the movie. 

--Frappy



On Tuesday 25 March 2003 06:18 am, inpho wrote:
> Hey All,
>
> I'm still a newB in php and mysql so I'm asking for your
> patience up front.
>
> i want to get a list of results from an array, which I
> can do with:
>
> $result=mysql_query("select * from mvlogtbl",$db);
> while ($row=mysql_fetch_array($result)){
> echo "$row[uid] $row[mvid]";
> }
>
> basically what I have is a database of movies linked to
> .avi files that are setup for streaming, the table
> mvlogtbl keeps a log of who has watched what.
>
> What i want to be able to do is determine if a certain
> user has watched a movie. But there are multiple entries
> for each user, a user may have watched the movie more
> than once, I don't really care, I just want to be able to
> tell if they have watched it or not...
>
> any help?
>
> Thanls
>
> - paul -

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



[PHP] RE: connecting to mysql db

2003-03-25 Thread Uttam
Yes, It is necessary because script executes & ends for every request.

Variables can be made persistent by using cookie/sessions but mysql
connection is a resource which can not be saved & restored as session
variable.

For efficient use of resources, you may use mysql_pconnect() (only when php
is used as module), but still you have to use it in every script.  The only
difference is that mysql_pconnect() will
*use any previously open mysql connection & use it instead of making fresh
connection to mysql
*if a fresh connection is made, it will not be closed when script ends.

regds,
-Original Message-
From: Iggy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 19:20
To: [EMAIL PROTECTED]
Subject: connecting to mysql db


hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving
some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code


thanx
iggy


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



[PHP] Re: ho to remove an empty space

2003-03-25 Thread chris
On Mon, 24 Mar 2003 22:10:28 -0800, Webdev <[EMAIL PROTECTED]> wrote:

somehow when I have try to develop an application where I read five or 
six
values into an individual arrays the array who carries the emails has the
email and an additional empty field after the email somehow complex 
well
they way the information has been stored is that the email was the last
value in the line of arrays and somehow carries always an empty field or 
the
tab field I can see when I upload the data in binary mode however I tried
around for some time

how do remove an empty space in an erray I tried arround with

$E2= str_replace(" ", "", $Email);

and I tried as well
$E2= str_replace(" ", "", $Email); with no success it totally 
ignored
the empty space in the email  what is stored in this
way:|data1|data2|[EMAIL PROTECTED] |data3|etc...|||. when I phrased
the data file
any help and advice would be appreciated...


Are you certain it is a space and not something like a linebreak?  If it's 
at the end of the line, you might consider ltrim or rtrim, which would 
eliminate most whitespace characters from the beginning or ending of the 
string.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: session id

2003-03-25 Thread Uttam
session_start();
should be on the first line in the script.

regds,

-Original Message-
From: Iggy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 20:08
To: [EMAIL PROTECTED]
Subject: session id


can somebody tell me why I am getting this:
Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on
line 21

Warning: session_start() [function.session-start]: Cannot send session
cache
limiter - headers already sent (output started at
c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on
line 21


when I use this code:

session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}


PHP is version 4.3.1

thanx




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



[PHP] Re: NewB Q on Arrays.

2003-03-25 Thread chris
On Tue, 25 Mar 2003 21:18:48 +1000, Inpho <[EMAIL PROTECTED]> wrote:

Hey All,

I'm still a newB in php and mysql so I'm asking for your patience up 
front.

i want to get a list of results from an array, which I can do with:

$result=mysql_query("select * from mvlogtbl",$db);
while ($row=mysql_fetch_array($result)){
echo "$row[uid] $row[mvid]";
}
basically what I have is a database of movies linked to .avi files that 
are
setup for streaming, the table mvlogtbl keeps a log of who has watched 
what.

What i want to be able to do is determine if a certain user has watched a
movie. But there are multiple entries for each user, a user may have 
watched
the movie more than once, I don't really care, I just want to be able to
tell if they have watched it or not...

any help?

Thanls

- paul -

// pseudo code starts here...
// use php to read the contents of the avi and set the header of the php 
doc
// to match headers necessary for an avi (check the fread/fwrite 
documentation)
// when it downloads, set the member_has_watched field for that member to
// true or 1 or whatever...

select count(*) from table where member_has_watched = TRUE and member_id = 
the_member's_id

if ($count > 0) {
// the member has watched it
} else {
// the member has not watched it
}
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] imap_open Error

2003-03-25 Thread Brian Mitchell
I'm using the following code to try to open a stream to access my email: 
  
$user_id = "userid"; 
$password = "password"; 
$inbox = @imap_open("{mail.host.com:143}INBOX", $user_id, $password); 
  
I've verified the correct username, password, hostname combination by setting up an 
IMAP account through Outlook Express. 
  
However, whenever I try and open the page that this code sits on I get a "The Page 
Cannot Be Displayed" error.  Specifically, it says that it cannot find the server or 
DNS error.  I can comment out the imap_open line and the page will load fine.  Also, 
I've asked my host and verified that the imap functions are available as part of PHP.  
I can't figure out why this is happening.  Any help would be greatly appreciated. 
  
Thanks, 
Brian 

RE: [PHP] Mac IE File download problem - any solutions?

2003-03-25 Thread Daniel Leighton
Actually, I think you may have misunderstood.  On Mozilla (Mac), Netscape (Mac) and 
Safari the script works exactly as I have intended: sending the "Content-Type: 
application/octet-stream" header causes the file to download; sending the 
"Content-Type: video/quicktime" causes the file to be played within the browser.  On 
IE (Mac OS X), some files with the .mov extension download when the "Content-Type: 
application/octet-stream" header is sent, while others play in-browser, while all play 
in-browser, as they should.

>From what I understand, "Content-Type: application/octet-stream" header should ALWAYS 
>cause a download.  This is not an issue of post-processing (the settings in the 
>browser which tell it to open a file in a certain application AFTER the file has been 
>downloaded - that is not a problem).  BTW, even if I change my preferences in IE to 
>save .mov files to disk, they still play in-browser.

After re-compiling PHP with mime-magic enabled, the mime_content_type() function is 
returning "video/quicktime" for the file which does not download and "text/plain" for 
the one which does (even though the "text/plain" file plays fine both in-browser and 
once it is downloaded).  In any case, that will be my next area of investigation.

At 12:03 PM -0800 on 3/25/03, Jennifer Goodie wrote:


>This is not a MAC IE problem, it is the way browsers work.  If the MIME type
>is mapped to an application, the browser will launch the application.  IE
>does it inline, while Netscape tends to launch it separately.
>
>You can send false headers with a made up type and a missing file extension,
>but then the browser will not know what type of file it is and the save as
>is harder for the user as they have to put the right extension on.  It is a
>work around, but a really poor one.
>
>header("Content-disposition: filename=$filenamewithoutextension");
>header("Content-type:reallyreallyreallybigcsv");
>
>
>
>
>-Original Message-
>From: Step Schwarz [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, March 25, 2003 11:49 AM
>To: Daniel Leighton; [EMAIL PROTECTED]
>Subject: Re: [PHP] Mac IE File download problem - any solutions?
>
>
>[...]
>> The problem:  When downloading certain files on a Mac using IE 5.x, files
>are
>> displayed within a browser window instead of downloading.  This seems to
>occur
>> mostly with quicktime files (.mov, .mp3).  Some quicktime files work,
>while
>> others with the same extension do not.
>[...]
>
>Hi Daniel,
>
>I believe this is a browser setting, is it not?  Using the default setup of
>Explorer 5.2 for Mac, a clicked .mov file will play in IE.
>
>To change this behavior, go to Explorer > Preferences... > File Helpers,
>select QuickTime Movie and click Change... then switch Handling from "View
>with Browser" to "Save to File".
>
>I would be surprised if a file header could override this.. but if you find
>a way, please let us know!
>
>-Step
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 

Daniel Leighton
Chief Technology Officer
Webolution
http://www.webolution.com

 This email may contain material that is confidential and privileged for the
sole use of the intended recipient.  Any review, reliance or distribution
by others or forwarding without express permission is strictly prohibited.
If you are not the intended recipient, please contact the sender and delete
all copies.

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



RE: [PHP] variables??

2003-03-25 Thread John W. Holmes
Okay, true. But they key here is the "act accordingly", meaning you
sanitize and validate the variable before using it anywhere. 

Sometimes the way it's represented is that just using $_GET['var'] is
going to make things more secure than using $var, which is not the case
unless you know what exactly $_GET['var'] contains and how you're using
it. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 25, 2003 8:15 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] variables??

No, it is more secure.  The problem with register_globals is that ALL
variables become global - not just the ones you want to be.  Example:

if(something) $authorized = true;
if($authorized){
...do something requiring security...
}

A hacker could easily go to script.php?authorized=1, and gain access.
 If you only allow one variable in that ($_GET['var']), you will know
that the variable is from an outside source, and can act accordingly.

John W. Holmes wrote:

It is considered more secure to declare the variable explicitly.

$var = $_GET["var"];


Ummm... that's the same result as having register_globals on
(basically). You're not helping anything and it's certainly not any more
"secure".

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
 
  
I'm having a problem with form data being recognized by a php

script.
  
If I send information with a GET the variable data appears in

$GET[var]

but not $var.  >



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





  


-- 
The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent
of the law.




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



RE: [PHP] Difference between months

2003-03-25 Thread John W. Holmes
> How do I subtract the difference of months between two dates?
> 
> For instance, if one date is 2003-12 and the other is 2002-08, I need
to
> know that there are 16 months between them. If one date is 2003-04 and
the
> other is 2003-01, I need to know that there are 3 months between them.
How
> can I do this?

One way...

$date1 = "2003-12";
$date2 = "2002-08";

$d1 = explode('-',$date1);
$d2 = explode('-',$date2);

$diff = ($d1[0]*12+$d1[1]) - ($d2[0]*12+$d2[1]);

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] variables??

2003-03-25 Thread Leif K-Brooks
No, it is more secure.  The problem with register_globals is that ALL 
variables become global - not just the ones you want to be.  Example:

if(something) $authorized = true;
if($authorized){
...do something requiring security...
}
A hacker could easily go to script.php?authorized=1, and gain access. 
If you only allow one variable in that ($_GET['var']), you will know 
that the variable is from an outside source, and can act accordingly.

John W. Holmes wrote:

It is considered more secure to declare the variable explicitly.

$var = $_GET["var"];
   

Ummm... that's the same result as having register_globals on
(basically). You're not helping anything and it's certainly not any more
"secure".
---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
 

I'm having a problem with form data being recognized by a php
   

script.
 

If I send information with a GET the variable data appears in
   

$GET[var]
   

but not $var.  >
   

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





 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



RE: [PHP] Benchmarking

2003-03-25 Thread John W. Holmes
> I've been making a web ap PHP based, but I fear the number of arrays
it
> has
> is too big. Is there any way to benchmark a script, or are there any
> recomendations or standards about how much time execution takes and
how
> many
> resources it takes?

The benchmarking is just a matter of subtracting the time at the end of
your script from the time at the beginning.

Check your web server logs for the resources question. I don't know of
any PHP way to do it. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] Changing variables in a text file

2003-03-25 Thread John W. Holmes
> I have a text file with a series of project variables.
> 
> For example
> $var1="";
> $var2="";
> $template="blue";
> $anothervar="foo";
> 
> Let say I need to change $template="blue"; to $template="red";. How
can I
> do
> that keeping the rest of the file intact?

You have to write the whole file over. So read the entire file into a
string. If you know you're looking to match $template, then you can use
a preg_replace() call.

$new_value = "red";
preg_replace('/\$template="[^"]";/','$template="'.$new_value.'";',$text)
;

or something similar. Adapt to your needs. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP] How to prevent execution of PHP in specific directory.

2003-03-25 Thread Heo, Jungsu
Hello, there.

(Sorry to bother you if this kind of message already posted, but I cannot find
the answer)

My system hosts customers using Apache Virtual Host.

If a customer has www.a.com, image.a.com ,

DocumentRoot of http://www.a.com is /usr/local/apache/htdocs/
and http://image.a.com is /home/user_name/public_html/

And, if another user has www.b.com , DocumentRoot of http://www.b.com is
/usr/local/apache/htdocs/
and http://image.b.com is /home/user_name/public_html/

Users can upload PHP file via FTP.

So, I wanna to prevent execution of PHP on User's HOME directory.
and /usr/local/apache/htdocs/ can execute PHP Script.

How can I do this?

Thank you for advanced answer!


##
Heo, Jungsu Mr.
SimpleX Internet. http://www.simplexi.com

Filter : sql, php



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



RE: [PHP] Default setting garbage

2003-03-25 Thread John W. Holmes
> Why is it that when I send call this function:
> function GetNextDate($whichfriday, $month = "", $frequency = 1,
$basedate
> = "")
> 
> with this line:
> GetNextDate("4", "2003-03", "5");
> 
> that $frequency ends up ""? Whether I set it myself when I call the
> function, or I leave it blank and let the function set it itself, it
ends
> up with nothing in it. empty() returns 1, while isset() returns
nothing on
> this.

I'll guess that you're trying to access $frequency outside of the
function, after you've called it, right? If so, read up on variable
scope in the manual.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] variables??

2003-03-25 Thread John W. Holmes
> It is considered more secure to declare the variable explicitly.
> 
> $var = $_GET["var"];

Ummm... that's the same result as having register_globals on
(basically). You're not helping anything and it's certainly not any more
"secure".

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
 
> > > I'm having a problem with form data being recognized by a php
script.
> > > If I send information with a GET the variable data appears in
> $GET[var]
> > > but not $var.  >
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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



RE: [PHP] Disabling output control when using "ob_start"

2003-03-25 Thread John W. Holmes
> Is there a way to disable the call back function set by "ob_start"?
> I tried:
> ob_end_flush();
> ob_end_clean();
> ob_implicit_flush(true);
> 
> Nothing seams to work. I can't detect the call back function and I
can't
> prevent it either. The call back function is called no matter what!
> 
> Michael
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

What if you use something like:

Ob_start("dummy");

Function dummy($string) { return $string; }

Which basically does nothing...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP] can i ask?

2003-03-25 Thread M.N. Ikhwan S.

 ScriptAlias /php/ "c:/php/"
 AddType application/x-httpd-php .php
 Action application/x-httpd-php "/php/php.exe"
 
 i'm using apache 2.0 as my web server. and i'm about to ask these question, where am 
i going to put these three lines? under what line in httpd.conf?
 
 ikhwan




-
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

Re: [PHP] foreach statement

2003-03-25 Thread Jim Lucas
i have this little function that I wrote to do just that.

function alternate(&$a, $b)
{
  return($a = ($a?$a:$b) );
}

just call it like this

alternate($myArr, array());
foreach($myArr AS $k => $v)
{
  do something here
}

Jim
- Original Message -
From: "Jennifer Goodie" <[EMAIL PROTECTED]>
To: "shaun" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 3:34 PM
Subject: RE: [PHP] foreach statement


> You don't.
> From http://www.php.net/manual/en/control-structures.foreach.php
> "Note: foreach does not support the ability to suppress error messages
using
> '@'."
>
> You should check the validity of your argument before passing it to
foreach
>
> if(is_array($array)){
> foreach($array as $key=>$val){
> //do stuff
> }
> }
>
> -Original Message-
> From: shaun [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 3:23 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] foreach statement
>
>
> how do i surpress an error message for a foreach statement?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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



RE: [PHP] formatting textarea input on output

2003-03-25 Thread daniel
umm nl2br doesnt work most the time ,

"nl2br --  Inserts HTML line breaks before all newlines in a string "

sorry to give a wrong example this is for splitting your content into 
paragraphs obviously where there is a break in the content like so

efwojeiowerjwetwpjwewoj

eioptejoiejiojtei

it wont br every bloody newline ! which doesnt give good results all the time

>= Original Message From "CPT John W. Holmes" <[EMAIL PROTECTED]> 
=
>> /**
>> * converts line break and spaces to page break
>> *
>> * @access public
>> */
>>
>> function nlbr($string) {
>> return preg_replace("/(\r\n|\n|\r)/", "\n", $string);
>> }
>
>ummm www.php.net/nl2br() ??
>
>Start a new thread for your question, don't hijack someone else's thread.
>
>---John Holmes...
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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



RE: [PHP] foreach statement

2003-03-25 Thread Jennifer Goodie
You don't.
>From http://www.php.net/manual/en/control-structures.foreach.php
"Note: foreach does not support the ability to suppress error messages using
'@'."

You should check the validity of your argument before passing it to foreach

if(is_array($array)){
foreach($array as $key=>$val){
//do stuff
}
}

-Original Message-
From: shaun [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 3:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] foreach statement


how do i surpress an error message for a foreach statement?



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


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



Re: [PHP] foreach statement

2003-03-25 Thread Richard Whitney
Get rid of the error

Quoting shaun <[EMAIL PROTECTED]>:

### how do i surpress an error message for a foreach statement?
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 


-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net*
602-971-2791
  * *   *
*  *  *__**
 _/  \___  *
 *  /   *\**
  */ * *  \
**/\_ |\
 /   \_  /  \
/  \/\
   /  \ 
  /\
 /  \


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



[PHP] foreach statement

2003-03-25 Thread shaun
how do i surpress an error message for a foreach statement?



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



Re: [PHP] formatting textarea input on output

2003-03-25 Thread CPT John W. Holmes
> /**
> * converts line break and spaces to page break
> *
> * @access public
> */
> 
> function nlbr($string) {
> return preg_replace("/(\r\n|\n|\r)/", "\n", $string);
> }

ummm www.php.net/nl2br() ??

Start a new thread for your question, don't hijack someone else's thread.

---John Holmes...

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



[PHP] Object Aggregation - does anyone have experience with it?

2003-03-25 Thread Christopher E. Welton
I am using php 4.2.2 with Apache 2.0 on Red Hat 8.0

When I attempt to dynamically aggregate two objects using the
aggregate() call, I get the following message:

Fatal error: Call to undefined function: aggregate()

the man page for aggregate() lists  the following info:
aggregate
(PHP 4 >= 4.2.0)
void aggregate ( object object, string class_name)

Though I realize this module is experimental, I'm curious if it has been
pulled out from PHP, moved to a different name/section or if there is
just something weird going on here with my installation.

Any help would be appreciated

-- 
Chris Welton
Owner
JumpNow!USA
[EMAIL PROTECTED]
10560 Norwalk Blvd.
Santa Fe Springs, CA 90670
562-946-6683
1-800-709-5867
http://www.jumpnowusa.com


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



RE: [PHP] flush not flushing?

2003-03-25 Thread Bryan Koschmann - GKT
Daniel-

I just tried this, didn't seem to make a difference.

Thanks for the reply!

Bryan

On Tue, 25 Mar 2003, daniel wrote:

|hi , i have had similar issues its worked by doing a ob_flush before flush
|then u want a sleep statement so maybe try
|
|ob_flush();
|flush();
|sleep(2);
|
|??
|
|>= Original Message From Bryan Koschmann - GKT <[EMAIL PROTECTED]> =
|>Hello,
|>
|>I'm including a script I use to automatically e-mail overdue customers. My
|>problem is I have to have it sleep to avoid upsetting the mailserver, but
|>when I do, it seems to pause and sleep the total time (number of users x
|>sleep(1)) then output the whole block. I'm testing it now by printing the
|>name and email to the screen.
|>
|>Instead of:
|>
|>Customer 1 - [EMAIL PROTECTED]
|>pause 1 sec
|>Customer 2 - [EMAIL PROTECTED]
|>pause 1 sec
|>Customer 3 - [EMAIL PROTECTED]
|>pause 1 sec
|>
|>I get
|>
|>big big big pause
|>Customer 1 - [EMAIL PROTECTED]
|>Customer 2 - [EMAIL PROTECTED]
|>Customer 3 - [EMAIL PROTECTED]
|>
|>
|>Here is the script. Any help would be great!
|>
|>Thanks,
|>
|>  Bryan
|>
|>
|>
|>
|>$myname = "My Company";
|>$myemail = "[EMAIL PROTECTED]";
|>
|>$now = strtotime("now");
|>$nowdate = date("l, F jS Y", $now);
|>$nowtime = date("H:i", $now);
|>$nowmonth = date("F", $now);
|>$nowyear = date("Y", $now);
|>
|>$duedate = strtotime("25 $nowmonth $nowyear");
|>$duedate = date("l, F jS Y", $duedate);
|>
|>$t = mktime(0,0,0,date('m')+1,1,date('Y'));
|>$expdate = date("l, F jS Y", $t);
|>
|>$expdatenum = date("w", $t);
|>
|>if ($expdatenum == "6") {
|>$rendate = date("l, F jS Y", strtotime("$expdate +2 days"));
|>} else {
|>$rendate = date("l, F jS Y", strtotime("$expdate +1 day"));
|>}
|>
|>
|>$query = htmlspecialchars("execute goToExpire");
|>
|>$fp = fsockopen ("111.222.333.444", 45678, $errno, $errstr, 30);
|>
|>// return_format can be either "delimited" or "xml"
|>$connect = "
|>
|>  
|>  Provider=SqlOleDb;
|>  Data Source=(local);
|>  Initial Catalog=MyCompany;
|>  Integrated Security=SSPI;
|>  
|>  
|>  delimited
|>  ~
|>  
|>  
|>  
|>  $query
|>  
|>
|>";
|>
|>$usercount = "0";
|>
|>if (!$fp) {
|>  echo "$errstr ($errno)\n";
|>} else {
|>  fputs ($fp, "$connect");
|>  flush();
|>
|>  // Create some headings for the table
|>
|>  while (!feof($fp)) {
|>  $buffer = fgets($fp, 4096);
|>  $row = explode('~', $buffer);
|>
|>  if (!empty($row[0])) {
|>  if ($row[0] == "ERROR") {
|>  echo "$row[0]: $row[1]
|$row[2]\n";
|>  } else {
|>  if (username($row[4]) !== "") {
|>
|>  $isbiz = str_replace("\r\n", "", $row[6]);
|>  $accountnum = account($row[0]);
|>  $amountdue = amount($row[5]);
|>
|>  if ($isbiz == "True") {
|>  $fullname = name($row[1]);
|>  } elseif ($isbiz == "False") {
|>  if (miname($row[3]) == "") {
|>  $fullname = name($row[2]) . " " . 
name($row[1]);
|>  } else {
|>  $fullname = name($row[2]) . " " . 
miname($row[3]) . " " . name($row[1]);
|>  }
|>  }
|>  flush();
|>  $subject = "Account Status: #" . account($row[0]);
|>  $message =  "\r\n" .
|>  "$fullname\r\n" .
|>  "Account #" . account($row[0]) . 
"\r\n\r\n" .
|>  "Payment Reminder!\r\n\r\n" .
|>  "Our records indicate that we have not 
received your payment of
|\$$amountdue due\r\n" .
|>  "on $duedate for your Internet access 
account. Please\r\n" .
|>  "send in your payment to prevent any 
interruption in your service.
|Any\r\n" .
|>  "accounts with an open balance will 
expire on $expdate\r\n" .
|>  "at 5:00pm, and cannot be reactivated 
until $rendate at
|9:00am.\r\n\r\n" .
|>  "If you have already sent in payment, 
please disregard this reminder.
|If\r\n" .
|>  "you believe your account to be 
up-to-date or believe this message to
|be in\r\n" .
|>  "error, feel free to call us at (555) 
123-4567 or 

Re: [PHP] formatting textarea input on output

2003-03-25 Thread Charles Kline
I hang my head in shame... yes. As a matter of fact, I did on my second 
skim through my PHP ref. manual... thanks for the pointer just the same.

- charles

On Tuesday, March 25, 2003, at 05:38 PM, CPT John W. Holmes wrote:

i have a textarea in a form which gets inserted into a table in my
database (mySQL). When displaying this text back to the screen, how do
i retain the line breaks etc. that were in the original input?
I bet if you searched for "textarea" and "line breaks" you'd of found 
the
nl2br() function... but I'm not a betting man... unless there's money
involved... and beer.

---John Holmes...

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


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


RE: [PHP] formatting textarea input on output

2003-03-25 Thread daniel
/**
* converts line break and spaces to page break
*
* @access   public
*/

function nlbr($string) {
return preg_replace("/(\r\n|\n|\r)/", "\n", $string);
}

here is one i use , what i'm still trying to work out , its a way to splita  
long peice of content into a preview caption with a more link , my current 
code will break say if there was a G.W Bush , as it soughta gets the first . 
but need a way to get the first "." plus a \n

so efwerui.

qwroirwjoiwrj

is consider a new sentence so will only show efwerui. any ideas ?
>= Original Message From Charles Kline <[EMAIL PROTECTED]> =
>hi all,
>
>i have a textarea in a form which gets inserted into a table in my
>database (mySQL). When displaying this text back to the screen, how do
>i retain the line breaks etc. that were in the original input?
>
>thanks
>charles
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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



Re: [PHP] formatting textarea input on output

2003-03-25 Thread CPT John W. Holmes
> i have a textarea in a form which gets inserted into a table in my
> database (mySQL). When displaying this text back to the screen, how do
> i retain the line breaks etc. that were in the original input?

I bet if you searched for "textarea" and "line breaks" you'd of found the
nl2br() function... but I'm not a betting man... unless there's money
involved... and beer.

---John Holmes...


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



Re: [PHP] formatting textarea input on output

2003-03-25 Thread Ernest E Vogelsinger
At 23:30 25.03.2003, Charles Kline said:
[snip]
>i have a textarea in a form which gets inserted into a table in my 
>database (mySQL). When displaying this text back to the screen, how do 
>i retain the line breaks etc. that were in the original input?
[snip] 

nl2br()


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] Backing Up Tables Using PHP

2003-03-25 Thread Jennifer Goodie
Most RDB programs come with an integrated backup solution.  You might want
to look into those.

As far as why your code is not working, you are not looping through the
result set, you are only pulling one result.  A database does not store data
in order, it puts it where ever there's a hole, so the 25th record could
very well hold the first spot in the file.  You have more problems than not
looping, echo "$result_sql_daily[$count_daily]"; is just going to print
"array()" if I am not mistaken.  To fix the problem that you asked about
though, take out the part where you fetch the first result and replace the
for statement with
while ($result_sql_daily = mysql_fetch_array($run_sql_daily)){

-Original Message-
From: Guru Geek [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 2:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Backing Up Tables Using PHP


Hello,

Trying to author my own PHP database table back up utility.  A very
simple one at that...

Here's my sql statement to select everything in the table:

$sql_daily = "SELECT * FROM dailytable";
$run_sql_daily = mysql_query($sql_daily);
$result_sql_daily = mysql_fetch_array($run_sql_daily);

Here's the code for showing me whats in the result array:

for ($count_daily=0; $count_daily < count($result_sql_daily);
$count_daily++)
 {
 echo "";
 echo "$result_sql_daily[$count_daily]";
 }
exit;


Does anyone out there know why it only prints one line of the table?
It's a line in the middle of the table, it's not the first line, it's
not the last line, it's in the middle of about 25 lines.

Is this not the proper way to back up tables in a database?  I'd like a
back up copy of my tables on CD-ROM and I thought once this prints out
correctly I'd just have it print to a text file and then place the text
file on a cd

Thanks,
Roger



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



Re: [PHP] MySQL and phpMyAdmin Issues

2003-03-25 Thread Charles Kline
I am by no means an expert (even remotely) but I do recall instructions 
on exactly how to do this in the documentation for MySQL - I think 
under the "how to upgrade" section.

- Charles

On Monday, March 3, 2003, at 06:53 PM, Stephen Craton wrote:

Hello,

Yesturday I made a big mistake. I had to import a 60MB file into a 
database
and I used ssh. I'm very unfamiliar with it and when I connected to the
MySQL connection thing, I forgot to switch databases when I imported. 
This
overwrite (I don't know why but it did) the users table in the mysql
database and caused everything to get messy.

For some reason, though, the sites on the server are still working with
their old MySQL username and password (I'm not sure why since I 
imported a
fresh install's mysql database from my local server). Everything seems 
to be
working except phpMyAdmin. When I try logging in using the default 
user as
root and password as nothing, it gives me an access denied error. It 
does
this for every user we had in the database as well. Is there anyway I 
can
fix this is ssh? The only option I can think of is reinstalling MySQL 
but
even then we'll loose all the old databases and I'm not sure how to 
export
the tables to a file in ssh.

Any help here would be most obliging and I need a reply rather 
urgently in
order to allow my hosted sites access to phpMyAdmin once again...

Thanks,
Stephen Craton
http://www.melchior.us
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


RE: [PHP] Re: Formatting code.

2003-03-25 Thread daniel
this code doc is excellent thanks , although some of it i agree on but i do 
differently , naming conventions etc .. i usually follow the PEAR standard 
although i dont do any pear code , its been the best thing ever to happen for 
php , as for a newbie when pear first came around it helped alot , its the 
only way i got my head around learning OO.

>= Original Message From Philip Hallstrom <[EMAIL PROTECTED]> =
>here's one.
>
>http://utvikler.start.no/code/php_coding_standard.html
>
>google will probably find a lot more... maybe not all PHP specific, but
>still relevant.
>
>On Wed, 26 Mar 2003, Philip J. Newman wrote:
>
>> Is there any documents on how code should be layed out?
>>
>>
>> --
>> Philip J. Newman.
>> Head Developer
>> [EMAIL PROTECTED]
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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



[PHP] formatting textarea input on output

2003-03-25 Thread Charles Kline
hi all,

i have a textarea in a form which gets inserted into a table in my 
database (mySQL). When displaying this text back to the screen, how do 
i retain the line breaks etc. that were in the original input?

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


Re: [PHP] is this correct? regular expressions

2003-03-25 Thread Ernest E Vogelsinger
At 23:22 25.03.2003, Jay Paulson said:
[snip]
>just trying to say if $phone isn't all numbers set it to all zeros.. so is 
>that right? cause i can't seem to get it to work.
>
>   if (!ereg("^[0-9]$",$phone)) {
>$phone = "00";
>   }
>
>thanks!
[snip] 

This is "if $phone is anything else than a single digit". You need to add
either a plus or an asterisk after the closing bracket to denote multiple
instances of the character set:
  if (!ereg("^[0-9]*$",$phone)) {

You could also check if anything _not_ being a number exists within $phone:
  if (ereg("[^0-9]",$phone)) {



-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] is this correct? regular expressions

2003-03-25 Thread Jay Paulson
just trying to say if $phone isn't all numbers set it to all zeros.. so is that right? 
cause i can't seem to get it to work.

   if (!ereg("^[0-9]$",$phone)) {
$phone = "00";
   }

thanks!

RE: [PHP] flush not flushing?

2003-03-25 Thread daniel
hi , i have had similar issues its worked by doing a ob_flush before flush 
then u want a sleep statement so maybe try

ob_flush();
flush();
sleep(2);

??

>= Original Message From Bryan Koschmann - GKT <[EMAIL PROTECTED]> =
>Hello,
>
>I'm including a script I use to automatically e-mail overdue customers. My
>problem is I have to have it sleep to avoid upsetting the mailserver, but
>when I do, it seems to pause and sleep the total time (number of users x
>sleep(1)) then output the whole block. I'm testing it now by printing the
>name and email to the screen.
>
>Instead of:
>
>Customer 1 - [EMAIL PROTECTED]
>pause 1 sec
>Customer 2 - [EMAIL PROTECTED]
>pause 1 sec
>Customer 3 - [EMAIL PROTECTED]
>pause 1 sec
>
>I get
>
>big big big pause
>Customer 1 - [EMAIL PROTECTED]
>Customer 2 - [EMAIL PROTECTED]
>Customer 3 - [EMAIL PROTECTED]
>
>
>Here is the script. Any help would be great!
>
>Thanks,
>
>   Bryan
>
>
>
>
>$myname = "My Company";
>$myemail = "[EMAIL PROTECTED]";
>
>$now = strtotime("now");
>$nowdate = date("l, F jS Y", $now);
>$nowtime = date("H:i", $now);
>$nowmonth = date("F", $now);
>$nowyear = date("Y", $now);
>
>$duedate = strtotime("25 $nowmonth $nowyear");
>$duedate = date("l, F jS Y", $duedate);
>
>$t = mktime(0,0,0,date('m')+1,1,date('Y'));
>$expdate = date("l, F jS Y", $t);
>
>$expdatenum = date("w", $t);
>
>if ($expdatenum == "6") {
>$rendate = date("l, F jS Y", strtotime("$expdate +2 days"));
>} else {
>$rendate = date("l, F jS Y", strtotime("$expdate +1 day"));
>}
>
>
>$query = htmlspecialchars("execute goToExpire");
>
>$fp = fsockopen ("111.222.333.444", 45678, $errno, $errstr, 30);
>
>// return_format can be either "delimited" or "xml"
>$connect = "
>
>   
>   Provider=SqlOleDb;
>   Data Source=(local);
>   Initial Catalog=MyCompany;
>   Integrated Security=SSPI;
>   
>   
>   delimited
>   ~
>   
>   
>   
>   $query
>   
>
>";
>
>$usercount = "0";
>
>if (!$fp) {
>   echo "$errstr ($errno)\n";
>} else {
>   fputs ($fp, "$connect");
>   flush();
>
>   // Create some headings for the table
>
>   while (!feof($fp)) {
>   $buffer = fgets($fp, 4096);
>   $row = explode('~', $buffer);
>
>   if (!empty($row[0])) {
>   if ($row[0] == "ERROR") {
>   echo " color=#ff>$row[0]: $row[1] 
$row[2]\n";
>   } else {
>   if (username($row[4]) !== "") {
>
>   $isbiz = str_replace("\r\n", "", $row[6]);
>   $accountnum = account($row[0]);
>   $amountdue = amount($row[5]);
>
>   if ($isbiz == "True") {
>   $fullname = name($row[1]);
>   } elseif ($isbiz == "False") {
>   if (miname($row[3]) == "") {
>   $fullname = name($row[2]) . " " . 
> name($row[1]);
>   } else {
>   $fullname = name($row[2]) . " " . 
> miname($row[3]) . " " . name($row[1]);
>   }
>   }
>   flush();
>   $subject = "Account Status: #" . account($row[0]);
>   $message =  "\r\n" .
>   "$fullname\r\n" .
>   "Account #" . account($row[0]) . 
> "\r\n\r\n" .
>   "Payment Reminder!\r\n\r\n" .
>   "Our records indicate that we have not 
> received your payment of 
\$$amountdue due\r\n" .
>   "on $duedate for your Internet access 
> account. Please\r\n" .
>   "send in your payment to prevent any 
> interruption in your service. 
Any\r\n" .
>   "accounts with an open balance will 
> expire on $expdate\r\n" .
>   "at 5:00pm, and cannot be reactivated 
> until $rendate at 
9:00am.\r\n\r\n" .
>   "If you have already sent in payment, 
> please disregard this reminder. 
If\r\n" .
>   "you believe your account to be 
> up-to-date or believe this message to 
be in\r\n" .
>   "error, feel free to call us at (555) 
> 123-4567 or reply to this message 
to\r\n" .
>   "discuss your account.\r\n\r\n\r\n" .
>   "\tMy COmpany\r\n"

[PHP] Backing Up Tables Using PHP

2003-03-25 Thread Guru Geek
Hello,

Trying to author my own PHP database table back up utility.  A very
simple one at that...

Here's my sql statement to select everything in the table:

$sql_daily = "SELECT * FROM dailytable";
$run_sql_daily = mysql_query($sql_daily);
$result_sql_daily = mysql_fetch_array($run_sql_daily);

Here's the code for showing me whats in the result array:

for ($count_daily=0; $count_daily < count($result_sql_daily);
$count_daily++)
 {
 echo "";
 echo "$result_sql_daily[$count_daily]";
 }
exit;


Does anyone out there know why it only prints one line of the table?
It's a line in the middle of the table, it's not the first line, it's
not the last line, it's in the middle of about 25 lines.

Is this not the proper way to back up tables in a database?  I'd like a
back up copy of my tables on CD-ROM and I thought once this prints out
correctly I'd just have it print to a text file and then place the text
file on a cd

Thanks,
Roger






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



Re: [PHP] Finding out which file is retrieved over HTTP

2003-03-25 Thread Jens Lehmann
Ernest E Vogelsinger wrote:
At 20:48 25.03.2003, Jens Lehmann spoke out and said:
[snip]
To actually check on the HTTP status codes you need to run your own, either
using cURL, or by doing your own stuff using fsockopen().
I tried using fsockopen(), but still experience a problem, I want to use 
the following script to retrieve both, the headers and the actual file:


You need to transmit the "Host:" header so the web server has a chance to
know which virtual host you want to reach. Ideally you would also tell the
server what type of content you can handle (see below). Also note that the
"correct" line ending for MIME headers is always CRLF ("\r\n"):
$hostname = 'www.example.com';
$file = '/index.php';
$ip = gethostbyname($hostname);
$fp = fsockopen($ip, 80, &$errno, &$errstr);
if ($fp)
{
fputs( $fp, "GET ".$file." HTTP/1.0\r\n" .
 "Host: $hostname\r\n" .
 "Accept: text/html\r\n" .
 "Accept: text/plain\r\n\r\n" );
$src = '';
while (!feof ($fp))
$src .= fgets($fp, 4096);
fclose ($fp);
}

This will get you the whole page, including all headers.
Thank you! This works fine. I can use this for reading the HTTP-Status.

Jens

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


[PHP] Re: Formatting code.

2003-03-25 Thread Philip Hallstrom
here's one.

http://utvikler.start.no/code/php_coding_standard.html

google will probably find a lot more... maybe not all PHP specific, but
still relevant.

On Wed, 26 Mar 2003, Philip J. Newman wrote:

> Is there any documents on how code should be layed out?
>
>
> --
> Philip J. Newman.
> Head Developer
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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



[PHP] Formatting code.

2003-03-25 Thread Philip J. Newman
Is there any documents on how code should be layed out?


--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]


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



[PHP] forcing a reload from a redirect

2003-03-25 Thread Mike Scalora
I have two pages, foo.php and bar.php. bar.php redirects the user to foo.php
with the following code:

 header("Location: http://".$_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "foo.php");

Normally, I want the browser to cache foo.php, it's content is fairly
static. But, bar.php makes changes that will cause foo.php to change. How do
I force foo.php to reload from the server whne I do this redirect? I've seen
code that adds a random number as a search string on the end of the URL, but
I want to avaoid that if possible.

-Mike



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



Re: [PHP] variables??

2003-03-25 Thread Dave O'Meara
It is considered more secure to declare the variable explicitly.

$var = $_GET["var"];

> > I'm having a problem with form data being recognized by a php script.
> > If I send information with a GET the variable data appears in $GET[var]
> > but not $var.  >



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



Re: [PHP] Default setting garbage

2003-03-25 Thread Kevin Stone

- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 2:10 PM
Subject: [PHP] Default setting garbage


Why is it that when I send call this function:
function GetNextDate($whichfriday, $month = "", $frequency = 1, $basedate =
"")

with this line:
GetNextDate("4", "2003-03", "5");

that $frequency ends up ""? Whether I set it myself when I call the
function, or I leave it blank and let the function set it itself, it ends up
with nothing in it. empty() returns 1, while isset() returns nothing on
this.



Good question.  Are you certain your not misspelling "frequency" when you
check it or try to look at it?  Sorry if that sounds insulting.. just trying
to search for the simplest explaination.  : <
- Kevin



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



Re: [PHP] Default setting garbage

2003-03-25 Thread Liam Gibbs
<>

No, no. Not insulting at all. That's often my problem. But not in this case.
I even went to the 'trouble' of copying and pasting $frequency wherever I
needed.


Original problem:
> Why is it that when I send call this function:
> function GetNextDate($whichfriday, $month = "", $frequency = 1, $basedate
=
> "")
>
> with this line:
> GetNextDate("4", "2003-03", "5");
>
> that $frequency ends up ""? Whether I set it myself when I call the
> function, or I leave it blank and let the function set it itself, it ends
up
> with nothing in it. empty() returns 1, while isset() returns nothing on
> this.


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



RE: [PHP] Using include() or require() with PDF module

2003-03-25 Thread Daevid Vincent
Two things come to mind... 
First, make sure the file is indeed being included/required and you don't
have your paths messed up.

Second, make sure you have the PDF stuff compiled into PHP.
Make a page with  as the only thing in it, then load it
in your web browser and find the words "PDF" in there.

I've not used PDF myself, so that's about the extent of my help. Sorry.

d

> -Original Message-
> From: Bill Hudspeth [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 24, 2003 11:50 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Using include() or require() with PDF module
> 
> 
> I wish to use the include() and/or the require() functions to 
> include a
> block of PHP multiple times in my file. The block contains code for
> outputting PDF elements. Although other external code (functions for
> example) are successfully referenced using these commands, 
> the PHP's PDF
> functions don't seem to work.
> 
> Any ideas?
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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



Re: [PHP] variables??

2003-03-25 Thread Kevin Stone

- Original Message -
From: "Rick Gaine" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 1:25 PM
Subject: [PHP] variables??


>
> I'm having a problem with form data being recognized by a php script.
> If I send information with a GET the variable data appears in $GET[var]
> but not $var.  I just upgraded to php4.2.2 and then 4.3.1 and I've been
> having this problem.  I didn't have the problem with older versions.  I
> suspect it is a configuration option I missed some place, just don't know
> what one.  Also, the new 4.3.1 and one of my scripts fails because fopen()
> can't find a file, yet this works on the older version.  Any help is
> appreciated.
>
> Rick

Rick, this is an option in your php.ini file called "register_globals".  Set
this to ON if you want this feature.

HTH,
Kevin



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



[PHP] Default setting garbage

2003-03-25 Thread Liam Gibbs
Why is it that when I send call this function:
function GetNextDate($whichfriday, $month = "", $frequency = 1, $basedate = "")

with this line:
GetNextDate("4", "2003-03", "5");

that $frequency ends up ""? Whether I set it myself when I call the function, or I 
leave it blank and let the function set it itself, it ends up with nothing in it. 
empty() returns 1, while isset() returns nothing on this.


Re: [PHP] Grabbing image information from an html string

2003-03-25 Thread Kevin Stone
You need to use preg_match_all() and a more greedy expression that is not
case sensitive..

preg_match_all('/src="(\S*)"/i', $html, $matches);
$image_array = $matches[1];

HTH,
Kevin



- Original Message -
From: "Dan Rossi" <[EMAIL PROTECTED]>
To: "Luis Lebron" <[EMAIL PROTECTED]>; "Php-General (E-mail)"
<[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 12:39 PM
Subject: RE: [PHP] Grabbing image information from an html string


> if (preg_match('/(href|HREF)="?(\S+\.(jpg|png))">?/',$line, $matches)){
> $filename[] = $matches[2];
> }
>
> -Original Message-
> From: Luis Lebron [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 26, 2003 7:07 AM
> To: Php-General (E-mail)
> Subject: [PHP] Grabbing image information from an html string
>
>
> Let say I have an html string that looks like this:
>
> Title
> foo bar bar foo src="graphics/image2.jpg">Some more text.
>
> I would like to pull the image filenames from the html and end up with
> something like this
>
> $images=array("image1.jpg", "image2.jpg")
>
> How can I do this?
>
> thanks,
>
> Luis R. Lebron
> Project Manager
> Sigmatech, Inc
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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



RE: [PHP] Grabbing image information from an html string

2003-03-25 Thread Dan Rossi
if (preg_match('/(href|HREF)="?(\S+\.(jpg|png))">?/',$line, $matches)){
$filename[] = $matches[2]; 
}

-Original Message-
From: Luis Lebron [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 7:07 AM
To: Php-General (E-mail)
Subject: [PHP] Grabbing image information from an html string


Let say I have an html string that looks like this:

Title
foo bar bar fooSome more text.

I would like to pull the image filenames from the html and end up with
something like this

$images=array("image1.jpg", "image2.jpg")

How can I do this?

thanks,

Luis R. Lebron
Project Manager
Sigmatech, Inc


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



[PHP] variables??

2003-03-25 Thread Rick Gaine

I'm having a problem with form data being recognized by a php script.
If I send information with a GET the variable data appears in $GET[var]
but not $var.  I just upgraded to php4.2.2 and then 4.3.1 and I've been
having this problem.  I didn't have the problem with older versions.  I
suspect it is a configuration option I missed some place, just don't know
what one.  Also, the new 4.3.1 and one of my scripts fails because fopen()
can't find a file, yet this works on the older version.  Any help is
appreciated.

Rick



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



[PHP] Re: Please point me in the right direction

2003-03-25 Thread rush
"Jerry" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As I am very unfamiliar with the PHP environment, can someone point in the
> right direction? If I use PHP for the front-end, what is the best tool to
> create the CGI? I was considering using Python, but would Pearl be better?

OO in PHP is less than perfect, but in many cases you could probably stick
to the PHP, and avoid a hassle of mixed system.

rush
--
http://www.templatetamer.com/




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



Re: [PHP] Finding out which file is retrieved over HTTP

2003-03-25 Thread Ernest E Vogelsinger
At 20:48 25.03.2003, Jens Lehmann spoke out and said:
[snip]
>> To actually check on the HTTP status codes you need to run your own, either
>> using cURL, or by doing your own stuff using fsockopen().
>
>I tried using fsockopen(), but still experience a problem, I want to use 
>the following script to retrieve both, the headers and the actual file:

You need to transmit the "Host:" header so the web server has a chance to
know which virtual host you want to reach. Ideally you would also tell the
server what type of content you can handle (see below). Also note that the
"correct" line ending for MIME headers is always CRLF ("\r\n"):

$hostname = 'www.example.com';
$file = '/index.php';

$ip = gethostbyname($hostname);
$fp = fsockopen($ip, 80, &$errno, &$errstr);
if ($fp)
{
fputs( $fp, "GET ".$file." HTTP/1.0\r\n" .
 "Host: $hostname\r\n" .
 "Accept: text/html\r\n" .
 "Accept: text/plain\r\n\r\n" );

$src = '';
while (!feof ($fp))
$src .= fgets($fp, 4096);
fclose ($fp);

}

This will get you the whole page, including all headers.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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



[PHP] Grabbing image information from an html string

2003-03-25 Thread Luis Lebron
Let say I have an html string that looks like this:

Title
foo bar bar fooSome more text.

I would like to pull the image filenames from the html and end up with
something like this

$images=array("image1.jpg", "image2.jpg")

How can I do this?

thanks,

Luis R. Lebron
Project Manager
Sigmatech, Inc


Re: [PHP] warning when I compile PHP

2003-03-25 Thread Marek Kilimajer
As long as everything is working, ignore it.

Richard Kurth wrote:

What does this mean I get this when I compile PHP. It is all
 through the out put when make is run. What can I do to make it not
 be there
cc1: warning: changing search order for system directory "/usr/include"
cc1: warning:   as it has already been specified as a non-system directory
 
 



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


RE: [PHP] Mac IE File download problem - any solutions?

2003-03-25 Thread Jennifer Goodie
This is not a MAC IE problem, it is the way browsers work.  If the MIME type
is mapped to an application, the browser will launch the application.  IE
does it inline, while Netscape tends to launch it separately.

You can send false headers with a made up type and a missing file extension,
but then the browser will not know what type of file it is and the save as
is harder for the user as they have to put the right extension on.  It is a
work around, but a really poor one.

header("Content-disposition: filename=$filenamewithoutextension");
header("Content-type:reallyreallyreallybigcsv");




-Original Message-
From: Step Schwarz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 11:49 AM
To: Daniel Leighton; [EMAIL PROTECTED]
Subject: Re: [PHP] Mac IE File download problem - any solutions?


[...]
> The problem:  When downloading certain files on a Mac using IE 5.x, files
are
> displayed within a browser window instead of downloading.  This seems to
occur
> mostly with quicktime files (.mov, .mp3).  Some quicktime files work,
while
> others with the same extension do not.
[...]

Hi Daniel,

I believe this is a browser setting, is it not?  Using the default setup of
Explorer 5.2 for Mac, a clicked .mov file will play in IE.

To change this behavior, go to Explorer > Preferences... > File Helpers,
select QuickTime Movie and click Change... then switch Handling from "View
with Browser" to "Save to File".

I would be surprised if a file header could override this.. but if you find
a way, please let us know!

-Step



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



Re: [PHP] newbie:restricting users to change data in a textarea

2003-03-25 Thread Step Schwarz
Hi Mirco,

Try adding either "readonly" or "disabled" to the textarea tag:

> print " cols=10>".stripslashes($row['variable'])."";

Hope this helps, -Step

[...]
> There is one field that I whant to stop them from changing. This field I also
> use in my sql query when updating the table,ie. where variable='$variable'. So
> what I did was simply this:
> 
> "\n";
> print "\t$variable\n";
> print "\n";
> 
> instead of:
> 
> print " cols=10>".stripslashes($row['variable'])."";
> 
> This definately stopped them from editing it but also disabled the mysql
> query from working. Can anyone just give me a couple of ideas how I can make
> this work.
> 
> Thanks
> Mirco


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



Re: [PHP] substr() on part an ereg() capture

2003-03-25 Thread Marek Kilimajer
$str = preg_replace('|(]*>[^<]{55})[^<]+()|','$1...$2', $str);

Justin French wrote:

Hi, I have this ereg to turn URLs into links:

eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str);
... found it in the manual i think, or maybe on weberdev.com examples

Anyhoo, it places the whole link in between the  and , which is
fine for short links, but on longer links (in my case, around 60+ chars), it
messes with my table or CSS layout.
So, I'd like to subtr() the 2nd capture part down to 55 chars or something
IF it's longer than 60, and append a ... to it.
ANY ideas on how this is done?  Or is this beyond regexp??

TIA

Justin

 



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


Re: [PHP] counting ..

2003-03-25 Thread Sebastian
because my comment system is pretty much like forum style, sometimes a user
referrers to another comment by it's number, etc...

.. and because i want to ;)

cheers,
- Sebastian

- Original Message -
From: "Leif K-Brooks" <[EMAIL PROTECTED]>


| Why do you think comment needs a number in the first place?


| Sebastian wrote:
|
| >Hello all.
| >
| >rather dumb question.
| >
| >I have a pagination system, 25 results per page, which are user comments,
I
| >want to put a number on each comment so i am doing something like:
| >
| >$num=$num + 1;
| >$number = $num;
| >echo $number;
| >
| >But when i switch to the next 25 results it starts counting from 1 again,
| >LoL.
| >
| >So i have to use $_GET right? If so can someone give me an example.
| >
| >Thanks in advanced.
| >
| >
| >cheers,
| >- Sebastian
| >
| >
| >
|
| --
| The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
|
|
|
|
| --
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
|


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



[PHP] warning when I compile PHP

2003-03-25 Thread Richard Kurth
What does this mean I get this when I compile PHP. It is all
  through the out put when make is run. What can I do to make it not
  be there

cc1: warning: changing search order for system directory "/usr/include"
cc1: warning:   as it has already been specified as a non-system directory
  
-- 
Best regards,
 Richard  mailto:[EMAIL PROTECTED]


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



Re: [PHP] openssl php 4.3.1

2003-03-25 Thread Kalin Mintchev
On Tue, 25 Mar 2003, The Doctor wrote:

> On Mon, Mar 24, 2003 at 11:15:05PM -0500, Kalin Mintchev wrote:
> >
> > hi all,
> >
> > i have problems getting fopen() and fsockopen() to work over https..
> >
> > here is the problem..
> >
> > from the phpinfo:
> >
> > OpenSSL support enabled
> > OpenSSL Version OpenSSL 0.9.6h 5 Dec 2002
>
> OpenSSL 0.9.6h has a security vulnerability.

which one doesn't?!

i don't think that's the problem of not getting it to work with fopen()
and fsockopen() what about the curl issue??? cutting off the
document???

is anybody that has had to deal with this problems on this list?
i don't know where else to ask...

>
> PLEASe check http://www.openssl.org
>
> >
> > from php -m
> >
> > # php -m
> > [PHP Modules]
> > ctype
> > mysql
> > openssl
> > overload
> > pcre
> > posix
> > session
> > standard
> > tokenizer
> > xml
> >
> > [Zend Modules]
> >
> >
> > from the Appendix I regarding fopen() on php.net:
> >
> > Note: HTTPS is supported starting from PHP 4.3, if you have compiled in
> > support for OpenSSL.
> >
> > and from the documentation on fsockopen() on php.net:
> > As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix
> > the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
> > connection over TCP/IP to connect to the remote host.
> >
> > in a test file i have two lines of code like this:
> >
> > $file = "https://someurl.com";;
> > if (!($fp = fopen($file, "r")))
> >
> > this produces an error but it doesn't point to any problem - like this:
> > Warning: fopen(https://someurl.com..  in /path/to/file.php on line
> > 45
> >
> > if i change $file to "http://someurl.com"; it works fine...
> >
> > with fsockopen() the situation is kinda the same. code:
> > $fp=fsockopen("ssl://www.foo.com", 443);
> >
> > error:
> > Warning: fsockopen() [function.fsockopen]: no SSL support in this build in
> > /path/to/file/...
> >
> > if i pul out the ssl:// part it works fine...
> >
> > now, i did read the posts on this list about curl. why curl isn't
> > mentioned anywhere in the documentation for fopen() and fsockopen() if
> > it's needed for those functions?
> > why would i need curl compiled in php if i already have openssl compiled with
> > it?
> >
> > the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL
> > 0.9.6h, php is 4.3.1...
> >
> > i did similar posts on other php lists but everybody's quite..
> >
> > thanks
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>


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



Re: [PHP] Checking for existence of file

2003-03-25 Thread CPT John W. Holmes
> What I'd like to do is check the directory 'images' first to see if
> 'mast_$img_pick.jpg' exists and if it doesn't, call a different image such
> as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to
> start.

Maybe you can start with file_exists() or is_file() and somehow work from
there???

---John Holmes...


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



Re: [PHP] Checking for existence of file

2003-03-25 Thread Jason Wong
On Wednesday 26 March 2003 03:12, Verdon Vaillancourt wrote:

> I've got a function (crude but works) that checks for a value in the url
> and then I call an image based on that value.
>
> if (isset($_GET['menu'])) {
> $img_pick = substr($_GET['menu'],0,1);
> } else { $img_pick = "1"; }
>
> echo "";
>
> What I'd like to do is check the directory 'images' first to see if
> 'mast_$img_pick.jpg' exists and if it doesn't, call a different image such
> as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to
> start.

is_file()

-- 
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
--
/*
Happiness is just an illusion, filled with sadness and confusion.
*/


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



Re: [PHP] How to solve include_path / safe_mode / open_basedir /document_root?

2003-03-25 Thread Marek Kilimajer
/safe_mode_include_dir/ *string* 

   UID/GID checks are bypassed when including files from this directory
   and its subdirectories (directory must also be in include_path
    or full path must including).
   As of PHP 4.2.0, this directive can take a *semi-colon separated
   path* in a similar fashion to the include_path
    directive, rather than
   just a single directory.


Robert Mena wrote:

Hi,  I host some virtual servers in a Linux/apache/php
4 enviroment.
I'd like to set up as secure as possible since the
users have ftp access to upload files.
So each virtual domain has a safe_mode/open_basedir
settings in order to make it difficult to mess with
each other's files.
Unfortunatelly this seems to have a side effect. 
Whenever I need to provide tools/classes such as
Jpgraph, Smarty and so on I have to copy to the user's
directory since the include_path could not reach
outside the document root/open_basedir directory.

So, is there a way to configure so I have a "secure"
enviroment and yet be able to define a common
repository.
Regards.

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
 



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


[PHP] Checking for existence of file

2003-03-25 Thread Verdon Vaillancourt
HI :)

I've got a function (crude but works) that checks for a value in the url and
then I call an image based on that value.

if (isset($_GET['menu'])) {
$img_pick = substr($_GET['menu'],0,1);
} else { $img_pick = "1"; }

echo "";

What I'd like to do is check the directory 'images' first to see if
'mast_$img_pick.jpg' exists and if it doesn't, call a different image such
as 'mast_default.jpg'. I'm sure this isn't hard, I'm just not sure how to
start.

TIA, verdon
Ps. Please cc me if replying to list


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



Re: [PHP] Array query

2003-03-25 Thread Marek Kilimajer
www.php.net/array_diff

shaun wrote:

Hi,

say I have two arrays: X and Y. How can i get the values I X that arent in Y
and assign them to another array?
Thanks



 



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


[PHP] Array query

2003-03-25 Thread shaun
Hi,

say I have two arrays: X and Y. How can i get the values I X that arent in Y
and assign them to another array?

Thanks



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



[PHP] How to solve include_path / safe_mode / open_basedir /document_root ?

2003-03-25 Thread Robert Mena
Hi,  I host some virtual servers in a Linux/apache/php
4 enviroment.

I'd like to set up as secure as possible since the
users have ftp access to upload files.

So each virtual domain has a safe_mode/open_basedir
settings in order to make it difficult to mess with
each other's files.

Unfortunatelly this seems to have a side effect. 
Whenever I need to provide tools/classes such as
Jpgraph, Smarty and so on I have to copy to the user's
directory since the include_path could not reach
outside the document root/open_basedir directory.

So, is there a way to configure so I have a "secure"
enviroment and yet be able to define a common
repository.

Regards.

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



[PHP] again: IIS vs Apache

2003-03-25 Thread matiasz
Hi, I'm new here. I imagine that this question was made a lot of times in this 
list, but reading the archive i couldnt find a recently answer to this 
question: 

   I want to convince my new lab partners (and director) to migrate our PHP 
site (over 1000 hits a day) to Apache/Linux. Could you give me some actual 
arguments or site to tell them? Is the Apache PHP module really better  than 
the isapi module for IIS. 

thanks in advance. Matts



-
This mail sent through IMP: http://mail.info.unlp.edu.ar/

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



RE: [PHP] substr() on part an ereg() capture

2003-03-25 Thread Boaz Yahav
Looks like this one :
http://examples.weberdev.com/get_example.php3?count=1567
so if someone manages to get this done, i would appreciate it if he can
add a comment.

thanks

berber

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 25, 2003 3:24 PM
To: php
Subject: [PHP] substr() on part an ereg() capture


Hi, I have this ereg to turn URLs into links:

eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $str);

... found it in the manual i think, or maybe on weberdev.com examples


Anyhoo, it places the whole link in between the  and , which
is fine for short links, but on longer links (in my case, around 60+
chars), it messes with my table or CSS layout.

So, I'd like to subtr() the 2nd capture part down to 55 chars or
something IF it's longer than 60, and append a ... to it.

ANY ideas on how this is done?  Or is this beyond regexp??


TIA

Justin


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


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



RE: [PHP] problems with rename() - permission denied

2003-03-25 Thread Don Read

On 25-Mar-2003 Christian Rosentreter wrote:
> 
> Hello,
> 
> I've a small problem, which mades me crazy... :\
> 
> I'm trying to rename() a swapfile to real destination file (atomic
> update).
> It works on differnt environments very well. Sadly not on my ISP-server
> I've added an "chmod($swapfile,0777)", but this has not solve the
> problem.
> The directories have all FULL access (read, write, etc.). The
> destiniation file
> too. I don't want 2 use the copy/unlink solution Do anyone have an
> idea? 
> 
> --- 8< ---
> 
> if ( $file = fopen($swapfile,"w") )
> {
> fwrite($file,$out);
> fclose($file);
> chmod($swapfile, 0777);
> 
> /* this fails with "Permission denied" */
> rename($swapfile,$filename);
> 
> /* ... but this works */
> copy($swapfile,$filename);
> unlink($swapfile);
> }
> 
> --- 8< 
> 

On *nix, rename will fail if source and destination are different file
systems.

To test this :

 copy($swapfile,$filename);
 clearstatcache();

 $src=stat($swapfile);
 $dst=stat($filename);

 printf('Source: %d, Dest: %d %s filesystem\n',
  $src[0], $dst, ($src[0] == $dst[0] ? 'same' : 'different'));



> 
> Thanks 4 help...
> --
> christian rosentreter
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)


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



Re: [PHP] Please point me in the right direction

2003-03-25 Thread John Hicks
PHP is extremely easy for an experienced programmer to pick 
up quickly (assuming you know the basics of tcp/ip and web 
architecture).

But experienced programmers also know the importance of the 
KISS principle. Why rewrite a system when you can port it?

Kylix allows you to use Delphi on Linux. If it limits you 
to using Redhat 7.2, that should be no problem provided you 
apply all relevant security patches (which Redhat is pretty 
good at providing).

In the meantime, start learning PHP. It is object oriented 
in its own way. When you are ready for a complete rewrite 
of the system, PHP may be all you need. A hybrid CGI/PHP 
system sounds unecessarily messy. (PHP can run in a CGI 
environment but is usually run in the more efficient Apache 
module environment.)

The above is just my two cents' worth. I haven't used Kylix 
or Delphi, but believe both are descended from Borland's 
original (Turbo) Pascal. I've been programming since '72 
but am new to PHP. I've been extremely gratified by how 
easy it's been to put together a relatively sophisticated 
system for a client in just a month or two after struggling 
for months to get Java and JSP to do much simpler tasks. 

--Frappy

On Tuesday 25 March 2003 11:09 am, you wrote:
> Hi All,
> I have a CGI application written in Delphi web services
> and I want to port it to the Linux environment. I was
> going to use Kylix but I'm concerned that Borland isn't
> keeping up with the fast paced Linux development (ie they
> are still on Redhat 7.2 and Redhat is about to release
> version 9.0 next month).
>
> The current CGI is a little complicated and relies
> heavily on OOP data structures. It processes the data
> then sends a stream to the web server for display in the
> browser. It's very fast and I am happy with the
> performace, but I must port it over to Linux.
>
> As I am very unfamiliar with the PHP environment, can
> someone point in the right direction? If I use PHP for
> the front-end, what is the best tool to create the CGI? I
> was considering using Python, but would Pearl be better?
>
> Any direction to get me started and headed in the right
> direction would be very appreciated
>
> Thanks,
> Jerry


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



Re: [PHP] Persistent connections with mysql_pconnect()

2003-03-25 Thread CPT John W. Holmes
> no, not at all... but there is a time and a place, and i don't think you
> should use pconnect just because you don't want to an include at the top
of
> every page.

You still have to call pconnect() on every page if you use it. It doesn't
leave it open for other requests, it leaves it open within the web server
program. pconnect() is only useful on certain OS using certain web servers.
Read the manual page on mysql_pconnect() for more information.

---John Holmes...

> - Original Message -
> From: "John Hicks" <[EMAIL PROTECTED]>
> To: "php" <[EMAIL PROTECTED]>
> Sent: Tuesday, March 25, 2003 5:11 PM
> Subject: [PHP] Persistent connections with mysql_pconnect()
>
>
> > On Tuesday 25 March 2003 09:02 am, "skate" <[EMAIL PROTECTED]> wrote:
> > > leaving the connection open creates security questions,
> > > and also leaves resources open, what if a user closes his
> > > browser window, how do you know to close the connection?
> >
> > So are you saying that persistent connections  [ i.e. mysql_pconnect() ]
> > should never be used?
> >
> > > if you really want to make it simple, you can edit your
> > > php.ini to have the username and password as default in
> > > there, but again, this can be a security risk.
> > >
> > > i'm afraid the best way is to include connection code on
> > > every page...
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] Persistent connections with mysql_pconnect()

2003-03-25 Thread skate
no, not at all... but there is a time and a place, and i don't think you
should use pconnect just because you don't want to an include at the top of
every page.

- Original Message -
From: "John Hicks" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 5:11 PM
Subject: [PHP] Persistent connections with mysql_pconnect()


> On Tuesday 25 March 2003 09:02 am, "skate" <[EMAIL PROTECTED]> wrote:
> > leaving the connection open creates security questions,
> > and also leaves resources open, what if a user closes his
> > browser window, how do you know to close the connection?
>
> So are you saying that persistent connections  [ i.e. mysql_pconnect() ]
> should never be used?
>
> > if you really want to make it simple, you can edit your
> > php.ini to have the username and password as default in
> > there, but again, this can be a security risk.
> >
> > i'm afraid the best way is to include connection code on
> > every page...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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



[PHP] Persistent connections with mysql_pconnect()

2003-03-25 Thread John Hicks
On Tuesday 25 March 2003 09:02 am, "skate" <[EMAIL PROTECTED]> wrote:
> leaving the connection open creates security questions,
> and also leaves resources open, what if a user closes his
> browser window, how do you know to close the connection?

So are you saying that persistent connections  [ i.e. mysql_pconnect() ]
should never be used?

> if you really want to make it simple, you can edit your
> php.ini to have the username and password as default in
> there, but again, this can be a security risk.
>
> i'm afraid the best way is to include connection code on
> every page...

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



[PHP] Please point me in the right direction

2003-03-25 Thread Jerry
Hi All,
I have a CGI application written in Delphi web services and I want to port
it to the Linux environment. I was going to use Kylix but I'm concerned that
Borland isn't keeping up with the fast paced Linux development (ie they are
still on Redhat 7.2 and Redhat is about to release version 9.0 next month).

The current CGI is a little complicated and relies heavily on OOP data
structures. It processes the data then sends a stream to the web server for
display in the browser. It's very fast and I am happy with the performace,
but I must port it over to Linux.

As I am very unfamiliar with the PHP environment, can someone point in the
right direction? If I use PHP for the front-end, what is the best tool to
create the CGI? I was considering using Python, but would Pearl be better?

Any direction to get me started and headed in the right direction would be
very appreciated

Thanks,
Jerry



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



[PHP] Problem with file_exists()

2003-03-25 Thread maillist
Hi,

I've been reported a weird problem with one of the scripts that we have, which 
uses the file_exists() function. It returned true once, and then the query 
ran again, and it reported false, on the same file. This was true for a lot 
of files in the same directory, but only over a cerain period of time. As I 
had time to try to investigate, the problem stopped occuring. This script has 
been used for a long time, and this is the first time that this has happened. 
I've checked some of the files that they were having problems with, and they 
have not been modified for a few days, so I doubt they were locked or 
anything like that. Does anyone have any idea what could be causing this? 
This is running Solaris 8, Apache 1.3.26 with PHP 4.2.1 compiled into it. 
I've also checked file permissions and they were all good. Any idea would be 
appreciated!

Thanks a lot,
Steve Johnson

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



Re: [PHP] counting ..

2003-03-25 Thread Jim Lucas
when it comes to the second page, you already know that page you are on
1,2,3,4...

take that and multiply it by the defined number of results per-page, then
start your counting.

Jim
- Original Message -
From: "Sebastian" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Monday, March 24, 2003 10:09 PM
Subject: [PHP] counting ..


> Hello all.
>
> rather dumb question.
>
> I have a pagination system, 25 results per page, which are user comments,
I
> want to put a number on each comment so i am doing something like:
>
> $num=$num + 1;
> $number = $num;
> echo $number;
>
> But when i switch to the next 25 results it starts counting from 1 again,
> LoL.
>
> So i have to use $_GET right? If so can someone give me an example.
>
> Thanks in advanced.
>
>
> cheers,
> - Sebastian
>


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



[PHP] XSLT processing DocBook files -> FO

2003-03-25 Thread Colin Viebrock
I'm trying to automatically convert DocBook XML files into PDFs using
PHP and the XSLT extension.  First step is to convert them into FO, but
I'm running into trouble with this script:

   'USletter',
'page.orientation'  => 'portrait',
  );
  $html = xslt_process($xslt, $xml, $xsl, NULL, $args, $params);
  if (!$html) {
die('XSLT processing error: '.xslt_error($xslt));
  }
  xslt_free($xslt);
  echo $html;

  ?>

I get the following parse warnings, and the output error:

  Warning: Sablotron error on line 244: variable 'page.orientation' not
found in /home/cmv/www/doc/index.php on line 15
  Warning: Sablotron error on line 254: variable 'paper.type' not found
in /home/cmv/www/doc/index.php on line 15
  Warning: Sablotron error on line 322: variable 'paper.type' not found
in /home/cmv/www/doc/index.php on line 15
  Warning: Sablotron error on line 322: circular reference to variable
'page.width.portrait' in /home/cmv/www/doc/index.php on line 15
  Warning: Sablotron error on line 190: variable 'page.height' not found
in /home/cmv/www/doc/index.php on line 15

  XSLT processing error: variable 'page.height' not found

How do I pass those variables/parameters to the XSLT process?  Has
someone else had experience with this?

(Cc me offlist in your replies, please.)

-- 
colineasydns com
  at dot


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



Re: [PHP] counting ..

2003-03-25 Thread Leif K-Brooks
Why do you think comment needs a number in the first place?

Sebastian wrote:

Hello all.

rather dumb question.

I have a pagination system, 25 results per page, which are user comments, I
want to put a number on each comment so i am doing something like:
$num=$num + 1;
$number = $num;
echo $number;
But when i switch to the next 25 results it starts counting from 1 again,
LoL.
So i have to use $_GET right? If so can someone give me an example.

Thanks in advanced.

cheers,
- Sebastian
 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP] PHP & grep

2003-03-25 Thread David T-G
Chris, et al --

...and then Chris Blake said...
% 
% Greetings learned PHP(eople)

Hiya!


% 
% I`m using the following to strip values out of a file, however, the file
% I`m accessing contains multiple instance of the search criteria, and I
% only wanna return the first instance
% I`m just getting an empty variable and can`t figure it out...
% 
% $criteria = `grep "Files :" logs/$file`;

Works for me.  Are you running under safe mode, which will turn off
backticks and shell_exec?


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!



pgp0.pgp
Description: PGP signature


Re: [PHP] Changing variables in a text file

2003-03-25 Thread Marek Kilimajer
If you know what is suposed to be in the file you can simply build up a 
new file. If you don't know what is in there but only that you need to 
change this to that, use file functions and regexes. You might also 
consider using an array instead of plain variables, so your file will become

$config['var1']="";
$config['var2']="";
$config['template']="blue";
$config['anothervar']="foo";
This will make updates easier, as you know you only need to write 
everything in $config.

Luis Lebron wrote:

I have a text file with a series of project variables.

For example
$var1="";
$var2="";
$template="blue";
$anothervar="foo";
Let say I need to change $template="blue"; to $template="red";. How can I do
that keeping the rest of the file intact?
thanks,

Luis 

 



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


[PHP] Changing variables in a text file

2003-03-25 Thread Luis Lebron
I have a text file with a series of project variables.

For example
$var1="";
$var2="";
$template="blue";
$anothervar="foo";

Let say I need to change $template="blue"; to $template="red";. How can I do
that keeping the rest of the file intact?


thanks,


Luis 


Re: [PHP] php regexp question

2003-03-25 Thread Marek Kilimajer
Just an idea:
In $string replace any occurence of ç to c, search for offsets of 
francoise, and then add bold tags at the offsets (and end tags at 
offsets +strlen('francoise')) in the original string.

cpaul wrote:

hi

i've made a small php site that is searching against french documents stored
in a mysql database.
when it comes to rendering search results, the client has asked if the words 
that were searched for can be highlighted.  

"no problem!" i thought.  just do a regexp replace and wrap a  tag around
the matching terms.  then i realised that the following would not produce
a match:
 $string = "Françoise";
 echo preg_match("/francoise/i",$string);
so my question since mysql managed to produce a match here, is there
perhaps a php regexp modifier that (maybe) knows how to make this match?


thanks

 



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


Re: [PHP] Disabling output control when using "ob_start"

2003-03-25 Thread Chris Hayes
At 15:41 25-3-2003, you wrote:
I posted this problem a week ago, but no one answered so I try again:

Is there a way to disable the call back function set by "ob_start"?
I tried:
ob_end_flush();
ob_end_clean();
ob_implicit_flush(true);
Nothing seams to work. I can't detect the call back function and I can't
prevent it either. The call back function is called no matter what!
Michael
What do you mean with callback function?
I simply do it this way:
ob_start();
include('modules/'.$file);
$content=ob_get_contents();
ob_end_clean();
which puts the contents of that file in $content.



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


Re: [PHP] session id

2003-03-25 Thread CPT John W. Holmes
> > can somebody tell me why I am getting this:
> > Warning: session_start() [function.session-start]: Cannot send session
> > cookie - headers already sent by (output started at
> > c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on
line 21
> >
> > Warning: session_start() [function.session-start]: Cannot send session
cache
> > limiter - headers already sent (output started at
> > c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on
line 21
> >
> >
> > when I use this code:
> >
> > session_start();
> > if (!isset($_SESSION['count'])) {
> >   $_SESSION['count'] = 0;
> > }
> >
> >
> > PHP is version 4.3.1
> >
> > thanx
> >
> >
>
> You cannot send any output until the session is set
>
> This includes html before the http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Disabling output control when using "ob_start"

2003-03-25 Thread Michael Heuser
I posted this problem a week ago, but no one answered so I try again:

Is there a way to disable the call back function set by "ob_start"?
I tried:
ob_end_flush();
ob_end_clean();
ob_implicit_flush(true);

Nothing seams to work. I can't detect the call back function and I can't
prevent it either. The call back function is called no matter what!

Michael



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



[PHP] Re: session id

2003-03-25 Thread Michael Heuser
The function session_start is sending a cookie. This means that you can't
echo anything before. Its the same rules as with setcookie.

"Iggy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> can somebody tell me why I am getting this:
> Warning: session_start() [function.session-start]: Cannot send session
> cookie - headers already sent by (output started at
> c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line
21
>
> Warning: session_start() [function.session-start]: Cannot send session
cache
> limiter - headers already sent (output started at
> c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line
21
>
>
> when I use this code:
>
> session_start();
> if (!isset($_SESSION['count'])) {
> $_SESSION['count'] = 0;
> }
>
>
> PHP is version 4.3.1
>
> thanx
>
>



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



Re: [PHP] session id

2003-03-25 Thread Ryan Gibson
On 25/3/03 2:37 pm, "Iggy" <[EMAIL PROTECTED]> wrote:

> can somebody tell me why I am getting this:
> Warning: session_start() [function.session-start]: Cannot send session
> cookie - headers already sent by (output started at
> c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21
> 
> Warning: session_start() [function.session-start]: Cannot send session cache
> limiter - headers already sent (output started at
> c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21
> 
> 
> when I use this code:
> 
> session_start();
> if (!isset($_SESSION['count'])) {
>   $_SESSION['count'] = 0;
> }
> 
> 
> PHP is version 4.3.1
> 
> thanx
> 
> 

You cannot send any output until the session is set

This includes html before the http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



php-general Digest 25 Mar 2003 14:41:21 -0000 Issue 1959

2003-03-25 Thread php-general-digest-help

php-general Digest 25 Mar 2003 14:41:21 - Issue 1959

Topics (messages 140912 through 140962):

Secure coockie is not available as variable
140912 by: Alexander Weber
140924 by: Ernest E Vogelsinger

Charset problem with DBF database
140913 by: Alexander Weber

ho to remove an empty space
140914 by: WebDev

openssl php 4.3.1
140915 by: Kalin Mintchev
140917 by: Kalin Mintchev
140959 by: The Doctor

counting ..
140916 by: Sebastian
140918 by: Nikunj Virani
140920 by: Sebastian
140922 by: Justin French

SetUID Scripts with PHP.
140919 by: Nikunj Virani

foreach() or for()
140921 by: Richard Whitney
140923 by: Tom Rogers

php regexp question
140925 by: cpaul

installing cUrl
140926 by: Diana Castillo

array into another site
140927 by: Fredrik
140928 by: Justin French
140932 by: Ernest E Vogelsinger

problems with rename() - permission denied
140929 by: Christian Rosentreter
140931 by: liljim

Spooky numbers
140930 by: Chris Blake

NewB Q on Arrays.
140933 by: inpho

Re: count up from 7
140934 by: David T-G

timout in mail script
140935 by: Wilbert Enserink
140937 by: Ernest E Vogelsinger
140938 by: W. Enserink
140941 by: Ernest E Vogelsinger

Re: mail() Bcc:
140936 by: David T-G

Re: Viewing PHP pages
140939 by: J.Veenhuijsen

Re: Finding out which file is retrieved over HTTP
140940 by: Jens Lehmann
140949 by: Ernest E Vogelsinger

php4isapi.dll
140942 by: Robin
140943 by: Nikunj Virani
140945 by: Robin
140947 by: Nikunj Virani

PHP & grep
140944 by: Chris Blake

curl
140946 by: Diana Castillo
140948 by: Nikunj Virani

substr() on part an ereg() capture
140950 by: Justin French
140951 by: skate

Benchmarking
140952 by: reven

connecting to mysql db
140953 by: Iggy
140954 by: Rankin, Randy
140955 by: Iggy
140956 by: Mirco Ellis
140957 by: Jon Haworth
140958 by: Mirco Ellis
140960 by: skate
140962 by: Chris Hayes

session id
140961 by: Iggy

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 ---
hello,

I send a secure cookie an it should be available as varible

setcookie("pbas_usr", $row[usr], time()+600, "", "", 1);

but the varable is empty. If it send the header without secure flag the
cookie works well

setcookie("pbas_usr", $row[usr], time()+600);

Is there a special way to read out secure cookies?


THX,

Alex


--- End Message ---
--- Begin Message ---
At 03:55 25.03.2003, Alexander Weber said:
[snip]
>I send a secure cookie an it should be available as varible
>
>setcookie("pbas_usr", $row[usr], time()+600, "", "", 1);
>
>but the varable is empty. If it send the header without secure flag the
>cookie works well
>
>setcookie("pbas_usr", $row[usr], time()+600);
>
>Is there a special way to read out secure cookies?
[snip] 

Is your script running under https?

 From the docs (http://www.php.net/manual/en/function.setcookie.php):
"secure" indicates that the cookie should only be transmitted over a secure
HTTPS connection. When set to 1, the cookie will only be set if a secure
connection exists. The default is 0. 

Sorry if I'm OT here but you didn't mention https in your posting.

-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
Hello,

I have a DBF database with some ASCII characters like ALT+154 (Ü) etc.
I read out the database but instead of an Ü i get an s.
Tried out charsetconverting from/to ASCII, UTF-8/7 and ISO, but nothing gave
me the rigth letter.

Anybody an idea?

THX

Alex



--- End Message ---
--- Begin Message ---
somehow when I have try to develop an application where I read five or six
values into an individual arrays the array who carries the emails has the
email and an additional empty field after the email somehow complex well
they way the information has been stored is that the email was the last
value in the line of arrays and somehow carries always an empty field or the
tab field I can see when I upload the data in binary mode however I tried
around for some time


how do remove an empty space in an erray I tried arround with

$E2= str_replace(" ", "", $Email);

and I tried as well
$E2= str_replace(" ", "", $Email); with no success it totally ignored
the empty space in the email  what is stored in this
way:|data1|data2|[EMAIL PROTECTED] |data3|etc...|||. when I p

Re: [PHP] connecting to mysql db

2003-03-25 Thread Chris Hayes
At 14:49 25-3-2003, you wrote:
hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code

mysql_select_db("test")
or die("Could not select database: " . mysql_error());
?>
maybe you are looking 
for:  http://www.php.net/manual/en/function.mysql-pconnect.php

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


[PHP] session id

2003-03-25 Thread Iggy
can somebody tell me why I am getting this:
Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21

Warning: session_start() [function.session-start]: Cannot send session cache
limiter - headers already sent (output started at
c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21


when I use this code:

session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}


PHP is version 4.3.1

thanx



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



Re: [PHP] connecting to mysql db

2003-03-25 Thread skate
leaving the connection open creates security questions, and also leaves resources 
open, what if a user closes his browser window, how do you know to close the 
connection?

if you really want to make it simple, you can edit your php.ini to have the username 
and password as default in there, but again, this can be a security risk.

i'm afraid the best way is to include connection code on every page...

-- 
skate - fatcuban.com
"Iggy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> This really doesn't explain me much. I mean the difference between having
> that code on every page or calling it from an external page doesn't tell me
> if it is realy necessary to do it all the time. I guess I am looking for
> more generic explanation of the whole process rather than what you said.
> 
> However I appreciate it much, since it seems to be much better coding
> practice
> 
> Iggy
> 
> 
> 
> "Randy Rankin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Place the code in a file ( ie; dbcon.php ) and include that file in any
> page
> > which may need it using an include statement: include("dbcon.php");
> >
> > Randy
> >
> > -Original Message-
> > From: Iggy [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 25, 2003 7:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] connecting to mysql db
> >
> >
> > hi,
> > I am trying to play and learn php along with mysql and I have a question
> > about connecting to a db.
> > Is the following code necessary on every php page where I am retrieving
> some
> > data from a db or is there any way to connect once (something like
> > index.php) and have that connection open through subsequent pages?
> > the code
> >  > $link = mysql_connect("localhost", "", "")
> > or die("Could not connect: " . mysql_error());
> > print ("Connected successfully");
> >
> > mysql_select_db("test")
> > or die("Could not select database: " . mysql_error());
> > ?>
> >
> > thanx
> > iggy
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

Re: [PHP] openssl php 4.3.1

2003-03-25 Thread The Doctor
On Mon, Mar 24, 2003 at 11:15:05PM -0500, Kalin Mintchev wrote:
> 
> hi all,
> 
> i have problems getting fopen() and fsockopen() to work over https..
> 
> here is the problem..
> 
> from the phpinfo:
> 
> OpenSSL support   enabled
> OpenSSL Version   OpenSSL 0.9.6h 5 Dec 2002

OpenSSL 0.9.6h has a security vulnerability.

PLEASe check http://www.openssl.org

> 
> from php -m
> 
> # php -m
> [PHP Modules]
> ctype
> mysql
> openssl
> overload
> pcre
> posix
> session
> standard
> tokenizer
> xml
> 
> [Zend Modules]
> 
> 
> from the Appendix I regarding fopen() on php.net:
> 
> Note: HTTPS is supported starting from PHP 4.3, if you have compiled in
> support for OpenSSL.
> 
> and from the documentation on fsockopen() on php.net:
> As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix
> the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
> connection over TCP/IP to connect to the remote host.
> 
> in a test file i have two lines of code like this:
> 
> $file = "https://someurl.com";;
> if (!($fp = fopen($file, "r")))
> 
> this produces an error but it doesn't point to any problem - like this:
> Warning: fopen(https://someurl.com..  in /path/to/file.php on line
> 45
> 
> if i change $file to "http://someurl.com"; it works fine...
> 
> with fsockopen() the situation is kinda the same. code:
> $fp=fsockopen("ssl://www.foo.com", 443);
> 
> error:
> Warning: fsockopen() [function.fsockopen]: no SSL support in this build in
> /path/to/file/...
> 
> if i pul out the ssl:// part it works fine...
> 
> now, i did read the posts on this list about curl. why curl isn't
> mentioned anywhere in the documentation for fopen() and fsockopen() if
> it's needed for those functions?
> why would i need curl compiled in php if i already have openssl compiled with
> it?
> 
> the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL
> 0.9.6h, php is 4.3.1...
> 
> i did similar posts on other php lists but everybody's quite..
> 
> thanks
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
Member - Liberal International  On 11 Sept 2001 the WORLD was violated.
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
Society MUST be saved! Extremists must dissolve.  
Quebec - elir les gagnant qui peut deplacer le PQ la plus  vite

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



RE: [PHP] connecting to mysql db

2003-03-25 Thread Mirco Ellis
This is the only way I know and probably the safest. This way you know there
is connectivity because it is loaded rigth at the beginning.

Mirco Ellis
I-Soft Solutions
e-mail: [EMAIL PROTECTED]
Tel: +27414847161


-Original Message-
From: Igor Frankovic [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 16:03
To: [EMAIL PROTECTED]
Subject: RE: [PHP] connecting to mysql db


But is it always necessary to do this or can you open this connection once
and have it open throughout the next few pages (or as needed) and then close
it?

> -Original Message-
> From: Mirco Ellis [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 8:00 AM
> To: 'Iggy'
> Cc: Php-General (E-mail)
> Subject: RE: [PHP] connecting to mysql db
>
>
> No dude. Create a file called whatever.inc that includes the
> code that you are using to connect to the db. In every php
> script ,that needs this connection to the db, you simply put:
>
>  include("whatever.inc");
> ?>
>
> Mirco Ellis
> I-Soft Solutions
> e-mail: [EMAIL PROTECTED]
> Tel: +27414847161
>
>
> -Original Message-
> From: Iggy [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 15:50
> To: [EMAIL PROTECTED]
> Subject: [PHP] connecting to mysql db
>
>
> hi,
> I am trying to play and learn php along with mysql and I have
> a question about connecting to a db. Is the following code
> necessary on every php page where I am retrieving some data
> from a db or is there any way to connect once (something like
> index.php) and have that connection open through subsequent
> pages? the code  or die("Could not connect: " . mysql_error());
> print ("Connected successfully");
>
> mysql_select_db("test")
> or die("Could not select database: " . mysql_error()); ?>
>
> thanx
> iggy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



RE: [PHP] connecting to mysql db

2003-03-25 Thread Jon Haworth
Hi Iggy,

> I mean the difference between having that code on 
> every page or calling it from an external page 
> doesn't tell me if it is realy necessary to do it 
> all the time. 

Yes, you do have to connect to the database in every script that needs to
access it. Usually this is done at the start of the script, along with any
calls to session_start() and other "global" stuff.

For convenience and ease of maintenance, however, it makes good sense to
write a separate file that does nothing but connect to the database. This
separate file then needs to be attached to the running script via include(),
at any point before the first call to the database.

HTH
Jon

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



RE: [PHP] connecting to mysql db

2003-03-25 Thread Mirco Ellis
No dude. Create a file called whatever.inc that includes the code that you
are using to connect to the db. In every php script ,that needs this
connection to the db, you simply put:



Mirco Ellis
I-Soft Solutions
e-mail: [EMAIL PROTECTED]
Tel: +27414847161


-Original Message-
From: Iggy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 15:50
To: [EMAIL PROTECTED]
Subject: [PHP] connecting to mysql db


hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code


thanx
iggy



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


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



Re: [PHP] connecting to mysql db

2003-03-25 Thread Iggy
This really doesn't explain me much. I mean the difference between having
that code on every page or calling it from an external page doesn't tell me
if it is realy necessary to do it all the time. I guess I am looking for
more generic explanation of the whole process rather than what you said.

However I appreciate it much, since it seems to be much better coding
practice

Iggy



"Randy Rankin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Place the code in a file ( ie; dbcon.php ) and include that file in any
page
> which may need it using an include statement: include("dbcon.php");
>
> Randy
>
> -Original Message-
> From: Iggy [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 7:50 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] connecting to mysql db
>
>
> hi,
> I am trying to play and learn php along with mysql and I have a question
> about connecting to a db.
> Is the following code necessary on every php page where I am retrieving
some
> data from a db or is there any way to connect once (something like
> index.php) and have that connection open through subsequent pages?
> the code
>  $link = mysql_connect("localhost", "", "")
> or die("Could not connect: " . mysql_error());
> print ("Connected successfully");
>
> mysql_select_db("test")
> or die("Could not select database: " . mysql_error());
> ?>
>
> thanx
> iggy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



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



  1   2   >