Re: [PHP] Re: More fun with sessions

2002-03-21 Thread scott furt

Also, if your sessions use a database, you could
do some SQL queries to see which sessions have
been loaded in the last few minutes.

Julio Nobrega wrote:
>   From all users on your site? I guess only if you open the directory where
> the session files are stored. And loop through the files, opening each one
> and interpreting the contents.
> 
> --
> Julio Nobrega.
> 
> Um dia eu chego lá:
> http://sourceforge.net/projects/toca
> 
> Ajudei? Salvei? Que tal um presentinho?
> http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
> "James Taylor" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 
>>How can I get a listing of all currently active sessions?
>>
> 
> 
> 



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




Re: [PHP] Apache

2002-03-21 Thread scott furt

Errmm... i don't know any apache groups, but
if you want to do what you ask, just read the
documentation, it's easy :-)

jtjohnston wrote:
> Anyone know of a good apache group?
> I want to hide the structure of a directory when there is no idex.html
> present 
> 
> J
> 
> 
> 



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




Re: [PHP] More on: how to send a file to the user's browser?

2002-03-19 Thread scott furt

... or mozilla :)

Jason Wong wrote:
> On Tuesday 19 March 2002 19:59, scott furt wrote:
> 
>>Are you using MSIE?
>>
>>what file extension are you testing with?
>>
>>i was having similar problems using this technique
>>with PDF files.  only with MSIE, sometimes it would
>>print text crap to the screen and sometimes it
>>would prompt for download.
>>
>>MSIE is notorious for disregarding headers and
>>trying to handle files off of their extensions.
>>
> 
> This is a problem that has been fixed, then broken, then fixed again in 
> various versions of IE. Best bet is to 'upgrade' to the latest version of IE, 
> or apply the weekly service pack, or better still use Opera ;-)
> 
> 
> 
> 



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




Re: [PHP] 100% repeatable problem with PHP 4.0.1 in WIN2k environment.

2002-03-19 Thread scott furt

So it seems to be that your header is failing then.

try using the full URL:
http://localhost/.../success.php
instead of just
"success.php"

and verify that it's spelled correctly and
is lowercase (if on a *nix system)

