php-general Digest 25 Feb 2003 14:37:45 -0000 Issue 1904

Topics (messages 137026 through 137068):

Re: Passing emails to database
        137026 by: Justin French

Re: PHP Script
        137027 by: Leo Spalteholz
        137029 by: Stephen Craton

Re: PHP_SELF syntax
        137028 by: Justin French

derive function that called a function?
        137030 by: Shawn McKenzie

Re: preg_replace with /e modifier
        137031 by: John W. Holmes

Re: <button> and </button>
        137032 by: John W. Holmes
        137034 by: Sunfire

Re: Live chat screen
        137033 by: Jason Sheets
        137059 by: Sascha Braun

having php auto load a page
        137035 by: Antoine
        137036 by: Matt Honeycutt

dummy variable
        137037 by: Sebastian
        137038 by: John W. Holmes

explode(" ", $pizza)
        137039 by: John Taylor-Johnston
        137056 by: Sascha Braun
        137057 by: Tim

Re: Memory used by script...
        137040 by: Lord Loh.

Re: Page per page
        137041 by: Adriaan Nel

Using a PHP mime email attachment
        137042 by: Steve Jackson

Re: cookie problemes
        137043 by: kale

array_filter
        137044 by: David Otton

.NET to PHP+NuSOAP
        137045 by: Hilmi Hilmiev

Re: cookie problemes (solved with javascript)
        137046 by: kale
        137049 by: Awlad Hussain

reminder mail when date is within a month of today.
        137047 by: Petre Agenbag
        137050 by: Sunfire
        137060 by: Petre Agenbag

reminder mail cont.
        137048 by: Petre Agenbag

Newbie Security Questions...
        137051 by: Miguel Angelo
        137054 by: Justin French

How to get tree structure into an array?
        137052 by: Konference
        137055 by: Chris Hayes
        137061 by: Chris Hayes

Re: phpmyadmin duplication of sql
        137053 by: David Eisenhart

Re: Zend Encoder
        137058 by: Brad Young

Re: creating flat versions of php pages
        137062 by: Mark Cubitt

FormatDateTime in PHP
        137063 by: Skyhawk
        137064 by: Chris Hayes
        137065 by: Adrian Portsmouth
        137068 by: Skyhawk

PHP PDF attachment
        137066 by: Steve Jackson

Fputs including php syntax?
        137067 by: MIKE YRABEDRA

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 ---
Please keep the emails on-list, so that others can learn, and search the
answers in the archive -- that's the whole point of the list.


on 25/02/03 12:14 AM, Alberto Brea ([EMAIL PROTECTED]) wrote:

> Justin,
> Thanks for your answer
> The only real problem seems to be how to capture the different parts of an
> incoming email (from, date, message, etc) somehow into PHP variables.

Did you even read the IMAP page on php.net?
http://www.php.net/manual/en/ref.imap.php

I doubt it, because it clearly shows a list of imap functions, including
imap_body(), imap_subject(), etc etc.

Please at least do SOME research before asking questions.


> Then you "INSERT" them into the (e.g.MySQL) database or do anything else with
> them.
> Is there an easy way to do this? I have never used IMAP functions, but I can
> learn if this is the way.

I doubt you've got imap functions installed at the moment... it requires
extra components, so that may be your first issue.


> As to your comment, my PHP is installed as an Apache module (on Windows), not
> as CGI.

Well then that rules out one of the two options (using .forward to pass the
emails to a PHP script).  You'll need either PHP as CGI, OR the IMAP
functions AFAIK -- your choice.


Justin


--- End Message ---
--- Begin Message ---
Hm.  Looks pretty nice.  Cool page and the demos are pretty slick.  
But I can't really see what it would be useful for.  Maybe I missed 
something but it seems to be a sort of InstallShield for php scripts.  
While this sounds like a good idea, its actually quite useless.  What 
is normally involved in "installing" a php script?  If its simple you 
just upload it to the server and if its complex you upload it and 
then do some script specific configuration.
So what exactly does this installer of yours do?  Apparently it just 
runs through a few screens, yet does nothing constructive, and then 
starts the main script.  So you set some variables but where are 
these used?  The only configuration a php script may need will be so 
specific that a general interface cannot handle it.

Leo

PS: Microsoft copyrighted images. Commercial app. Bad idea. Seriously.

On February 24, 2003 12:05 pm, Stephen Craton wrote:
> It may do some good to give you the URL to the website, won't it?
> Sorry...
>
> http://piw.melchior.us
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
>
> ----- Original Message -----
> From: "Stephen Craton" <[EMAIL PROTECTED]>
> To: "PHP List" <[EMAIL PROTECTED]>
> Sent: Monday, February 24, 2003 3:04 PM
> Subject: PHP Script
>
>
> Hello all,
>
> Very sorry if this is spam, but we all need some meat now and then,
> right? ;-)
>
> Anyway, some of you may recognize me as being the horrible PHP
> coder that has so many errors he can't get past the echo command.
> Others may know me as the math maniac for asking so many math
> related PHP functions it looked like I was trying to get you to do
> my homework. Never the less, I have created a, I hope, very useful
> PHP script for you other PHP programmers. It's called
> phpInstallWorks. It's a wizard based and webbased program that
> automatically creates a webbased installation script for your PHP
> script. You may remember me asking if it had been done before, and
> now it has! ^_^
>
> Normally, my scripts are free, but since it's a relativly new idea
> and new type of script, I thought I might charge a little bit to
> help myself get a new computer customized to my needs. The cost is
> a flat fee of $25 for the basic version (the pro has some more
> features but isn't out yet) and will probably have free upgrades or
> like a year or something. Email me or visit the script's website
> for more information. Hope you like it and it does you good and
> that you buy it! =)
>
> Sorry, again, if this is spam but I did want to inform you about
> this script...
>
> Thanks,
> Stephen Craton
> http://www.melchior.us


--- End Message ---
--- Begin Message ---
It does more then that... From my experience of some of my previous PHP
script and the tech support questions I got from them, some users really
don't how to customize the variable they need to make the script work. Plus,
some PHP programers want to have those flashy install shields like phpBB and
Invision Board.

In detailed form of what it does is this... You go through the wizard, it
creates a PHP form where the end-user then types in the contents of the
variables in simple english (or spanish, whatever language). It then writes
the values to a configuation file that the user won't see for sake of
keeping them NOT confused. After it's written, these values are used
throughout your script. Since most people keep a seperate config file
anyway, it should just plugin to your script easily. In the pro version I'll
be supporting classes and such.

Thanks,
Stephen Craton
http://www.melchior.us


----- Original Message -----
From: "Leo Spalteholz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 9:52 PM
Subject: Re: [PHP] PHP Script


Hm.  Looks pretty nice.  Cool page and the demos are pretty slick.
But I can't really see what it would be useful for.  Maybe I missed
something but it seems to be a sort of InstallShield for php scripts.
While this sounds like a good idea, its actually quite useless.  What
is normally involved in "installing" a php script?  If its simple you
just upload it to the server and if its complex you upload it and
then do some script specific configuration.
So what exactly does this installer of yours do?  Apparently it just
runs through a few screens, yet does nothing constructive, and then
starts the main script.  So you set some variables but where are
these used?  The only configuration a php script may need will be so
specific that a general interface cannot handle it.

Leo

PS: Microsoft copyrighted images. Commercial app. Bad idea. Seriously.

On February 24, 2003 12:05 pm, Stephen Craton wrote:
> It may do some good to give you the URL to the website, won't it?
> Sorry...
>
> http://piw.melchior.us
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
>
> ----- Original Message -----
> From: "Stephen Craton" <[EMAIL PROTECTED]>
> To: "PHP List" <[EMAIL PROTECTED]>
> Sent: Monday, February 24, 2003 3:04 PM
> Subject: PHP Script
>
>
> Hello all,
>
> Very sorry if this is spam, but we all need some meat now and then,
> right? ;-)
>
> Anyway, some of you may recognize me as being the horrible PHP
> coder that has so many errors he can't get past the echo command.
> Others may know me as the math maniac for asking so many math
> related PHP functions it looked like I was trying to get you to do
> my homework. Never the less, I have created a, I hope, very useful
> PHP script for you other PHP programmers. It's called
> phpInstallWorks. It's a wizard based and webbased program that
> automatically creates a webbased installation script for your PHP
> script. You may remember me asking if it had been done before, and
> now it has! ^_^
>
> Normally, my scripts are free, but since it's a relativly new idea
> and new type of script, I thought I might charge a little bit to
> help myself get a new computer customized to my needs. The cost is
> a flat fee of $25 for the basic version (the pro has some more
> features but isn't out yet) and will probably have free upgrades or
> like a year or something. Email me or visit the script's website
> for more information. Hope you like it and it does you good and
> that you buy it! =)
>
> Sorry, again, if this is spam but I did want to inform you about
> this script...
>
> Thanks,
> Stephen Craton
> http://www.melchior.us


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





--- End Message ---
--- Begin Message ---
on 24/02/03 11:42 AM, Jason Lange ([EMAIL PROTECTED]) wrote:

> What you might try is removing the single-quotes from around PHP_SELF.
> 
> Before: $_SERVER['PHP_SELF']
> After:  $_SERVER[PHP_SELF]
> 
> Another note: as far as I can tell you do not need the braces ({}) to
> enclose a variable within a double-quoted string. I may be wrong, but
> nothing I've read advocates doing this, and I've never had a problem
> with my code when I've written it this way.

Wrapping vars in braces helps clarify the code, and can avoid problems like:

<?
$price = '44.99';
echo "Price: US$$priceeach";            // probably won't work
echo "Price: US${$price}each";          // will work for sure
echo "Price: US$" . $price . "each";    // will work, but not my pref
?>

I've also found it helps with things like:

<?
echo "<a href='{$_SERVER['PHP_SELF']}'>click</a>";
?>

... where normally the single quotes would cause confusion, or require the
href to be wrapped in escaped double quotes.

In otherwords, wrapping $vars in {braces} provides clarity to both the PHP
parser, and to the writer, IMHO.


Justin


--- End Message ---
--- Begin Message ---
Is there any way to determine what function (if any) called a particular
function???

Example:

function myFuncA() {
   myFuncB();
}

function myFuncB() {
   some stufff....;
}

In myFuncB() can I find out that I was called by myFuncA()???

FYI...  I am trying to write some code that integrates with other peoples'
code and don't want to modify their functions (e.g. what args they call my
function with).  But in certain cases I need to take certain actions if my
function was called by a particular function.

TIA
Shawn



--- End Message ---
--- Begin Message ---
You can't have a special character as the key to an array without
surrounding it by quotes. Here's a solution to that and a better way to
organize your code.

If you define your array as such:

$color=array(
//numeric
"1"=>"#FF0000","2"=>"#00FF00","3"=>"#F0FF0F",
"4"=>"#0000FF","5"=>"#00FFFF","6"=>"#FF00FF",
"7"=>"#FFFFFF","8"=>"#C56D29","9"=>"#7B5131",
"0"=>"#E7E7E7",etc...

Just give the color value, not the extra HTML. You're just wasting space
when you can do that in your preg_replace.

Now, the preg_replace to do what you want will look like this:

$player = preg_replace("/\^(.)([^^]+)/ex", 'sprintf("<font
color=\"{$color[\'$1\']}\">$2</font>")', $player);

So a value such as

$player = 'Bas^#ket ^?Ball Pla^:yer';

will produce:

Bas<font color="#000000">ket </font><font color="#7BD2AD">Ball
Pla</font><font color="#63319C">yer</font>

Which is much better HTML output than you had before. Enjoy.

---John W. Holmes...

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

> -----Original Message-----
> From: aw2001 [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 24, 2003 9:30 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] preg_replace with /e modifier
> 
> I cant find a way to properly escape the special characters for php
code
> evaluation (iam sure its something simple) Can some one point this
out?
> 
> [errors generated]
> Parse error: parse error, unexpected ']'
> Fatal error: Failed evaluating code: $color[!]
> 
> [function containing error]
> function HTMLfromNickName ( $player ) {
> $color=array(
> //numeric
> "1"=>"<font color=#FF0000>","2"=>"<font color=#00FF00>","3"=>"<font
> color=#F0FF0F>","4"=>"<font color=#0000FF>","5"=>"<font
> color=#00FFFF>","6"=>"<font color=#FF00FF>","7"=>"<font
> color=#FFFFFF>","8"=>"<font color=#C56D29>","9"=>"<font
> color=#7B5131>","0"=>"<font color=#E7E7E7>",
> //Caps
> "Q"=>"<font color=#A5B2DE>","W"=>"<font color=#8C41E6>","E"=>"<font
> color=#DE4D21>","R"=>"<font color=#00E700>","T"=>"<font
> color=#2939CE>","Y"=>"<font color=#520473>","U"=>"<font
> color=#42EB31>","I"=>"<font color=#428629>","O"=>"<font
> color=#00CA73>","P"=>"<font color=#CE8A00>","A"=>"<font
> color=#7BCA4A>","S"=>"<font color=#E649B5>","D"=>"<font
> color=#42D23A>","F"=>"<font color=#29416B>","G"=>"<font
> color=#5A9221>","H"=>"<font color=#001442>","J"=>"<font
> color=#8C6D7B>","K"=>"<font color=#4ABACE>","L"=>"<font
> color=#8CA28C>","Z"=>"<font color=#19716B>","X"=>"<font
> color=#5A8E7B>","C"=>"<font color=#3A04BD>","V"=>"<font
> color=#8C3D3A>","B"=>"<font color=#A56900>","N"=>"<font
> color=#9469AD>","M"=>"<font color=#A5D77B>",
> //lower
> "q"=>"<font color=#A5656B>","w"=>"<font color=#291884>","e"=>"<font
> color=#AD35A5>","r"=>"<font color=#218E6B>","t"=>"<font
> color=#8C418C>","y"=>"<font color=#080408>","u"=>"<font
> color=#31007B>","i"=>"<font color=#4AA229>","o"=>"<font
> color=#00CE73>","p"=>"<font color=#3A6929>","a"=>"<font
> color=#BD0000>","s"=>"<font color=#847173>","d"=>"<font
> color=#D68E3A>","f"=>"<font color=#7396BD>","g"=>"<font
> color=#C5007B>","h"=>"<font color=#52969C>","j"=>"<font
> color=#730829>","k"=>"<font color=#21418C>","l"=>"<font
> color=#4AD208>","z"=>"<font color=#000819>","x"=>"<font
> color=#08A631>","c"=>"<font color=#08BA8C>","v"=>"<font
> color=#520821>","b"=>"<font color=#192473>","n"=>"<font
> color=#84AED6>","m"=>"<font color=#A5926B>",
> //special
> "!"=>"<font color=#313942>","@"=>"<font color=#197573>","#"=>"<font
> color=#000000>","\$"=>"<font color=#000000>","\%"=>"<font
> color=#000000>","\&"=>"<font color=#00E700>","*"=>"<font
> color=#088284>","("=>"<font color=#BDC629>",")"=>"<font
> color=#D614DE>","_"=>"<font color=#198A73>","-"=>"<font
> color=#198A73>","+"=>"<font color=#EFEFEF>","="=>"<font
> color=#C53DDE>","["=>"<font color=#6BA621>","]"=>"<font
> color=#3A927B>","{"=>"<font color=#215D7B>","}"=>"<font
> color=#840C00>","'"=>"<font color=#A5926B>","\""=>"<font
> color=#FFFFFF>","?"=>"<font color=#7BD2AD>","/"=>"<font
> color=#FFFFFF>","|"=>"<font color=#A5B629>",","=>"<font
> color=#7B8A8C>","."=>"<font color=#000000>","<"=>"<font
> color=#B5825A>",">"=>"<font color=#00A200>",":"=>"<font
> color=#63319C>",";"=>"<font color=#A5926B>"
> );
> //todo: include special characters
>   $end = $end + substr_count ($player, "^");
>   $player = preg_replace("/\^(.)/ex", '$color[$1]', $player);
>   $player .= str_repeat ("</font>", $end);
>   return $player;
> }
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
> ... well he said basically that this web site isnt being used
> for
> "everybody" and it is only used for pastors that need somewhere to go
and
> get info and relief from problems they might have and dont want to
tell
> people in their church about it.

Oh my god!!! So many jokes came to me so quickly that I got dizzy and
passed out and hit my head on the desk!!

Sounds like a pretty demanding pastor you've got. I guess it's not a sin
to screw a programmer and pay him next to nothing?

---John Holmes...



--- End Message ---
--- Begin Message ---
well ok that was an interesting little quote about the jokes and stuff...
was sort of funny.. anyways yes that is what he wants it for (but... i guess
anybody can go to it he says now) but from his worksheets and stuff for
reason of the web site it says nothing about general public.. and from
talking to him he says also the impression that its not for general public
either.. at least thats what he keeps telling me.   so if $30 an hour for
html and php and sql to be in the same pages + the database setup testing
and all that sort isnt good enough for pay what is a good price an hour for
that sort of stuff.. i really dont know where to look and i dont know what
is the best.. i live in the USA to be exact..

the person i work with is charging really high rates like for a flat
straight html page (only 1 page) $80 but for first page he wants $170 and
that has standard default text 1 email link 5 other links and 90 graphics..
every page after that is 3$80 unless on maintainence contract and then the
prices cheaper by $20 or so.. and all i get is $30/hour and thats doing php
html and sql all in the same pages..

i did one web page system for a client of his that took me a few weeks to
write cuz i just got into php/sql right then and by the time i got done with
it the whole web page system was like 230k on the disk without the db
included (ok so i might be a beginner and my code might be a little sloppy
but the point is that it works) well i am getting paid $0 for it so i guess
its free(????) and for the client im doing it for he told me the most we can
charge for it is $15/hour for any add ons or changes after it goes on the
server..

he told me that the system i just got done writing was valued retail at $400
at the least and could be worth more than that but my pay is getting
severely discounted from what i can tell (like i said i dont know what a
standard fair price to charge would be) he sets up the rates for pay not
me..


sigh i have done about 2 months of work and havent seen 1 pay check yet and
its getting on my nerves i need money to pay bills not to do code for his
clients for free..

but anyways i guess the reason for the very cheap pay for this pastor client
is because he is on social security and only gets like $500 a month for
money to live off of and cant afford to pay more than $40 for something...


need help trying to sort this stuff out.. any body that can help?

sorry if this is the wrong kind of post for this list but need to vent out
to somewhere...



----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Sunfire'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 10:58 PM
Subject: RE: [PHP] <button> and </button>


> > ... well he said basically that this web site isnt being used
> > for
> > "everybody" and it is only used for pastors that need somewhere to go
> and
> > get info and relief from problems they might have and dont want to
> tell
> > people in their church about it.
>
> Oh my god!!! So many jokes came to me so quickly that I got dizzy and
> passed out and hit my head on the desk!!
>
> Sounds like a pretty demanding pastor you've got. I guess it's not a sin
> to screw a programmer and pay him next to nothing?
>
> ---John Holmes...
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


--- End Message ---
--- Begin Message ---
There are a lot of free java IRC applets on freshmeat.net, many of them
with very nice features.  By using a java applet you will reduce some
strain on your server, a server side language whether it be Perl, PHP,
ASP or anything else is typically not a good way to do chat, especially
when there are already excellent protocols (like IRC) established.

Jason
On Mon, 2003-02-24 at 08:00, Arjan Gijsberts wrote:
> Immediately won't be possible as far as I know. For that, you have to create
> a server socket, which is not (easily) able in php-scripts. But you can use
> javascript to refresh the page. You could even create a 0 frame which
> reloads by javascript and use DHTML to add the messages to the main chat
> frame. In this way it is the most transparant to the users. As you might
> know java applets are far more suitable for this kind of things (chat
> client).
> 
> 
> "Sami kyösti" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi!
> >
> > Is it possible to create a chat screen that updates screen in some kind
> > of loop from the database?
> >
> > So if someone sends a message to database it immediately shows on chat
> > screen?
> >
> > Kind regards,
> > Sami
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Try to take a look at PHP Socketprogramming and
Flash XML Sockets, this is one of the most usable
ways of handling things like that.


----- Original Message -----
From: "Sami Kyösti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 2:34 PM
Subject: [PHP] Live chat screen


> Hi!
>
> Is it possible to create a chat screen that updates screen in some kind
> of loop from the database?
>
> So if someone sends a message to database it immediately shows on chat
> screen?
>
> Kind regards,
> Sami
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
this might appear to be a simple question but I would like to know how I
am able to have php auto load a different page.   Here is the problem. 
I have a nice script that is used for logining in a user.  But I have
the script call itself so that it can test to see if the user name is
correct.  If the script is correct, I would like the page to just load
in the user's main page.  Is there any function that can do this?

-- 
Antoine <[EMAIL PROTECTED]>


--- End Message ---
--- Begin Message ---
Look up the header() function in the docs.  Basically, you would do
this:

if($logged_in_ok)
        header("Location: ".$url_to_go_to);

There are some things to note when using header, so again, check the
docs before you use it.

---Matt, XPODesigns.com

-----Original Message-----
From: Antoine [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 24, 2003 11:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] having php auto load a page

this might appear to be a simple question but I would like to know how I
am able to have php auto load a different page.   Here is the problem. 
I have a nice script that is used for logining in a user.  But I have
the script call itself so that it can test to see if the user name is
correct.  If the script is correct, I would like the page to just load
in the user's main page.  Is there any function that can do this?

-- 
Antoine <[EMAIL PROTECTED]>


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





--- End Message ---
--- Begin Message ---
Greetings.

I have some text that outputs to a page without a variable, example: echo
"text";

the echo has text that I would like to preg_replace.

since there is no variable, is it possible to make a $dummy variable so
either way it replaces the text that i would like inside the echo?

this is the function that I'd like to use:

preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/si", "<a href=\\1
target=_blank>\\2</a>");

How do I do this?

warm regards,
Sebastian - [BBR] Gaming Clan
http://www.broadbandreports.com

--- End Message ---
--- Begin Message ---
> I have some text that outputs to a page without a variable, example:
echo
> "text";
> 
> the echo has text that I would like to preg_replace.
> 
> since there is no variable, is it possible to make a $dummy variable
so
> either way it replaces the text that i would like inside the echo?
> 
> this is the function that I'd like to use:
> 
> preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/si", "<a href=\\1
> target=_blank>\\2</a>");
> 
> How do I do this?

Use output buffering. Start the buffer before the echos, capture the
output, do the preg_replace, and display the result. More info on the
manual page.

http://www.php.net/manual/en/ref.outcontrol.php

---John W. Holmes...

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



--- End Message ---
--- Begin Message ---
Off topic :) ?
Anyone know how to explode using javascript?

$pieces = explode(" ", $pizza);

John


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

i found something like:

var s = "This,is,a,String";
lenght = s.lenght;
document.write(s.bold());
t = s.substring(2,4);
a = s.split(","); // This line is the most interesting one ;))

document.write(a[1]); // should write the word 'is'

Dont know if it works, i just looked in one of my old books.

The Book where i found the answer is from O'Reilly: Javascript
the defenetive reference or some like that, another very very good
book is Dynamic HTML from O'Reilly, you should find all infor-
mation you need there.

Good luck!

Sascha

----- Original Message ----- 
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 7:21 AM
Subject: [PHP] explode(" ", $pizza)


> Off topic :) ?
> Anyone know how to explode using javascript?
> 
> $pieces = explode(" ", $pizza);
> 
> John
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
The following example illustrates the use of the split method.

function SplitDemo(){
   var s, ss;
   var s = "The rain in Spain falls mainly in the plain.";
   // Split at each space character.
   ss = s.split(" ");
   return(ss);
}

HTH
t.