Balaji Ankem wrote:
> No it z not failing if I replace it.
> 
> -Original Message-
> From: scott furt [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, March 19, 2002 5:49 PM
> To: php
> Subject: Re: [PHP] 100% repeatable problem with PHP 4.0.1 in WIN2k
> environment.
> 
> 
> Try replacing header("Location: success.php")
> with something like echo "Here we are";
> 
> does it still fail?
> 
> (I cannot run your code here, becuase without
> your database schema, the mysql queries will
> all fail)
> 
> At a glance, I don't see any glaring errors
> with your script..
> 
> Balaji Ankem wrote:
> 
>>Hi scott,
>>  
>>Yes I examined..
>>It z dying in if loop (if $n==2) at the statement header("Location: 
>>success.php");
>> 
>>It will be helpful to me if u try to execute those files as I told.
>>
>>Thanks in advance
>>Balaji
>>
>>-Original Message-
>>From: scott furt [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, March 19, 2002 5:26 PM
>>To: php
>>Subject: Re: [PHP] 100% repeatable problem with PHP 4.0.1 in WIN2k
>>environment.
>>
>>
>>Have you examined the PHP error logs?
>>
>>Have you turned up error reporting to the max (E_ALL)
>>and examined what it returned?
>>
>>Have you examined $php_errmsg (if configured in php.ini)?
>>
>>Have you tried putting echo statements every few lines
>>to see exactly where and why the script dies?
>>
>>Balaji Ankem wrote:
>>
>>
>>>Hi,
>>> I am able to produce the following problem 100% in WINDOWS.
>>>
>>> Problem is u can not produce success message in new browser context
>>>..
>>>
>>> Error: php.exe has generated some errors and will be closed by
>>>windows.
>>>
>>> I am facing this problem from last 1 year.
>>>
>>>
>>>
>>
>>
>>--
>>--
>>
>>**Disclaimer**
>>**
>>  
>>
>>
>>Information contained in this E-MAIL being proprietary to Wipro 
>>Limited is 'privileged' and 'confidential' and intended for use only 
>>by the individual or entity to which it is addressed. You are notified
>>
> 
>>that any use, copying or dissemination of the information contained in
>>
> 
>>the E-MAIL in any manner whatsoever is strictly prohibited.
>>
>>
>>
>> 
>>
>>
>>
> 
> 
> 
> 
> 
> 
> **Disclaimer
>   
> 
> 
> Information contained in this E-MAIL being proprietary to Wipro Limited
> is 'privileged' and 'confidential' and intended for use only by the
> individual or entity to which it is addressed. You are notified that any
> use, copying or dissemination of the information contained in the E-MAIL
> in any manner whatsoever is strictly prohibited.
> 
> 
> 
>  
> 



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




Re: [PHP] Calling Javascript-function from php-script ...

2002-03-19 Thread scott furt

PHP cannot call a javascript function.

but PHP can examine the incoming variables
and then output Javascript to the browser
to do the appropriate work.

for example, calling $text.php?this=5
pops up an alert saying "this=5"

test.php
\n".
   "alert('this='+". $this .");\n".
   ""
?>


Marcel Besancon wrote:
> Hi,
> 
> i know that one is server-side and the other is client-side. But what i
> meant ist the following. I have a script with a form. By submitting this
> form and checking out some values php should call a javascript-function
> (such as an alert). You see the php-script shall call the
> javascript-function by "refreshing" the whole page.
> 
> Bye,
> 
> Marcel
> 
> --
> registered Fli4l-User #0388
> "Scott Furt" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 
>>Short answer: no.
>>
>>Long answer: have the PHP script output javascript code
>>to the browser.
>>
>>PHP = server-side
>>Javascript = client-side
>>
>>Marcel Besancon wrote:
>>
>>>Hi everybody,
>>>
>>>is there someone who can tell me how to call a javascript-function
>>>
> by a
> 
>>>php-script.
>>>
>>>Thanks for each answer
>>>
>>>Marcel
>>>
>>>--
>>>registered Fli4l-User #0388
>>>
>>>
>>>
>>>
>>>
>>
> 
> 
> 



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




Re: [PHP] 100% repeatable problem with PHP 4.0.1 in WIN2k environment.

2002-03-19 Thread scott furt

Try replacing header("Location: success.php")
with something like echo "Here we are";

does it still fail?

(I cannot run your code here, becuase without
your database schema, the mysql queries will
all fail)

At a glance, I don't see any glaring errors
with your script..

Balaji Ankem wrote:
> Hi scott,
>   
> Yes I examined..
> It z dying in if loop (if $n==2) at the statement header("Location:
> success.php");
>  
> It will be helpful to me if u try to execute those files as I told.
> 
> Thanks in advance
> Balaji
> 
> -Original Message-
> From: scott furt [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, March 19, 2002 5:26 PM
> To: php
> Subject: Re: [PHP] 100% repeatable problem with PHP 4.0.1 in WIN2k
> environment.
> 
> 
> Have you examined the PHP error logs?
> 
> Have you turned up error reporting to the max (E_ALL)
> and examined what it returned?
> 
> Have you examined $php_errmsg (if configured in php.ini)?
> 
> Have you tried putting echo statements every few lines
> to see exactly where and why the script dies?
> 
> Balaji Ankem wrote:
> 
>>Hi,
>>  I am able to produce the following problem 100% in WINDOWS.
>>
>>  Problem is u can not produce success message in new browser context 
>>..
>>
>>  Error: php.exe has generated some errors and will be closed by 
>>windows.
>>
>>  I am facing this problem from last 1 year.
>>
>>
> 
> 
> 
> 
> 
> **Disclaimer
>   
> 
> 
> Information contained in this E-MAIL being proprietary to Wipro Limited
> is 'privileged' and 'confidential' and intended for use only by the
> individual or entity to which it is addressed. You are notified that any
> use, copying or dissemination of the information contained in the E-MAIL
> in any manner whatsoever is strictly prohibited.
> 
> 
> 
>  
> 
> 



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




Re: [PHP] Calling Javascript-function from php-script ...

2002-03-19 Thread scott furt

Short answer: no.

Long answer: have the PHP script output javascript code
to the browser.

PHP = server-side
Javascript = client-side

Marcel Besancon wrote:
> Hi everybody,
> 
> is there someone who can tell me how to call a javascript-function by a
> php-script.
> 
> Thanks for each answer
> 
> Marcel
> 
> --
> registered Fli4l-User #0388
> 
> 
> 
> 



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




Re: [PHP] Cookie Woes

2002-03-19 Thread scott furt

because the first argument of Setcookie is the name
of the cookie you want to set.
(and what the variable will be called on subsequent pages)

SetCookie('username', $username ...) will do what
you're expecting.

Jesse Warden wrote:
> I performed a:
> setCookie($username, $username, time()+3600,"", "", "0");
> echo header("Location: projects.php");
> 
> ... on a php page that deals with a form submission.  However, when I get to
> projects.php, it claims $username doesn't exist.  The book said that to get
> a variable from a cookie, all I need to do is call a variable name that is
> the same name as what I named the cookie.
> 
> Any suggestions?
> 
> TIA,
> 
> J
> 
> 
> ** Scanned for Viruses **
> 
> 



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




Re: [PHP] Copy *.*

2002-03-19 Thread scott furt

Or, if you're on a *nix platform, try using 'tar'
to tar up the entire directory tree, copy the
'tar' file and un-tar it.

or 'cp -R' should work too.

Martin Towell wrote:
> Does xcopy support long file names?
> 
> -Original Message-
> From: Robert V. Zwink [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 2:17 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP] Copy *.*
> 
> 
> You'll probably have the most success using the system() function to execute
> the xcopy command.  You shouldn't need to rewrite xcopy in php, seems like
> overkill.
> 
> See: http://www.php.net/manual/en/function.system.php
> 
> Here's the result of C:\>xcopy /?
> 
> XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
>[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
>[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
>[/EXCLUDE:file1[+file2][+file3]...]
> 
>   source   Specifies the file(s) to copy.
>   destination  Specifies the location and/or name of new files.
>   /A   Copies only files with the archive attribute set,
>doesn't change the attribute.
>   /M   Copies only files with the archive attribute set,
>turns off the archive attribute.
>   /D:m-d-y Copies files changed on or after the specified date.
>If no date is given, copies only those files whose
>source time is newer than the destination time.
>   /EXCLUDE:file1[+file2][+file3]...
>Specifies a list of files containing strings.  When any of
> the
>strings match any part of the absolute path of the file to be
>copied, that file will be excluded from being copied.  For
>example, specifying a string like \obj\ or .obj will exclude
>all files underneath the directory obj or all files with the
>.obj extension respectively.
>   /P   Prompts you before creating each destination file.
>   /S   Copies directories and subdirectories except empty ones.
>   /E   Copies directories and subdirectories, including empty ones.
>Same as /S /E. May be used to modify /T.
>   /V   Verifies each new file.
>   /W   Prompts you to press a key before copying.
>   /C   Continues copying even if errors occur.
>   /I   If destination does not exist and copying more than one file,
>assumes that destination must be a directory.
>   /Q   Does not display file names while copying.
>   /F   Displays full source and destination file names while
> copying.
>   /L   Displays files that would be copied.
>   /H   Copies hidden and system files also.
>   /R   Overwrites read-only files.
>   /T   Creates directory structure, but does not copy files. Does
> not
>include empty directories or subdirectories. /T /E includes
>empty directories and subdirectories.
>   /U   Copies only files that already exist in destination.
>   /K   Copies attributes. Normal Xcopy will reset read-only
> attributes.
>   /N   Copies using the generated short names.
>   /O   Copies file ownership and ACL information.
>   /X   Copies file audit settings (implies /O).
>   /Y   Suppresses prompting to confirm you want to overwrite an
>existing destination file.
>   /-Y  Causes prompting to confirm you want to overwrite an
>existing destination file.
>   /Z   Copies networked files in restartable mode.
> 
> The switch /Y may be preset in the COPYCMD environment variable.
> This may be overridden with /-Y on the command line.
> 
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, March 17, 2002 3:10 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Copy /
> 
> 
> Does anyone know of another snippet any place where I can copy *.*
> (files and all sub-directories) from one drive to another? In other
> words, a "backing-up" function. The snippet I got from
> http://www.php.net/manual/en/function.copy.php has been a disaster.
> 
> John
> 
> 
> --
> 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] No Sense: [PHP] Update: [PHP] Weird?

2002-03-19 Thread scott furt

*shakes head*  i know that $date is a string.

your script is failing because you are trying to
write to directory "C:\\ccl_www\\$date", which
does not exist.  you have to create it before
you try and write files into it.

jtjohnston wrote:
> No!? $date is a string?!
> 
> $date = date ("MD");
> 
> How does that make a difference?
> 
> $to_path = "c:\\ccl_www\\".$date."\\ccl_www\\";
> 
> You want me to change it to:
> 
> $to_path = "c:\\ccl_www\\$date\\ccl_www\\";
> 
> Does anyone follow why?
> 
> 
>>Scott Furt wrote:
>>
> 
>>I meant, have you created a physical directory
>>named $date?
>>That's your problem.  There's no directory named $date on your computer, and
>>you're
>>trying to write files into a non-existent directory.
>>
>>jtjohnston wrote:
>>
>>>I have created date :)
>>>$date = date ("MD");
>>>That's not it. It seems to fail at one level or another, I think, becuase the
>>>function calls itself - and probably gets lost somehow.
>>>John
>>>
>>>
>>>
>>>>... i think you might have to create the
>>>>$date directory before writing a file to it.
>>>>writing to /tmp/dir/file.txt will fail if
>>>>the directory "dir" doesn't exist.
>>>>
>>>>
>>>>>
>>>###
>>>$date = date ("MD");
>>>###
>>>###  Don't forget trailing slash  #
>>>###
>>>$from_path = "c:\\program files\\easyphp\\ccl_www\\";
>>>$to_path = "c:\\ccl_www\\".$date."ccl_www\\";
>>>###
>>>
>>>if(!is_dir($from_path))
>>>{
>>>echo "failed";
>>>exit;
>>>}else{
>>>rec_copy($from_path, $to_path);
>>>echo "files copies from $from_path and backed up to $to_path";
>>>}
>>>
>>>#
>>>function rec_copy ($from_path, $to_path) {
>>>if(!is_dir($to_path))
>>>mkdir($to_path, 0777);
>>>
>>>$this_path = getcwd();
>>> if (is_dir($from_path))
>>> {
>>>chdir($from_path);
>>>$handle=opendir('.');
>>>
>>>while (($file = readdir($handle))!==false)
>>>{
>>> if (($file != ".") && ($file != "..")) {
>>>  if (is_dir($file))
>>>  {
>>>  rec_copy ($from_path.$file."/",  $to_path.$file."/");
>>>   chdir($from_path);
>>>  }else{
>>>#  echo "error if (is_dir($file))";
>>>  }
>>>  if (is_file($file))
>>>  {
>>>  copy($from_path.$file, $to_path.$file);
>>>  }else{
>>>#  echo "error copy($from_path.$file, $to_path.$file)";
>>>  }
>>> }#end (($file != ".")
>>>}#end while (($file
>>>
>>>closedir($handle);
>>> }# end if (is_dir
>>> else{
>>># echo "if (is_dir($from_path))";
>>> }
>>>}# end function
>>>
>>>?>
>>>
>>>
> 
> --
> John Taylor-Johnston
> -
>   ' ' '   Collège de Sherbrooke:
>  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
>- Université de Sherbrooke:
>   http://compcanlit.ca/
>   819-569-2064
> 
> 
> 
> 



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




Re: [PHP] More on: how to send a file to the user's browser?

2002-03-19 Thread scott furt

Are you using MSIE?

what file extension are you testing with?

i was having similar problems using this technique
with PDF files.  only with MSIE, sometimes it would
print text crap to the screen and sometimes it
would prompt for download.

MSIE is notorious for disregarding headers and
trying to handle files off of their extensions.

Carlos Fernando Scheidecker Antunes wrote:
> Hi Mark,
> 
> It does not work. What it does is to echo the thing to the screen.
> 
> How can I force the browser to download it with its original file name?
> 
> 
> 
> - Original Message -
> From: "Mark Heintz PHP Mailing Lists" <[EMAIL PROTECTED]>
> To: "Carlos Fernando Scheidecker Antunes" <[EMAIL PROTECTED]>
> Cc: "PHP-GENERAL" <[EMAIL PROTECTED]>
> Sent: Monday, March 18, 2002 5:01 PM
> Subject: Re: [PHP] how to send a file to the user's browser?
> 
> 
> 
> A couple more headers than absolutely necessary, but this should work:
> 
>  // open file and send to user
> if($fp = fopen($downloadfile, "r")){
>   // output headers
>   $downloadsize = filesize($downloadfile);
>   header ( "Expires: Mon, 1 Apr 1974 05:00:00 GMT" );
>   header ( "Last-Modified: " . gmdate("D,d M YH:i:s T") );
>   header ( "Pragma: no-cache" );
>   header ( "Content-type: application/octet-stream; name=$downloadfile" );
>   header ( "Content-length: $downloadsize" );
>   header ( "Content-Disposition: attachment; filename="$downloadfile" );
>   // read out file
>   fpassthru($fp);
>   fclose($fp);
> } else {
>   // can't open file
> }
> ?>
> 
> 
> mh.
> 
> 
> On Mon, 18 Mar 2002, Carlos Fernando Scheidecker Antunes wrote:
> 
> 
>>Hello all,
>>
>>I've got a script that generates a txt file, compresses it into a Zip file
>>
> and it all happens on a directory that is out of apache's web site.
> 
>>This script generates the file based on MySQL server information and I
>>
> have it then sent to the user's e-mail address. What I would like to do is
> to make the PHP script "throw" the file to the user's browser so that it
> would download it automatically. This file is created on a directory that is
> not the same as the web server where the pages and php scripts are located.
> 
>>Anyone could help me with that?
>>
>>Thanks.
>>
>>regards,
>>
>>Carlos Fernando Scheidecker Antunes
>>Linux User #207984
>>
>>
>>
> 
> 
> --
> 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] 100% repeatable problem with PHP 4.0.1 in WIN2k environment.

2002-03-19 Thread scott furt

Have you examined the PHP error logs?

Have you turned up error reporting to the max (E_ALL)
and examined what it returned?

Have you examined $php_errmsg (if configured in php.ini)?

Have you tried putting echo statements every few lines
to see exactly where and why the script dies?

Balaji Ankem wrote:
> Hi,
>   I am able to produce the following problem 100% in WINDOWS. 
> 
>   Problem is u can not produce success message in new browser context ..
> 
>   Error: php.exe has generated some errors and will be closed by
> windows.
> 
>   I am facing this problem from last 1 year.
> 


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




Re: [PHP] EMAIL problem

2002-03-19 Thread scott furt

you have to tell mail() who the email is from.

add in a header similar to: "From: [EMAIL PROTECTED]"
(read the docs for mail() for syntax)

Dani wrote:
> Hi,
> 
> I have been trying to use a form to send an email.
> 
> I use the mail() function. But I have a bit of problem.
> The email send does not display the email is from. So, for example I
> send an email using my my webform then when I receive it the from
> coloumn in my email browser says "nobody".
> 
> how do I display this information? What should I write in the mail()
> function?
> 
> thanks
> 
> Regards,
> Ardani
> 
> 
> 



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




Re: [PHP] Printing an array

2002-03-19 Thread scott furt

...because you never shrink $prefix

after output(), try array_pop($prefix);

Alexander Skwar wrote:
> Hello!
> 
> I'd like to print an array kinda like the way it was created.  Ie., I've
> got the following array:
> 
> $r[0][0]['name'] = 'joe';
> $r[0][0]['gender'] = 'male';
> $r[0][0]['prop'] = 'prefs';
> $r[0][0][0]['text'] = 'mail';
> $r[0][0][0]['set'] = 'yes';
> $r[0][0][1]['text'] = 'phone';
> $r[0][0][1]['set'] = 'no';
> 
> Now I'd like to have a function which I'd pass the array and get the
> following output:
> 
> r[0][0]['name'] = 'joe'
> r[0][0]['gender'] = 'male'
> r[0][0]['prop'] = 'prefs'
> r[0][0][0]['text'] = 'mail'
> r[0][0][0]['set'] = 'yes'
> r[0][0][1]['text'] = 'phone'
> r[0][0][1]['set'] = 'no'
> 
> Right now, I've got the following not quite working function:
> 
>  function output($array, $name, $prefix = array()){
>   foreach ($array as $key => $value){
> if (! is_array($value)){
>   if (0 < count($prefix)){
> // Prefix vorhanden
> printf ("%s%s[%s] = '%s'\n", $name, implode('', $prefix), $key, $value);
>   } else {
> // Kein Prefix angegeben
> printf ("%s[%s] = %s\n", $name, $key, $value);
>   }
> } else {
>   $prefix[] = sprintf('[%s]', $key);
>   output($value, $name, $prefix);
> }
>   }
> }
> ?>
> 
> This produces the following output:
> 
> r[0][0][name] = 'joe'
> r[0][0][gender] = 'male'
> r[0][0][prop] = 'prefs'
> r[0][0][0][text] = 'mail'
> r[0][0][0][set] = 'yes'
> r[0][0][0][1][text] = 'phone'
> r[0][0][0][1][set] = 'no'
> 
> As you can see in the line with "phone", I've still got an error
> somewhere.  The "phone" line should be:
> 
> r[0][0][1]['text'] = 'phone'
> 
> But it is:
> 
> r[0][0][0][1]['text'] = 'phone'
> 
> The 3rd [0] is too much.  This means, that I somehow need to get rid of
> the 3rd [0].  It seems like I did not notice that I went "up" again in
> the array.
> 
> Could somebody please help me in refining the function so that it works?
> 
> Thanks a lot!
> 
> 



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




Re: [PHP] regular expression for (NOT 'word')

2002-03-16 Thread scott furt

Try this... it should only print out "Some webpage data"

$text = "
script data.
Some webpage data
another script data 
";

print preg_replace('/(.*?)<\/script>/',
   '', $text);


Ando Saabas wrote:
> Ok let me explain my problem further some. I need the regular expression to
> purify the html page from script tags:
> I used: $file = eregi_replace("(.*)", " ", $file);
> Now this works fine, until theres a webpage like:
> 
> script data.
> Some webpage data
> another script data 
> 
> so the regexp above replaces everything between first  and last
>  ie the webpage data also.
> So i thought to change the regexp to something like this:  $file =
> eregi_replace("(NOT(script))", " ", $file);
> where NOT(script) would match everything that contains word script
> 
> 
> 
> 
> Rick Emery wrote:
> 
> 
>>the best you can do is:
>>
>>>$a = "this has php  in the string";
>>if( ! ereg("php", $a ) )
>>{ print "a: not in string"; }
>>$a = "this has in the string";
>>if( ! ereg("php", $a ) )
>>{ print "b: not in string"; }
>>?>
>>
>>-Original Message-
>>From: Ando Saabas [mailto:[EMAIL PROTECTED]]
>>Sent: Thursday, March 14, 2002 9:33 AM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] regular expression for (NOT 'word')
>>
>>how would i build a regular expression in php that would match
>>everything but the given word. For example, match the string only if
>>there isnt a word 'php' in the string.
>>I understand i can list characters i dont want to see in the string:
>>[^php].
>>but this means there cant be any p or h in the string. And ^(php) checks
>>if the string starts with 'php'.
>>How should i do it?
>>
>>--
>>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] Driving me nuts, need one second of your time

2002-03-16 Thread scott furt

It's not absurd at all.

What is absurd is that you're coding without
checking for any error conditions :-)

As a rule of thumb, if a function returns a
success flag, check it.  it'll immediately
cut out about 90% of all "weird" errors.

cosmin laslau wrote:
>  $query = "SELECT * from mytable";
> $result = mysql_db_query("db", $query);
> 
> while ($myarray = mysql_fetch_array($result))
> {
> $title = $myarray[title];
> echo "$title";
> }
> ?>
> 
> Can someone PLEASE tell me why the coding above gives the following error:
> 
> 
> Warning: Supplied argument is not a valid MySQL result resource in 
> /var/web/somesite.com/html/index.php on line 5
> 
> 
> It's absurd. It's driving me nuts. I'm about to introduce my computer to 
> the pavement 40 feet below.
> 
> Thanks in advance for whoever sees what I am sure is a glaring and 
> obvious flaw in the coding. I've been looking at it for an hours and 
> just can't get anything from where I'm standing, maybe a different 
> perpective will help.
> 
> 
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> 
> 




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




Re: [PHP] Update: [PHP] Weird?

2002-03-16 Thread scott furt

I meant, have you created a physical directory
named $date?

That's your problem.  There's no directory
named $date on your computer, and you're
trying to write files into a non-existent
directory.

jtjohnston wrote:
> I have created date :)
> $date = date ("MD");
> That's not it. It seems to fail at one level or another, I think, becuase the
> function calls itself - and probably gets lost somehow.
> John
> 
> 
>>... i think you might have to create the
>>$date directory before writing a file to it.
>>writing to /tmp/dir/file.txt will fail if
>>the directory "dir" doesn't exist.
>>
> 
>  
> ###
> $date = date ("MD");
> ###
> ###  Don't forget trailing slash  #
> ###
> $from_path = "c:\\program files\\easyphp\\ccl_www\\";
> $to_path = "c:\\ccl_www\\".$date."ccl_www\\";
> ###
> 
> if(!is_dir($from_path))
> {
> echo "failed";
> exit;
> }else{
> rec_copy($from_path, $to_path);
> echo "files copies from $from_path and backed up to $to_path";
> }
> 
> #
> function rec_copy ($from_path, $to_path) {
> if(!is_dir($to_path))
> mkdir($to_path, 0777);
> 
> $this_path = getcwd();
>  if (is_dir($from_path))
>  {
> chdir($from_path);
> $handle=opendir('.');
> 
> while (($file = readdir($handle))!==false)
> {
>  if (($file != ".") && ($file != "..")) {
>   if (is_dir($file))
>   {
>   rec_copy ($from_path.$file."/",  $to_path.$file."/");
>chdir($from_path);
>   }else{
> #  echo "error if (is_dir($file))";
>   }
>   if (is_file($file))
>   {
>   copy($from_path.$file, $to_path.$file);
>   }else{
> #  echo "error copy($from_path.$file, $to_path.$file)";
>   }
>  }#end (($file != ".")
> }#end while (($file
> 
> closedir($handle);
>  }# end if (is_dir
>  else{
> # echo "if (is_dir($from_path))";
>  }
> }# end function
> 
> ?>
> 
> 




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




Re: [PHP] Weird?

2002-03-16 Thread scott furt

... i think you might have to create the
$date directory before writing a file to it.

writing to /tmp/dir/file.txt will fail if
the directory "dir" doesn't exist.


jtjohnston wrote:
> Does anyone have time to run this code?
> This is definitely weird. Either a Windows or a code problem. If I set:
> 
> $to_path = "c:\\ccl_www\\".$date."ccl_www\\";
> 
> to:
> 
> $to_path = "c:\\ccl_www\\".$date."\\ccl_www\\";
> (I add \\)
> 
> It fails to create c:\ccl_www\20020315\ccl_www, but otherwise will
> create c:\ccl_www\20020315ccl_www
> 
> I've tried debugging this thing backwards, but have not found my
> problem.
> 
> If for example, I tried creating manually:
> 
> c:\ccl_www
> 
> thinking it was a root thing. It worked, then it didn't.
> 
> :x( John
> P.S. By the by, I tried this on a Unix box, and thought it worked, but
> then it didn't when I went back to it this morning. I'm confused!
> 
> 
> snip
> $date = date ("MD");
> ###
> ###  Don't forget trailing slash  #
> ###
> $from_path = "c:\\program files\\easyphp\\ccl_www\\";
> $to_path = "c:\\ccl_www\\".$date."ccl_www\\";
> ###
> 
> if(!is_dir($from_path))
> {
> echo "failed";
> exit;
> }else{
> rec_copy($from_path, $to_path);
> echo "files copies from $from_path and backed up to $to_path";
> }
> 
> #
> 
> function rec_copy ($from_path, $to_path) {
> if(!is_dir($to_path))
> mkdir($to_path, 0777);
> 
> $this_path = getcwd();
>  if (is_dir($from_path))
>  {
> chdir($from_path);
> $handle=opendir('.');
> 
> while (($file = readdir($handle))!==false)
> {
>  if (($file != ".") && ($file != "..")) {
>   if (is_dir($file))
>   {
>   rec_copy ($from_path.$file."/",  $to_path.$file."/");
>chdir($from_path);
>   }else{
> #  echo "error if (is_dir($file))";
>   }
>   if (is_file($file))
>   {
>   copy($from_path.$file, $to_path.$file);
>   }else{
> #  echo "error copy($from_path.$file, $to_path.$file)";
>   }
>  }#end (($file != ".")
> }#end while (($file
> 
> closedir($handle);
>  }# end if (is_dir
>  else{
> # echo "if (is_dir($from_path))";
>  }
> }# end function
> 
> 
> 
> 
> 




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




Re: [PHP] CLI through PHP

2002-03-14 Thread scott furt

Pipes.

I've only had to do it with perl, so i have no idea
what the syntax or function calls are with PHP, but
i'm almost positive that PHP supports reading/writing
to/from pipes.

Liam wrote:
> 14/03/2002 10:51:10 PM
> 
> Hi, I was wondering how I'd go about manipulating some command line
> software through PHP.  For instance, I have an FTP program installed
> that allows you to add users through the command line, but it's in this
> format:
> 
>  --
> 
> mailto:root@apathy";>root@apathy#:  pure-pw useradd 
> joedirt -d /home/jpedirt -u ftpuser
> 
>  Enter User's Password:
>  Enter User's Password Again:
>  User Created
> 
> mailto:root@apathy";>root@apathy#:
> 
>  --
> 
> How would I go about writing a simple PHP script that will add users for
> me using the data submitted by a form?  Thanks for your help.
> 
>  
> Liam




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




Re: [PHP] What is needed to test php mail on a local testserver

2002-03-14 Thread scott furt

... and AFAIK, if you're running windows, read 'php.ini'
and you can specify an SMTP server to use for mail
sending.

andy thomas wrote:
> 
> On Thu, 14 Mar 2002, andy wrote:
> 
> 
>>Hi there,
>>
>>I am wondering, how I could test the mail functions of php on a local
>>machine. Do I have to install something like a mailserver, or does this come
>>with php?
>>
> 
> If you are using a Unix/Linux type server for your local system, sendmail
> (or an equivalent such as exim, smail, qmail, etc) will almost certainly
> be installed and running. Then you can send mail to @localhost
> and assuming your sendmail/exim configuration is reasonably standard, it
> should work.
> 
> Andy
> 
> 
> 




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




[PHP] Question on functions finding out about caller

2002-03-13 Thread scott furt

I've checked google and the PHP manual, with no results,
so i thought i'd ask here:

Is there any functionality in PHP to allow a function to
find out what function/file/line called it?  AFAIK, perl
can do this, and i've always found it a big help when
debugging to have functions die with a call to a standard
error handler.

(for example)
function one() {
   if ($badstuff)
death("I died for this reason");
}

i know that calling death(__FILE__, __LINE__) will
accomplish this, but i really don't want to do that.

thanks in advance.


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