> -----Message d'origine-----
> De : John Taylor-Johnston [mailto:[EMAIL PROTECTED]
> Envoye : mardi 25 fevrier 2003 07:22
> A : [EMAIL PROTECTED]
> Objet : [PHP] explode(" ", $pizza)
> 
> 
> Off topic :) ?
> Anyone know how to explode using javascript?
> 
> $pieces = explode(" ", $pizza);
> 
> John
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Your scripts must be very large...make the codes comming in the if block in
another file and include it(use your descretion). The less often excuted
code is better off as include files...

And use 'require' only when required.

Lord Loh



--- End Message ---
--- Begin Message ---
try www.phpfreaks.com they've got a nice tutorial on this...

Regards
Adriaan :)


"Miguel BráS" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi guys,
>
> Anyone has a good example to build a system that show X records per page
and
> give links to next and previous pages?
>
> Thx
> Miguel
>
>



--- End Message ---
--- Begin Message ---
My problem is that I am trying to send a PDF file from my server after
someone has registered for it. The email message, correct attachment
name and even file type arrive correctly but the file is only 73Bytes
and when you try to open it I get a read error. Can anyone see what is
wrong?

// send an email to the user and then a thanks messaage
        $fileatt = "db/"; // Path to the file                  
        $fileatt_type = "application/pdf"; // File Type 
        $fileatt_name = "webopman.pdf"; // Filename that will be used
for the file as the attachment 
        $email_from = "[EMAIL PROTECTED]"; // Who the email is from 
        $email_subject = "Thank you for downloading the file"; // The
Subject of the email 
        $message_text = "Dear $username, <br>
        Thank you for taking the time to subscribe for our free
file.<br>
        Please find the document attached to this email.<br>"; //
Message that the email has in it 
        $email_to = $email; // Who the email is too 
        $headers = "From: ".$email_from; 
        $file = fopen($fileatt,'r'); 
        $data = fread($file,filesize($fileatt)); 
        fclose($file); 
        $semi_rand = md5(time()); 
        $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 
    
        $headers .= "\nMIME-Version: 1.0\n" . 
            "Content-Type: multipart/mixed;\n" . 
            " boundary=\"{$mime_boundary}\""; 

        $email_message .= "This is a multi-part message in MIME
format.\n\n" . 
                "--{$mime_boundary}\n" . 
                "Content-Type:text/html; charset=\"iso-8859-1\"\n" . 
               "Content-Transfer-Encoding: 7bit\n\n" . 
        $message_text . "\n\n"; 
        // This may be the problem - not sure what chunk_split or
base64_encode does....
        $data = chunk_split(base64_encode($data)); 

        $email_message .= "--{$mime_boundary}\n" . 
                  "Content-Type: {$fileatt_type};\n" . 
                  " name=\"{$fileatt_name}\"\n" . 
                  //"Content-Disposition: attachment;\n" . 
                  //" filename=\"{$fileatt_name}\"\n" . 
                  "Content-Transfer-Encoding: base64\n\n" . 
                 $data . "\n\n" . 
                  "--{$mime_boundary}--\n"; 

        $ok = @mail($email_to, $email_subject, $email_message,
$headers); 
        }
if($ok) 
        { 
        // carry variables into do_html_index() function in output_fns.
        do_html_index($PageTitle, $BodyText, $Picture1, $Picture2,
$CatID, $SECTION_NAME); 
        // put the page footer in position   
        do_html_footer();
        } 
else 
        {
        $PageTitle = "Error!"; 
        $BodyText = "Sorry there has been an error whilst processing
your subscription. Please <a href='[EMAIL PROTECTED]'
class='link'>email us</a> and we will send you a copy of the file as
soon as possible.";
        // carry variables into do_html_index() function in output_fns.
        do_html_index($PageTitle, $BodyText, $Picture1, $Picture2,
$CatID, $SECTION_NAME); 
        // put the page footer in position   
        do_html_footer();
        exit;
        } 

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


--- End Message ---
--- Begin Message ---
The clock is ok. I write cookie with javascript and read with php.
For moment is the best solution i have. In future i hope to resolve 
this problem and i find solution i post it here.
Thanks for help.
kale

-----Original Message-----
From: Gonzo [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 24, 2003 8:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] cookie problemes


> $path = "/";
> $domain = ".mydomain.ro";
> And in my cookie folder i find a cookie named: [EMAIL PROTECTED] 
> But other computer (with
> problems) i don't have any cookie with same name.
> And if i reload the page and print $HTTP_COOKIE_VARS[$n_sessid]
> it's nothing. I have 12 computers and 10 are ok.

Check the clocks on the 2 machines that do not have the cookies.

Gonzo



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




--- End Message ---
--- Begin Message ---
I suspect this can't be done in PHP. However...

Is it possible to pass additional parameters to the callback function
used by array_filter()?

I guess I'm looking for something functionally equivalent to this Python
code:

from string import count

list = ('apple', 'avacado', 'banana', 'blueberry', 'peach', 'persimmon')
strings = ['a', 'b', 'c', 'd', 'e', 'f']

for string in strings :
    print filter(lambda x : count(x, string), list)


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

I have software developed with ASP.NET. The program is web service program who communicates with client side - windows application using SOAP messages developed with VB .NET. I have all of the source files from web service project developed with ASP.NET. My question: Is a possible usign same WSDL file from "old" dotNET version of this web service, to develop my php+nuSOAP web service with the same SOAP message as old web service? I don't have the source code for client side. The basically question is possible keeping the old WSDL file and developing the new web service in php usign old WSDL file.


--- End Message ---
--- Begin Message ---
I not a expert in javascript but this code is working. 
I guess it is easy to change some line of code to work for your neads.
Kale
________________________________________________________________________
____
// kale's code 
________________________________________________________________________
_____
<?
$ID = "kale";
$n_sessid = $ID."_Sessid";
session_start();
$sessid = session_id();
if(isset($Read)){
   print $HTTP_COOKIE_VARS[$n_sessid];
}
?>
<script language="JavaScript">
function setCookie(name, value)
{
        var the_name = name;
        var the_value = value;
        var the_cookie = the_name + "=" + escape(the_value);
        var the_date = new Date("December 31, 2050");
        var the_cookie_date = the_date.toGMTString();
        the_cookie = the_cookie + ";expires=" + the_cookie_date;
        document.cookie = the_cookie;
        alert("Thanks, now go to the next page.");
}
</script>
<form name="insertCookie" method="post">
<input type="submit" name="Cookie" value="Cookie"
onClick="setCookie('<?print $n_sessid;?>', '<?print $sessid;?>')">
<input type="submit" name="Read" value="Read">
</form>
________________________________________________________________________
__________________
// end kale's code
________________________________________________________________________
__________________

-----Original Message-----
From: Awlad Hussain [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 25, 2003 11:15 AM
To: kale
Subject: Re: [PHP] cookie problemes


Hi Kale,
I have the same problem with cookie, i would appericiate if you can
share the java script code you used to create the cookie and how it
solved the problem.

-awlad

----- Original Message -----
From: "kale" <[EMAIL PROTECTED]>
To: "Php. Net" <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 7:59 AM
Subject: RE: [PHP] cookie problemes


> The clock is ok. I write cookie with javascript and read with php. For

> moment is the best solution i have. In future i hope to resolve this 
> problem and i find solution i post it here. Thanks for help.
> kale
>
> -----Original Message-----
> From: Gonzo [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 24, 2003 8:11 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] cookie problemes
>
>
> > $path = "/";
> > $domain = ".mydomain.ro";
> > And in my cookie folder i find a cookie named: 
> > [EMAIL PROTECTED] But other computer (with
> > problems) i don't have any cookie with same name.
> > And if i reload the page and print $HTTP_COOKIE_VARS[$n_sessid] it's

> > nothing. I have 12 computers and 10 are ok.
>
> Check the clocks on the 2 machines that do not have the cookies.
>
> Gonzo
>
>
>
> --
> 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
>



--- End Message ---
--- Begin Message ---
Thanks Kale, I'll have a go with your code

----- Original Message ----- 
From: "kale" <[EMAIL PROTECTED]>
To: "Php. Net" <[EMAIL PROTECTED]>
Cc: "'Awlad Hussain'" <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 9:29 AM
Subject: RE: [PHP] cookie problemes (solved with javascript) 


> I not a expert in javascript but this code is working. 
> I guess it is easy to change some line of code to work for your neads.
> Kale
> ________________________________________________________________________
> ____
> // kale's code 
> ________________________________________________________________________
> _____
> <?
> $ID = "kale";
> $n_sessid = $ID."_Sessid";
> session_start();
> $sessid = session_id();
> if(isset($Read)){
>    print $HTTP_COOKIE_VARS[$n_sessid];
> }
> ?>
> <script language="JavaScript">
> function setCookie(name, value)
> {
>         var the_name = name;
>         var the_value = value;
>         var the_cookie = the_name + "=" + escape(the_value);
>         var the_date = new Date("December 31, 2050");
>         var the_cookie_date = the_date.toGMTString();
>         the_cookie = the_cookie + ";expires=" + the_cookie_date;
>         document.cookie = the_cookie;
>         alert("Thanks, now go to the next page.");
> }
> </script>
> <form name="insertCookie" method="post">
> <input type="submit" name="Cookie" value="Cookie"
> onClick="setCookie('<?print $n_sessid;?>', '<?print $sessid;?>')">
> <input type="submit" name="Read" value="Read">
> </form>
> ________________________________________________________________________
> __________________
> // end kale's code
> ________________________________________________________________________
> __________________
> 
> -----Original Message-----
> From: Awlad Hussain [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 25, 2003 11:15 AM
> To: kale
> Subject: Re: [PHP] cookie problemes
> 
> 
> Hi Kale,
> I have the same problem with cookie, i would appericiate if you can
> share the java script code you used to create the cookie and how it
> solved the problem.
> 
> -awlad
> 
> ----- Original Message -----
> From: "kale" <[EMAIL PROTECTED]>
> To: "Php. Net" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 25, 2003 7:59 AM
> Subject: RE: [PHP] cookie problemes
> 
> 
> > The clock is ok. I write cookie with javascript and read with php. For
> 
> > moment is the best solution i have. In future i hope to resolve this 
> > problem and i find solution i post it here. Thanks for help.
> > kale
> >
> > -----Original Message-----
> > From: Gonzo [mailto:[EMAIL PROTECTED]
> > Sent: Monday, February 24, 2003 8:11 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [PHP] cookie problemes
> >
> >
> > > $path = "/";
> > > $domain = ".mydomain.ro";
> > > And in my cookie folder i find a cookie named: 
> > > [EMAIL PROTECTED] But other computer (with
> > > problems) i don't have any cookie with same name.
> > > And if i reload the page and print $HTTP_COOKIE_VARS[$n_sessid] it's
> 
> > > nothing. I have 12 computers and 10 are ok.
> >
> > Check the clocks on the 2 machines that do not have the cookies.
> >
> > Gonzo
> >
> >
> >
> > --
> > 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
> 

--- End Message ---
--- Begin Message ---
HI
I'm having a bad thinking day. I know it's going to be a very easy
solution, but please humour me.
I have a mysql table with a bunch of subscribers and the date that they
subscribed.
I want to query the table to find all the subscribers who will come up
for renewal within the current month. So, each time I access the page,
it must generate a table with those who's subscription is going to
expire in this month, as well as those who might already be past the
renewal date.
I can handle the generation of the table and all, I'm just not coping
with the query string.

Thanks





--- End Message ---
--- Begin Message ---
well...

$query=mysql_query("select * from TableName where
month(FieldNameForDate)=month(FieldOfDate)+1");

that should do it.. or at least it does on mine anyways...


----- Original Message -----
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 4:07 AM
Subject: [PHP] reminder mail when date is within a month of today.


> HI
> I'm having a bad thinking day. I know it's going to be a very easy
> solution, but please humour me.
> I have a mysql table with a bunch of subscribers and the date that they
> subscribed.
> I want to query the table to find all the subscribers who will come up
> for renewal within the current month. So, each time I access the page,
> it must generate a table with those who's subscription is going to
> expire in this month, as well as those who might already be past the
> renewal date.
> I can handle the generation of the table and all, I'm just not coping
> with the query string.
>
> Thanks
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


--- End Message ---
--- Begin Message ---
Thanks for the quick response.
Just to clarify:
$query=mysql_query("select * from TableName where  
month(FieldNameForDate)=month(FieldOfDate)+1");

Which one of the dates in your query is the system's date and which is
the one from the db?
Also, I need not just the ones that are true, but also the ones that are
already past, so I presume you should have a > then?



On Tue, 2003-02-25 at 12:10, Sunfire wrote:
> well...
> 
> $query=mysql_query("select * from TableName where
> month(FieldNameForDate)=month(FieldOfDate)+1");
> 
> that should do it.. or at least it does on mine anyways...
> 
> 
> ----- Original Message -----
> From: "Petre Agenbag" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 25, 2003 4:07 AM
> Subject: [PHP] reminder mail when date is within a month of today.
> 
> 
> > HI
> > I'm having a bad thinking day. I know it's going to be a very easy
> > solution, but please humour me.
> > I have a mysql table with a bunch of subscribers and the date that they
> > subscribed.
> > I want to query the table to find all the subscribers who will come up
> > for renewal within the current month. So, each time I access the page,
> > it must generate a table with those who's subscription is going to
> > expire in this month, as well as those who might already be past the
> > renewal date.
> > I can handle the generation of the table and all, I'm just not coping
> > with the query string.
> >
> > Thanks
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



--- End Message ---
--- Begin Message ---
Sorry, forgot to mention, the subscription is annual, so the
subscription date I have for the subscriber is lets say 2002-02-28 , so
I want to "capture" that he will need to renew by 2003-02-28 as well as
all people past today's date...





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

   First thankx for reading this !.
   I'm a Newbie in PHP, previously i was doing web stuff in perl.

   I want to do a site were you login, and depending on the login account 
the user receives a given set of permissions.

   From what i have studid the session management, were you start a session 
id, and can put in several variables... My question is this, this variables 
remain were ? on the user browser (cookies, url enconding ?) or does the 
user just receive the single session id, and the rest remain on the server ?
This is a important security consideration for me.

Any help will be great

Stay well !
Miguel Angelo
e-mail: [EMAIL PROTECTED]
http://migas.mine.nu


--- End Message ---
--- Begin Message ---
on 25/02/03 1:10 PM, Miguel Angelo ([EMAIL PROTECTED])
wrote:

> From what i have studid the session management, were you start a session
> id, and can put in several variables... My question is this, this variables
> remain were ? on the user browser (cookies, url enconding ?) or does the
> user just receive the single session id, and the rest remain on the server ?
> This is a important security consideration for me.

The session ID is stored on the browser (either with cookies or URL).  The
session var/value pairs are stored on the server.

Justin


--- End Message ---
--- Begin Message ---
Hi all!

i have to solve one problem, but i have no idea how to make this. I have
got a tree strucutre in mysql table, id - parent - name. I need make
function, which return array which will contains a strucutre of this
tree-menu, table example:

ID     Parent Name
------ ------ ----------------------
1      0      Components
4      1      Main boards
5      1      HD
7      5      IDE
8      5      SCSI

and result:

$array = Array(
        "id" => "1",
        "name" => "Components",
        "sub" => array(
                "id" => "4",
                "name" => "Mainboards",
                "sub" => no_array  (no sub pages)),
                array(
                "id" => "5",
                "name" => "HD",
                "sub" => Array(
                         "id" => "7",
                         "name" => "IDE",
                         "sub" => no_array  (no sub pages)),
                         Array(
                         "id" => "8",
                         "name" => "SCSI",
                         "sub" => no_array (no sub pages))
                )

);

an so on, source table has got about 300 items, so i need function which
make an array for next work with this tree structure.

thanks a lot for some help!

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500


--- End Message ---
--- Begin Message --- At 11:16 25-2-03, you wrote:
Hi all!

i have to solve one problem, but i have no idea how to make this. I have
got a tree strucutre in mysql table, id - parent - name. I need make
function, which return array which will contains a strucutre of this
tree-menu, table example:

ID     Parent Name
------ ------ ----------------------
1      0      Components
4      1      Main boards
5      1      HD
7      5      IDE
8      5      SCSI

and result:

$array = Array(
        "id" => "1",
        "name" => "Components",
        "sub" => array(
                "id" => "4",
                "name" => "Mainboards",
                "sub" => no_array  (no sub pages)),
                array(
                "id" => "5",
                "name" => "HD",
                "sub" => Array(
                         "id" => "7",
                         "name" => "IDE",
                         "sub" => no_array  (no sub pages)),
                         Array(
                         "id" => "8",
                         "name" => "SCSI",
                         "sub" => no_array (no sub pages))
                )

);

an so on, source table has got about 300 items, so i need function which
make an array for next work with this tree structure.

thanks a lot for some help!

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500

hi jiri,
i found this an interesting question, so i tried to think up some rough function to do it.
But while writing that, i wondered why you wanted to make the array with the structure you propose. Are you sure this is the easiest way to do it?


The problem with your proposal is in my eyes that for instance the SCSI name will be in $array['sub']['sub']['sub']['name'];

So i stopped trying to finish this function because my problem is i cannot think of an elegant way to indicate where the subarray should be glued to.

The rough idea of this could be an iterative function that does a query every time:


function buildtree($parentID=0, $arrayposition) { global $Tree;

$result=query("SELECT ID, Parent,Name FROM sourcetable WHERE Parent=$parentID") or die('error:'.mysql_error());

walkthrough $result //use your favourite loop to go through the result set
{
$branch=array($ID,$Name, 'sub'=> (buildtree( $ID, $arrayposition )) );
}


return $branch;
}



It may be quicker to just load in the entire table in a simpe array in the same format as the table, and then use it in a smart way.

So q: could you elaborate on the why of the array structure you proposed?




--- End Message ---
--- Begin Message ---
the longer i stare at it the more i think it may do the job. i'm not sure. expecially about the 'sub'=>buildtree($ID) part.



function buildtree($parentID=0)
{
$result=query("SELECT ID, Parent,Name FROM sourcetable WHERE Parent=$parentID") or die('error:'.mysql_error());


walkthrough $result //use your favourite loop to go through the result set, make fields available as e.g. $ID and $Name
{ if ($ID==0) {echo 'loop danger, exiting';exit();}
$branch[]=array($ID,$Name, 'sub'=> (buildtree( $ID)) );
}
return $branch;
}


It should iteratively call itself, adding the branches, untill it exhausted all branches, then finally return the entire array.
You might like to check Google for iterative functions in PHP with arrays.



At 12:09 25-2-03, Chris Hayes wrote:
At 11:16 25-2-03, you wrote:
Hi all!

i have to solve one problem, but i have no idea how to make this. I have
got a tree strucutre in mysql table, id - parent - name. I need make
function, which return array which will contains a strucutre of this
tree-menu, table example:

ID     Parent Name
------ ------ ----------------------
1      0      Components
4      1      Main boards
5      1      HD
7      5      IDE
8      5      SCSI

and result:

$array = Array(
        "id" => "1",
        "name" => "Components",
        "sub" => array(
                "id" => "4",
                "name" => "Mainboards",
                "sub" => no_array  (no sub pages)),
                array(
                "id" => "5",
                "name" => "HD",
                "sub" => Array(
                         "id" => "7",
                         "name" => "IDE",
                         "sub" => no_array  (no sub pages)),
                         Array(
                         "id" => "8",
                         "name" => "SCSI",
                         "sub" => no_array (no sub pages))
                )

);

an so on, source table has got about 300 items, so i need function which
make an array for next work with this tree structure.

thanks a lot for some help!

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500

hi jiri,
i found this an interesting question, so i tried to think up some rough function to do it.
But while writing that, i wondered why you wanted to make the array with the structure you propose. Are you sure this is the easiest way to do it?


The problem with your proposal is in my eyes that for instance the SCSI name will be in $array['sub']['sub']['sub']['name'];

So i stopped trying to finish this function because my problem is i cannot think of an elegant way to indicate where the subarray should be glued to.

The rough idea of this could be an iterative function that does a query every time:







It may be quicker to just load in the entire table in a simpe array in the same format as the table, and then use it in a smart way.

So q: could you elaborate on the why of the array structure you proposed?




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


--- End Message ---
--- Begin Message ---
have you attempted to simply create the table and column using the sql text
box (ie not using the create table interface)? eg pasting and submitting
something like:

CREATE TABLE t2 (
  y varchar(5)
) TYPE=MyISAM;

(I appreciate this does not address the reason behind the actual problem you
are having but it should get the job done)

David





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

Allow me to clear the air:

1. Zend does not have a way to decode a php file that was encoded using Zend Encoder.  
 
     (For those of you paying attention to details, note the word "decode", not 
"decrypt". Zend Encoder does not encrypt. US gov't lawyers, please take note :)  

2. Even the inherent knowledge that Zend has about our own product would not enable us 
to access encoded software. At most, we theoretically could develop code that could 
access some of the string elements in a script, but definitely not any actual code.  
(As a comparison, it would be like looking at a .EXE file in Windows, but even more 
convoluted.)   Needless to say, even this minor capability has never and will never be 
developed or utilized by Zend.

3. Zend Encoder is the most secure way to deliver php code. That said, no protection 
scheme is absolutely 100% protected.

Brad
______________________________
Brad Young
Director, Product Marketing
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
www.zend.com <http://www.zend.com> 
Zend - The PHP Company
 


>-----Original Message-----
>From: Thomas Johnsson [mailto:[EMAIL PROTECTED]
>Sent: Monday, February 24, 2003 6:51 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP] Zend Encoder
>
>
>This might sound a bit paranoid, but since I don't know how it works, i'll
>ask anyway.
>
>If I encrypt a file using the Zend Encoder, is there anyone at zend who can
>view it, or it it an unreversable encryption?
>
>// Thomas
>
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
alright mate, I've never used php or perl to trawler through a site like
that before, although I'm sure it is possible, what with have done is made a
perl script to create static html pages with a template text file and
inserting the relevant information on the page from the database, I'm
guessing you are using a database to make the dynamic pages anyway, so it is
simply a case of replacing some text in a standard file and writing it to a
page name you decide.

so example code is below (Some of the text has been replaced):

#!/usr/bin/perl

#use strict;
use DBI;

my $fileName;
my $title;
my $body;
my $desc;
my $keywords;
my $htmlCode;
my $htmlCodeNew;
my $dbh;
my $sth;
my $otbl;
my $otblt;
my $ctbl;
my $dateser;
my $day;
my $daytype;
my $month;
my $siteDir;

$siteDir = "the directory on the server your site is stored";

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$day = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)[$wday];
if ($mday == 1) {$daytype = "st"}
elsif ($mday == 2) {$daytype = "nd"}
elsif ($mday == 3) {$daytype = "rd"}
else {$daytype = "th"}
$year = ($year + 1900);
$month =
(January,February,March,April,May,June,July,August,September,October,Novembe
r,December)[$mon];

$fileName = '';
$title = '';
$body = '';
$htmlCode = '';
$htmlCodeNew = '';
$dateser = "$day, $mday$daytype $month $year";
$otbl = "<TR><TD width=10></TD><TD>";
$otblt = "<TR><TD width=10></TD><TD class=title2>";
$ctbl = "</TD><TD></TD></TR>\n";

open (standardHTML, "<text/page.txt") or die "Can't Open Standard HTML
File\r\n";
($dev, $ino, $mode, $nLink, $uid, $gid, $rdev, $size, $atime, $mtime,
$ctime, $blksize, $blocks) = stat standardHTML;

read(standardHTML, $htmlCode, $size);

close(standardHTML);

$dbh = DBI->connect ( "dbi:Pg:dbname=Welcome-SW", "username", "password");
if ( !defined $dbh ) {
die "Cannot connect to database!\n";
}

$sth = $dbh->prepare("SELECT * FROM companies");
if ( !defined $sth ) {
die "Cannot prepare statement: $DBI::errstr\n";
}

$sth->execute;

my($id, $name, $address1, $address2, $town, $pcode, $county, $phone, $fax,
$domain, $email, $contact, $description, $type, $level);

$sth->bind_columns(\$id, \$name, \$address1, \$address2, \$town, \$pcode,
\$county, \$phone, \$fax, \$domain, \$email, \$contact, \$description,
\$type, \$level);

while( $sth->fetch() ) {

$htmlCodeNew = '';
$body = '<BR>';
$title = '';
$fileName = '';
$keywords = '';
$desc = '';

$fileName = $siteDir."places/$id.htm";
$title = "$name, $city, $county, & site title";

if (open (Picture, "<$siteDir/images/places/$id.jpg"))

        {

        close(Picture);
        $body = $body."$otblt $name</TD><TD rowspan=\"6\"><IMG
SRC=\"/images/places/$id.jpg\" WIDTH=200 HEIGHT=140 BORDER=0 ALT=\"$name\"
ALIGN=RIGHT></TD></TR>\n";

        }
        else
        {

        $body = $body."$otblt $name $ctbl";

        }


if ($address1 ne '') { $body = $body."$otbl $address1<BR>\n"; }
                     else
                     { $body = $body."$otbl\n"; }
if ($address2 ne '') { $body = $body."$address2<BR>\n"; }
if ($city ne '') { $body = $body."$city<BR>\n"; }
if ($pcode ne '') { $body = $body."$pcode\n";
                   $body = $body." \(<A
HREF=\"http://uk.multimap.com/p/browse.cgi?pc=".$pcode."\&scale=10000\";
target=\"_blank\">MAP</A>\)\n<BR>\n";
                  }
if ($county ne '') { $body = $body."$county"; }
if ($address1 ne '') {$body = $body."$ctbl $otbl $ctbl"; }
if ($phone ne '') { $body = $body."$otbl Tel: $phone $ctbl"; }
if ($fax ne '') { $body = $body."$otbl Fax: $fax $ctbl"; }
if ($email ne '') { $body = $body."$otbl <SCRIPT>\nfunction email()\n{\nvar
win2 = window.open(\"/cgi-bin/mail.cgi?id=$id\", \"second\",
\"resizable=no,height=270,width=450\");\n}\n</SCRIPT>\n<IMG
SRC=\"/images/email.gif\" onClick=\"email()\"> $ctbl"; }
if ($domain ne '') { $body = $body."$otbl <A
href=\"/cgi-bin/site.cgi?id=$id\" target=\"_blank\"><IMG
SRC=\"/images/website.gif\" border=\"0\"></a> $ctbl"; }

$body = $body."$otbl <SCRIPT>\nfunction comm()\n{\nvar win2 =
window.open(\"/cgi-bin/comm.cgi?id=$id\", \"second\",
\"resizable=no,height=270,width=450\");\n}\n</SCRIPT>\n<IMG
SRC=\"/images/comment.gif\" onClick=\"comm()\"> $ctbl";

if ($description ne '') { $body = $body."$otbl $description $ctbl"; }

$sth2 = $dbh->prepare("SELECT commauthorname, commcomment, commrating,
commdate FROM comments WHERE compid='$id' and commApproved='1'");
if ( !defined $sth2 ) {
die "Cannot prepare statement: $DBI::errstr\n";
}

$sth2->execute;

my($auth_name, $comment, $rating, $commdate);

$sth2->bind_columns(\$auth_name, \$comment, \$rating, \$commdate);

while( $sth2->fetch() ) {

$commdate =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;

$commmonth =
(0,January,Februrary,March,April,May,June,July,August,September,October,Nove
mber,December)[$2];
$commyear = $1;

if ($3 == '01') {$cdaytype = "st";}
elsif ($3 == '02') {$cdaytype = "nd";}
elsif ($3 == '03') {$cdaytype = "rd";}
else {$cdaytype = "th";}

$commdateser = "$3$cdaytype $commmonth $commyear";

$comment =~ s/\. /\.\r<BR>\n/g ;
$comment =~ s/\, /\,\r<BR>\n/g ;
$comment =~ s/\! /\!\r<BR>\n/g ;
$comment =~ s/\? /\?\r<BR>\n/g ;
$comment = "\n".$comment."\n";

if ($auth_name eq '') {$auth_name = 'Anonymous';}

$body = $body.$otbl.'<IMG SRC="/images/'.$rating.'stars.jpg" ALT="">'.$ctbl;
$body = $body."<TR><TD width=10></TD><TD>$comment$ctbl";
$body = $body."$otbl Submitted by: $auth_name<br>Date: $commdateser";
$body = $body."$otbl <IMG SRC=\"/images/dot_cl.gif\" WIDTH=1 HEIGHT=4
HSPACE=0 VSPACE=4 BORDER=0 ALT=\"\"> $ctbl";
}
$sth2->finish;

$desc = "$name, $city, $county, & site title";
$keywords = "$name, $city, $county, & site title";


$htmlCodeNew = $htmlCode;
$htmlCodeNew =~ s/!title!/\r\n$title\r\n/ ;
$htmlCodeNew =~ s/!desc!/\r\n$desc\r\n/ ;
$htmlCodeNew =~ s/!keywords!/\r\n$keywords\r\n/ ;
$htmlCodeNew =~ s/!date!/\r\n$dateser\r\n/ ;
$htmlCodeNew =~ s/!body!/\r\n$body\r\n/ ;

open (FileToWrite, ">$fileName") or die "Can't Create/Open File\r\n";

print FileToWrite "$htmlCodeNew";

close(FileToWrite);

}


$sth->finish;

$dbh->disconnect();


Don't know if that will help at all, and this is just one of the scripts we
use to build some pages.

>
> hi mate i am interested in finding example trawlers in either php
> or perl ,
> is mod_fast_cgi a better way to do this ? is there a way of
> trawling through
> each page creating a html version of it and also converting the links to
> other pages and the other pages too ?
>
> "Mark Cubitt" <[EMAIL PROTECTED]> wrote in message
> news:<[EMAIL PROTECTED]>...
> > Are all the news stories in a database?
> >
> > If so we are current in devolopment of a simaliar site (although not
> news),
> > we are using Perl scripts to build all the HTML pages (both Index's and
> > Pages) during the evening (4am), it takes about 8 secs to build
> 2500 pages
> > and the Perl scripts could be a lot more efficiant, we are
> using PHP todo
> > all the admin and stat areas of the site.
> >
> > Static HTML pages not only increase the speed but they also improve SEO
> > (Search Engine Optimasion) if handled correctly.
> >
> > Don't know if this will help you but maybe it is a an idea.
> >
> > Also i'm sorry if this answer takes this a little off topic.
> >
> > regards
> >
> > Mark Cubitt
> >
> > > -----Original Message-----
> > > From: electroteque [mailto:[EMAIL PROTECTED]
> > > Sent: 24 February 2003 11:13
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] creating flat versions of php pages
> > >
> > >
> > > i dont understand what you mean , anyway, this is a short term
> > > situation as
> > > the site is pretty slow and cpu intensive,  the setup is a sun solaris
> box
> > > running apache 1.3 and php3 , just had a meeting today to push
> > > through apahe
> > > 2 and php 4.3 ut wont happen for a while , we need a solution in the
> next
> > > month, we basically need a system that will trawl the site or
> the latest
> > > news and flatten them so they are less taxing on the server as
> > > our last time
> > > cost us dearly , 170,000 hits in one day !
> > > so would flattening to html solve our problem or is the server
> > > going to get
> > > hammered anyway ?
> > >
> > > "Gonzo" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > > > hi guys we have 2 very high traffic sites and we need
> > > > > to be able to make these pages load faster , we are
> > > > > coming up with a solution to make flat file versions of
> > > > > the sites in the short term before we start using
> > > > > caching technologhies is this the right way to go about
> > > > > this ?
> > > >
> > > > I think anyone trying to answer this would need to know
> > > > more about your setup.  Caching is not necessarily the
> > > > answer if a dynamic page is dynamic enough every time to
> > > > be different.  (Please keep this on-list)
> > > >
> > > > > also whats is the best way to parse a php page
> > > > > ie foo.php?id=1, foo.php?id=2 with the contents of each
> > > > > story to a file and update all the links. maybe with
> > > > > naming conventions like foo/1.html, foo/2.html in a mod
> > > > > rewrite style
> > > >
> > > > I like using Variables from URI:
> > > >
> > > >   http://nirvani.org/software/variables_from_uri/
> > > >
> > > > Gonzo
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > > ******************************************************************
> > > ************
> > >  This email has been virus checked by the Eclipse Internet
> > > MAILsafe service
> > > ******************************************************************
> > > ************
> > >  www: http://www.eclipse.net.uk/                email:
> > > [EMAIL PROTECTED]
> > > ******************************************************************
> > > ************
> > >
> > >
> >
>
>
>
>
> ******************************************************************
> ************
>  This email has been virus checked by the Eclipse Internet
> MAILsafe service
> ******************************************************************
> ************
>  www: http://www.eclipse.net.uk/                email:
> [EMAIL PROTECTED]
> ******************************************************************
> ************
>
>


--- End Message ---
--- Begin Message ---
Please, 

How do I make to format my date in the my format? For Example:

## I filter
$filter = " SELECT DTVECTO FROM CLIENTS";
$result = mysql_query($filter);
$rows   = mysql_num_rows($result);
while($rows = mysql_fetch_array($result)) {
   ## I get date to the data base 
   $my_date = $rows["DTVECTO"];
   ## I print
   print($my_date);
}

I want to show my date in format: 01/12/2003 (dd/mm/yyyy).
For Example
Date                Value
01/09/2003     $ 50.00
01/10/2003     $ 60.00
01/11/2003     $ 70.00



thanks

--- End Message ---
--- Begin Message --- At 13:25 25-2-03, you wrote:
Please,

How do I make to format my date in the my format? For Example:
you forgot to tell how the date in the database is formatted, that is quite important.

did you read the php manual on date() ?
http://www.php.net/manual/en/function.date.php


## I filter
$filter = " SELECT DTVECTO FROM CLIENTS";
$result = mysql_query($filter);
$rows   = mysql_num_rows($result);
while($rows = mysql_fetch_array($result)) {
   ## I get date to the data base
   $my_date = $rows["DTVECTO"];
   ## I print
   print($my_date);
}

I want to show my date in format: 01/12/2003 (dd/mm/yyyy).
For Example
Date                Value
01/09/2003     $ 50.00
01/10/2003     $ 60.00
01/11/2003     $ 70.00



thanks


--- End Message ---
--- Begin Message ---
No don't use the PHP date function, MySQL has an inbuilt function
exactly for this.

See DATE_FORMAT http://www.mysql.com/doc/en/Date_and_time_functions.html

HTH

Adrian
www.phpscriptsearch.com

-----Original Message-----
From: Chris Hayes [mailto:[EMAIL PROTECTED] 
Sent: 25 February 2003 12:32
To: [EMAIL PROTECTED]
Subject: Re: [PHP] FormatDateTime in PHP


At 13:25 25-2-03, you wrote:
>Please,
>
>How do I make to format my date in the my format? For Example:
you forgot to tell how the date in the database is formatted, that is
quite 
important.

did you read the php manual on date() ?
http://www.php.net/manual/en/function.date.php


>## I filter
>$filter = " SELECT DTVECTO FROM CLIENTS";
>$result = mysql_query($filter);
>$rows   = mysql_num_rows($result);
>while($rows = mysql_fetch_array($result)) {
>    ## I get date to the data base
>    $my_date = $rows["DTVECTO"];
>    ## I print
>    print($my_date);
>}
>
>I want to show my date in format: 01/12/2003 (dd/mm/yyyy).
>For Example
>Date                Value
>01/09/2003     $ 50.00
>01/10/2003     $ 60.00
>01/11/2003     $ 70.00
>
>
>
>thanks


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


--- End Message ---
--- Begin Message ---
thanks to all


"Adrian Portsmouth" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
> No don't use the PHP date function, MySQL has an inbuilt function
> exactly for this.
>
> See DATE_FORMAT http://www.mysql.com/doc/en/Date_and_time_functions.html
>
> HTH
>
> Adrian
> www.phpscriptsearch.com
>
> -----Original Message-----
> From: Chris Hayes [mailto:[EMAIL PROTECTED]
> Sent: 25 February 2003 12:32
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] FormatDateTime in PHP
>
>
> At 13:25 25-2-03, you wrote:
> >Please,
> >
> >How do I make to format my date in the my format? For Example:
> you forgot to tell how the date in the database is formatted, that is
> quite
> important.
>
> did you read the php manual on date() ?
> http://www.php.net/manual/en/function.date.php
>
>
> >## I filter
> >$filter = " SELECT DTVECTO FROM CLIENTS";
> >$result = mysql_query($filter);
> >$rows   = mysql_num_rows($result);
> >while($rows = mysql_fetch_array($result)) {
> >    ## I get date to the data base
> >    $my_date = $rows["DTVECTO"];
> >    ## I print
> >    print($my_date);
> >}
> >
> >I want to show my date in format: 01/12/2003 (dd/mm/yyyy).
> >For Example
> >Date                Value
> >01/09/2003     $ 50.00
> >01/10/2003     $ 60.00
> >01/11/2003     $ 70.00
> >
> >
> >
> >thanks
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



--- End Message ---
--- Begin Message ---
Can anyone help.
I have code which will send email with an attachment via PHP however
when it arrives to the destination email the PDF file is empty. I have
come across a few emails where people have had the same problem but no
answers.
Any ideas?
Using the normal mail() function with the code below:
        $to      = $email;
        $from    = "[EMAIL PROTECTED]";
        $subject = "Thank you for downloading the document";
        $message = "Dear $username,<br> 
                        Thank you for taking the time to subscribe for
our free document.<br>
                        Please find the document attached to this
email.";

        // Obtain file upload vars
        $fileatt      = "db/";   // Location of file on server
        $fileatt_type = "application/pdf";// Type of file being sent
        $fileatt_name = "webopman.pdf";// Name of file

        $headers = "From: $from";
        // If the file exists...
        if (file_exists($fileatt)) {
        // Read the file to be attached ('rb' = read binary)
        $file = fopen($fileatt,'rb');
        $data = fread($file,filesize($fileatt));
        fclose($file);

  // Generate a boundary string
        $semi_rand = md5(time());
        $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
  
  // Add the headers for a file attachment
        $headers .= "\nMIME-Version: 1.0\n" .
              "Content-Type: multipart/mixed;\n" .
              " boundary=\"{$mime_boundary}\"";

  // Add a multipart boundary above the plain message
        $message = "This is a multi-part message in MIME format.\n\n" .
             "--{$mime_boundary}\n" .
             "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
             "Content-Transfer-Encoding: 7bit\n\n" .
             $message . "\n\n";

        // Base64 encode the file data
        $data = chunk_split(base64_encode($data));

        // Add file attachment to the message
        $message .= "--{$mime_boundary}\n" .
              "Content-Type: {$fileatt_type};\n" .
                  " name=\"{$fileatt_name}\"\n" .
              //"Content-Disposition: attachment;\n" .
              //" filename=\"{$fileatt_name}\"\n" .
              "Content-Transfer-Encoding: base64\n\n" .
              $data . "\n\n" .
              "--{$mime_boundary}--\n";
        }
        $ok = @mail($to, $subject, $message, $headers);

Real stuck here.

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


--- End Message ---
--- Begin Message ---
Is it possible to use 'fputs' to write to a text file and include php code
within it?

That way the generated page will have working php syntax within.

How do I make it so the php code is treated like text and not code?


-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 iChat/AIM: ichatmacdock
_______________________________________________________________________
"Whatever you do, work at it with all your heart,
as working for the Lord, not for men."
~Colossians 3:23 <{{{><
--



--- End Message ---

Reply via email to