OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 18 Jul 2003 16:35:44 -0000 Issue 2183

php-general-digest-helplists.php.net
Date: Fri Jul 18 2003 - 11:35:44 CDT


php-general Digest 18 Jul 2003 16:35:44 -0000 Issue 2183

Topics (messages 155721 through 155805):

Value for entire file
        155721 by: Uma Shankari T.
        155723 by: Jason Wong
        155724 by: Bobby Patel
        155744 by: Ford, Mike [LSS]

Re: Input Submi Help
        155722 by: Bobby Patel

Re: Still problem with files
        155725 by: Jason Wong
        155726 by: Curt Zirzow
        155727 by: Curt Zirzow
        155729 by: Curt Zirzow
        155773 by: Beauford.2005
        155779 by: skate

problem matching multiple times
        155728 by: Vince LaMonica
        155734 by: Curt Zirzow
        155738 by: Vince LaMonica
        155771 by: Curt Zirzow

need background info on PHP & Java
        155730 by: Jan Bro

redirecting to a url..
        155731 by: Louie Miranda
        155732 by: Louie Miranda
        155735 by: Curt Zirzow
        155736 by: Louie Miranda
        155789 by: Chris Shiflett

Recovering from a time out
        155733 by: Gerard Samuel
        155770 by: Anthony
        155772 by: Curt Zirzow

Re: Too much of $GLOBALS[] a problem??
        155737 by: Robert Cummings
        155740 by: Ow Mun Heng

Using href as a submit for a form
        155739 by: Ron Allen
        155741 by: Larry_Li.contractor.amat.com
        155742 by: Vince LaMonica

ulimit with php
        155743 by: Eddy-Das

Need to use META tag with variable attached
        155745 by: Ron Allen
        155746 by: Ron Allen
        155747 by: Ryan Gibson

Variable not passed twixt pages..
        155748 by: Chris Blake
        155749 by: desa15.necso.es
        155754 by: Nadim Attari
        155768 by: Chris Blake

popping up download dialog box
        155750 by: Binay Agarwal
        155751 by: desa15.necso.es
        155752 by: Jason Wong
        155755 by: Binay Agarwal
        155761 by: Curt Zirzow

base64_encode corrupts files?
        155753 by: Imposible

osCommerce and modifications
        155756 by: Edward Peloke
        155757 by: Richard Baskett
        155758 by: Edward Peloke
        155769 by: Jason Wong

eShox
        155759 by: Ryan A
        155763 by: Edward Peloke
        155764 by: Richard Baskett
        155767 by: Edward Peloke

Multidimensional arrays
        155760 by: Gary Broughton
        155765 by: Matt Matijevich
        155793 by: Gary Broughton

Re: new browser window in php
        155762 by: Jeffry Lester

Performance and require / include
        155766 by: Infoman: Thorsten Koch

Mail From option in PHP.ini
        155774 by: Brian S. Drexler
        155775 by: CPT John W. Holmes
        155776 by: Brian S. Drexler
        155778 by: skate
        155780 by: sven
        155781 by: Brian S. Drexler
        155782 by: Brian S. Drexler
        155783 by: Paul Chvostek
        155785 by: M.A.Bond
        155786 by: Brian S. Drexler
        155788 by: Mark
        155791 by: Brian S. Drexler

Re: A new FREE web server can do PHP faster than Apache's mod_php
        155777 by: LiteSpeed
        155794 by: John Manko
        155800 by: LiteSpeed
        155802 by: LiteSpeed
        155803 by: LiteSpeed

running SSH through a PHP script
        155784 by: James_Martin.ao.uscourts.gov
        155790 by: Paul Chvostek
        155798 by: James_Martin.ao.uscourts.gov

Re: Netscape 6, What a piece of s$# ,anyone else had problems
        155787 by: Dennis Gearon

locking to domain
        155792 by: Ryan A

omitting the #!
        155795 by: Rob Day
        155796 by: skate
        155797 by: John Nichel

Mac Address Lookup
        155799 by: Ashwin Kutty
        155804 by: skate

Re: headers already sent and cookie problem
        155801 by: Ford, Mike [LSS]

Re: A new FREE web server can do PHP faster than Apache's
        155805 by: Jim Jagielski

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hello,

  I am facing one problem..i am getting one variable value from another
file by using href..I need to use that value in the entire file..how can i
do that..??

for example i am using the href like this..

<a href=$next/index.php?year=Apr1998 target=right>

i am passing the Apr1998 to the index file..i need to use the Apr1998
value fully in any places in index.php..how can i use that ??

please advice me..

Regards,
Uma

attached mail follows:


On Friday 18 July 2003 12:40, Uma Shankari T. wrote:

> I am facing one problem..i am getting one variable value from another
> file by using href..I need to use that value in the entire file..how can i
> do that..??
>
> for example i am using the href like this..
>
> <a href=$next/index.php?year=Apr1998 target=right>

You should be using correctly formed HTML:

 <a href="..." xxx="...">

> i am passing the Apr1998 to the index file..i need to use the Apr1998
> value fully in any places in index.php..how can i use that ??

echo $_GET['year']; // Apr1998

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Given its constituency, the only thing I expect to be "open" about [the
Open Software Foundation] is its mouth.
                -- John Gilmore
*/

attached mail follows:


it should be in the $_GET or $HTTP_GET_VARS array in the index.php script.
put this at the top of your index.php script

var_dump ($_GET); # or $HTTP_GET_VARS depending on PHP version

and see if the value is there. Also, if you are using the value in a
function and you have PHP < 4.1.0 (I think), GET array is not global so to
get this value you have to declare the array global
example

function some_function () {
    global $_GET;
    echo $_GET['year'];
}

NOT

function some_function () {
      echo $_GET['year'];
}

Bobby
"Uma Shankari T." <umashankarilantana.tenet.res.in> wrote in message
news:Pine.LNX.4.33.0307181003570.9494-100000lily.iitm.ernet.in...
>
> Hello,
>
> I am facing one problem..i am getting one variable value from another
> file by using href..I need to use that value in the entire file..how can i
> do that..??
>
> for example i am using the href like this..
>
> <a href=$next/index.php?year=Apr1998 target=right>
>
> i am passing the Apr1998 to the index file..i need to use the Apr1998
> value fully in any places in index.php..how can i use that ??
>
> please advice me..
>
> Regards,
> Uma
>

attached mail follows:


> -----Original Message-----
> From: Bobby Patel [mailto:anup_patelrogers.com]
> Sent: 18 July 2003 06:11
>
> it should be in the $_GET or $HTTP_GET_VARS array in the
> index.php script.
> put this at the top of your index.php script
>
> var_dump ($_GET); # or $HTTP_GET_VARS depending on PHP version
>
> and see if the value is there. Also, if you are using the value in a
> function and you have PHP < 4.1.0 (I think), GET array is not
> global so to
> get this value you have to declare the array global

No, $_GET has always been superglobal, it just didn't exist before 4.1.0 -- so for PHP <4.1.0 it's:

   function some_function () {
       global $HTTP_GET_VARS;
       echo $HTTP_GET_VARS['year'];
 }

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


I thought you could, but actually I dont think you can ... however there is
this little hack I just came up with.
FORM Example
<form action = 'redirect.php>

<input type = 'submit' name = 'Page1' value = "goto Page 1">
<input type = 'submit' name = 'Page2' value = "goto Page 2">

</form>

Code for redirect.php
<?php

# Has button 1 been pushed/sent?
if (isset ($HTTP_POST_VARS['Page1'])) {
    include ('page1.php');
    exit(); #optional depending on programming style
}
# Has button 2 been pushed/sent?
elseif (isset ($HTTP_POST_VARS['Page2'])) {
    include ('page2.php');
    exit(); #optional depending on programming style
}
# Both buttons NOT been pushed/sent
else {
    die ('no page selected');
}
?>

I hope you are familiar enough with PHP to understand the above. Basically
depending on what Page variable was passed from the submit button, then you
pull that script (either page1.php or page2.php). Note: The name attribute
of the submit button must match in the POST array and also are case
sensitive.

Bobby

"Matt Palermo" <mpalermovt.edu> wrote in message
news:000601c34cb6$26a8ee70$9100a8c0laptop...
> I have a script that contains a form which goes to page1.php on the
> click of a submit button. Inside the form are lots of checkboxes and
> things to fill out that get passed to page1.php. I want to put another
> button in there that send all the same names and values of the
> checkboxes to page2.php. Is this possible to have 2 buttons going to 2
> different places, but using the same data for all other form elements?
> I would really appreciate any help I can get. Thanks.
>
> Matt
>

attached mail follows:


On Thursday 17 July 2003 12:18, Beauford.2005 wrote:

> Sorry for the extra emails, but I thought I had this licked, but now
> other problem pop up. As I said, I have a file with many lines like
> <Option Value="3">Alfredsson in it. I have been able to read the file
> into an array and display it, but I am trying to do a comparison IF
> statement and no matter what I try I can't figure out what to compare.
> To explain better here is my code so far.
>
> $filename = "players.inc";
>
> $fd = fopen ($filename, "r");
> while (!feof ($fd)) {
> $buffer = fgets($fd);
> $list[] = $buffer;
> }
> fclose ($fd);

Using file() instead of the above would be much easier.

> for($i = 0; $i < 131; $i++) {
> if($list[$i] != ????????? {
> echo "<BR>".htmlspecialchars($list[$i]); }
> }
>
> So using the example above what would I use where the question marks are
> if I wanted to display everything but this line - <Option
> Value="3">Alfredsson. I have tried a variety of ways to do this:

If you're going to be using file() then:

  if($list[$i] != "<Option> Value=\"3\">Alfredsson\n";

Note the \n, substitute for whatever CR/LF characters are present in your
file because file() leaves them intact.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Don't expect people to keep in step--it's hard enough just staying in line.
*/

attached mail follows:


Beauford.2005 <beauford.2005rogers.com> wrote:
> Hi,

Hello

>
> Sorry for the extra emails, but I thought I had this licked, but now
> other problem pop up. As I said, I have a file with many lines like
> <Option Value="3">Alfredsson in it. I have been able to read the file
> into an array and display it, but I am trying to do a comparison IF
> statement and no matter what I try I can't figure out what to compare.
> To explain better here is my code so far.
>
> $filename = "players.inc";
>
> $fd = fopen ($filename, "r");
> while (!feof ($fd)) {
> $buffer = fgets($fd);
> $list[] = $buffer;
> }
> fclose ($fd);

Have you looked at the file() function? it does all this work for you.
http://php.net/file

>
> for($i = 0; $i < 131; $i++) {
> if($list[$i] != ????????? {
> echo "<BR>".htmlspecialchars($list[$i]); }
> }
>
> So using the example above what would I use where the question marks are
> if I wanted to display everything but this line - <Option
> Value="3">Alfredsson. I have tried a variety of ways to do this:

Be careful with loops like this you might want to use the foreach
statement in this case

http://us3.php.net/foreach

>
> i.e
>
> $p = "<Option Value=\"131\">Alfredsson";
>
> for($i = 0; $i < 131; $i++) {
> if(htmlspecialchars($list[$i]) != $p) {
> echo "<BR>".htmlspecialchars($list[$i]);
> }
> }

first of you dont want to compare the value with the htmlspecialchar()
function, only use that to translate html chars like < to &lt; so the
browser is will display the html code instead of rendering it.

second, the fgets() you used above still has the carriage return on it
so you will need to chomp that off or add it to your compare string.

http://php.net/trim

>
> This is just a sample script that I want to get running before I
> actuaaly put it into use, so any help is appreciated.

I hope that helps you getting it running.

>
>
 
Curt
--

attached mail follows:


Jason Wong <php-generalgremlins.biz> wrote:
> On Thursday 17 July 2003 12:18, Beauford.2005 wrote:
> >
> > So using the example above what would I use where the question marks are
> > if I wanted to display everything but this line - <Option
> > Value="3">Alfredsson. I have tried a variety of ways to do this:
>
> If you're going to be using file() then:
>
> if($list[$i] != "<Option> Value=\"3\">Alfredsson\n";
>
> Note the \n, substitute for whatever CR/LF characters are present in your
> file because file() leaves them intact.

I would recomend using
 if(trim($list[$i]) != "<Option> Value=\"3\">Alfredsson")

it will handle the any problems with DOS or UNIX text files.

Curt.
--

attached mail follows:


Curt Zirzow <curtzirzow.dyndns.org> wrote:
> Beauford.2005 <beauford.2005rogers.com> wrote:
> >
> > i.e
> >
> > $p = "<Option Value=\"131\">Alfredsson";

And watch out for case sensitive issues
 'Option' != 'option'

Curt
--

attached mail follows:


For whatever reason your suggestions still caused me problems, but I did
come up with a solution that works.

if (preg_match ("/Alfredsson/", $buffer))

Another question though regarding \n. What I'm doing here is reading the
file, omitting one entry, adding another, and saving it back to the
file. When I add the entry and save it back to the file it appears
beside the last entry instead of below it. How do I get it so it is
below it. I have tried using a \n but no go. I am probably missing
something, but not sure what. This is the first time I've played with
files in PHP.

i.e.

<Option Value="155">Roy, P
<Option Value="77">Theodore
<Option Value="26">Thibault<Option Value="68">Worrel

-----Original Message-----
From: Curt Zirzow [mailto:curtzirzow.dyndns.org]
Sent: July 18, 2003 1:50 AM
To: PHP
Subject: Re: [PHP] Still problem with files

Curt Zirzow <curtzirzow.dyndns.org> wrote:
> Beauford.2005 <beauford.2005rogers.com> wrote:
> >
> > i.e
> >
> > $p = "<Option Value=\"131\">Alfredsson";

And watch out for case sensitive issues
 'Option' != 'option'

Curt
--

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

attached mail follows:


have you tried \r\n ?

----- Original Message -----
From: "Beauford.2005" <beauford.2005rogers.com>
To: "'Curt Zirzow'" <curtzirzow.dyndns.org>; "'PHP'"
<php-generallists.php.net>
Sent: Thursday, July 17, 2003 3:40 PM
Subject: RE: [PHP] Still problem with files

> For whatever reason your suggestions still caused me problems, but I did
> come up with a solution that works.
>
> if (preg_match ("/Alfredsson/", $buffer))
>
> Another question though regarding \n. What I'm doing here is reading the
> file, omitting one entry, adding another, and saving it back to the
> file. When I add the entry and save it back to the file it appears
> beside the last entry instead of below it. How do I get it so it is
> below it. I have tried using a \n but no go. I am probably missing
> something, but not sure what. This is the first time I've played with
> files in PHP.
>
> i.e.
>
> <Option Value="155">Roy, P
> <Option Value="77">Theodore
> <Option Value="26">Thibault<Option Value="68">Worrel
>
> -----Original Message-----
> From: Curt Zirzow [mailto:curtzirzow.dyndns.org]
> Sent: July 18, 2003 1:50 AM
> To: PHP
> Subject: Re: [PHP] Still problem with files
>
>
> Curt Zirzow <curtzirzow.dyndns.org> wrote:
> > Beauford.2005 <beauford.2005rogers.com> wrote:
> > >
> > > i.e
> > >
> > > $p = "<Option Value=\"131\">Alfredsson";
>
> And watch out for case sensitive issues
> 'Option' != 'option'
>
> Curt
> --
>
> --
> 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
>
>
>

attached mail follows:


Hi All,

I have a content management system that I'm building and I'm having issues
matching a variable that needs to be replaced with rows from a database.
Basicly I have something setup similar to bbcode, where a user enters
html-like text for formatting - eg: [b]bold text[/b]. I'm now adding the
ability to link photos in this formatted text.

In order to display the page using html, I obviously need to convert the
special tags to their real ones. With the images, I'm actually pulling
data [image name, width, height, image_placer, alignment, etc] from a
database. There can be more than 1 image on a page [and more than 10,
actually]. The user would simply type into the CMS editor something like,
"Here is a photo of my dog ###Image1###" The ###Image1### is a
placeholder. The user gets assigned a placeholder for each image they
upload. They then assign different parameters to that image [a caption,
and center/left/right alignment].

In order to display this data, I call a function called vencode() on the
page that a user will see:

<?php
$message = vencode("$message");
echo "$message"; ?>

The entire page's content section is inside $message. The vencode()
function looks like this:

function vjencode($message) {
 
 $message = " " . $message ;

##--- [b] and [/b] for bolding text.
 $message = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $message);

##--- [i] and [/i] for italicizing text.
 $message = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $message);

    
##--- Patterns and replacements for URL and email tags..
        $patterns = array();
        $replacements = array();

##--- [url]xxxx://www.seweb.uci.edu[/url] code..
        $patterns[0] = "#\[url\]([a-z]+?://){1}(.*?)\[/url\]#si";
        $replacements[0] = '<a href="\1\2">\1\2</a>';
        
        
##--- [url]www.seweb.uci.edu[/url] code.. (no xxxx:// prefix).
        $patterns[1] = "#\[url\](.*?)\[/url\]#si";
        $replacements[1] = '<a href="http://\1">\1</a>';

##--- [url=xxxx://www.seweb.uci.edu]Social Ecology Home[/url] code..
        $patterns[2] = "#\[url=([a-z]+?://){1}(.*?)\](.*?)\[/url\]#si";
        $replacements[2] = '<a href="\1\2">\3</a>';

##--- display photos [having problems with this]
$patterns[3] = "#\#\#\#Image(.*?)\#\#\##si";
// this matches just fine strings like ###Image1### and ###Image2###

 if ($_GET[ppdid] != "") { // the ppdid var is passed in the URL
 $sel_image = "SELECT * from ppd_photos where ppd_id = '$_GET[ppdid]' AND place_holder = '$thephoto[0]'";
// in this case, the page with a ppdid of '3' has 2 images, who's
// placeholders are: ###Image1### and ###Image2###
 $sel_image_result = safe_query($sel_image);
 $sel_image_row = mysql_fetch_array($sel_image_result);
 $image_id = $sel_image_row["image_id"];
 $image_name = $sel_image_row["image_name"];
 $caption = $sel_image_row["caption"];
 $width = $sel_image_row["width"];
 $height = $sel_image_row["height"];
 $image_alignment = $sel_image_row["image_alignment"];
// replacements[3] is all one one line -sorry about word wrap!
 $replacements[3] = "<br><table border=0 cellspacing=2 cellpadding=0
width=\"$width\" align=\"$image_alignment\"><tr><td><img
src=\"/uimages/$image_name\"
height=\"$height\" width=\"$width\" border=1></td></tr><tr><td><font
class=\"caption\">$caption<font></td></tr></table><br>";
}

$message = preg_replace($patterns, $replacements, $message);

return $message;
} //end of function

In the case of the page with the ppdid of '3', there are two images
assigned to that page. However, when running the above code, I two photos
of the first listed image! Eg, the text in $message looks like this:

---------------------
Hello world, look at my [b]cat[/b]: ###Image1### Nice, huh?
And now look at my [b]dog[/b]: ###Image2### Not so nice, eh?
---------------------

The substitution code also translates linebreaks as <br>s and such, but I
didn't think I needed to include the entire list of substitutions it
makes.

I'm sure I need a while loop in there somewhere, but I can not figure out
where. I know the code is looping through the other substitutions ok,
since all text that should be bold is, and all links that need to be made
into valid URIs are.

The db query does run fine if running within mysql, and substituting
###Image1### and ###Image2### for $thephoto[0]. I know that $thephoto[1]
simply contains a "1" [since that is the value of $patterns[3]].

Any tips about where I need to loop and how, would be most appreciated!

/vjl/

--
Vince LaMonica UC Irvine, School of Social Ecology
 W3 Developer <*> 116 Social Ecology I, Irvine, CA 92697
 vjluci.edu http://www.seweb.uci.edu/techsupport

 If it be now, 'tis not to come; if it be not to come, it will be now;
 if it be not now, yet it will come: the readiness is all."
                   -- William Shakespeare, "Hamlet."

attached mail follows:


Vince LaMonica <vjluci.edu> wrote:
> Hi All,

hello

 
> [...]
> function vjencode($message) {
>
> $message = " " . $message ;
>
> ##--- [b] and [/b] for bolding text.
> $message = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $message);
>
> ##--- [i] and [/i] for italicizing text.
> $message = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $message);

btw, you know you can do this in one step:

$message = preg_replace("/\[(i|b)\](.*?)\[\/(i|b)\]/si", "<\$1>\$2</\$3>", $message);

> [...]
> ##--- display photos [having problems with this]
> $patterns[3] = "#\#\#\#Image(.*?)\#\#\##si";
> // this matches just fine strings like ###Image1### and ###Image2###

I would change mabey make sure you catching a digit and the serpator for
readabilty /###Image(\d+)###/si

> [...]
> if ($_GET[ppdid] != "") { // the ppdid var is passed in the URL
> $sel_image = "SELECT * from ppd_photos where ppd_id = '$_GET[ppdid]' AND place_holder = '$thephoto[0]'";
> // in this case, the page with a ppdid of '3' has 2 images, who's
> // placeholders are: ###Image1### and ###Image2###
> $sel_image_result = safe_query($sel_image);
> $sel_image_row = mysql_fetch_array($sel_image_result);
> $image_id = $sel_image_row["image_id"];
> $image_name = $sel_image_row["image_name"];
> $caption = $sel_image_row["caption"];
> $width = $sel_image_row["width"];
> $height = $sel_image_row["height"];
> $image_alignment = $sel_image_row["image_alignment"];
> // replacements[3] is all one one line -sorry about word wrap!
> $replacements[3] = "<br><table border=0 cellspacing=2 cellpadding=0
> width=\"$width\" align=\"$image_alignment\"><tr><td><img
> src=\"/uimages/$image_name\"
> height=\"$height\" width=\"$width\" border=1></td></tr><tr><td><font
> class=\"caption\">$caption<font></td></tr></table><br>";
> }

The only solution I can think of is while your looping through the
images they have build more pattern/replacemen array items

foreach (row in db)
   $pattern[] = /###Image($count+1)###
   $$replacements[] = "<htmlstuff>$image_name</htmlstuff>";

Curt
--

attached mail follows:


On Fri, 18 Jul 2003, Curt Zirzow wrote:

} btw, you know you can do this in one step:
}
} $message = preg_replace("/\[(i|b)\](.*?)\[\/(i|b)\]/si", "<\$1>\$2</\$3>", $message);

Doh! Thanks for the tip...that'll save some lines of code :)

} > $patterns[3] = "#\#\#\#Image(.*?)\#\#\##si";
} > // this matches just fine strings like ###Image1### and ###Image2###
}
} I would change mabey make sure you catching a digit and the serpator for
} readabilty /###Image(\d+)###/si

Ok. Changed it and you're right - much easier to understand what the
patern is being searched.

} > [...]
} > if ($_GET[ppdid] != "") { // the ppdid var is passed in the URL
} > $sel_image = "SELECT * from ppd_photos where ppd_id = '$_GET[ppdid]' AND place_holder = '$thephoto[0]'";
} > // in this case, the page with a ppdid of '3' has 2 images, who's
} > // placeholders are: ###Image1### and ###Image2###
} > $sel_image_result = safe_query($sel_image);
} > $sel_image_row = mysql_fetch_array($sel_image_result);
} > $image_id = $sel_image_row["image_id"];
} > $image_name = $sel_image_row["image_name"];
} > $caption = $sel_image_row["caption"];
} > $width = $sel_image_row["width"];
} > $height = $sel_image_row["height"];
} > $image_alignment = $sel_image_row["image_alignment"];
} > $replacements[3] = "<br><table border=0 cellspacing=2 cellpadding=0
[snip]
}
} The only solution I can think of is while your looping through the
} images they have build more pattern/replacemen array items
}
} foreach (row in db)
} $pattern[] = /###Image($count+1)###
} $$replacements[] = "<htmlstuff>$image_name</htmlstuff>";

Do you mean:

$patterns[3] = "/###Image($count+1)###/";
$replacements[3] = "<html stuff....";

The problem with this is that I don't know how many rows are going to come
back, since the first/only SQL statement just returns one row [whatever
the current image placeholder is...in this case, ###Image1###. So I need
to loop before I run the SQL statements.

Also, using $patterns[3] again overwrites the first call to it [the one
you recommended i re-write for readablity]. I need to make sure the
$replacements[3] contains all of the html stuff, so it needs a pattern for
the preg_replace call later in the function:

$message = preg_replace($patterns, $replacements, $message);

Thanks for your help with this!

/vjl/

--
Vince LaMonica UC Irvine, School of Social Ecology
 W3 Developer <*> 116 Social Ecology I, Irvine, CA 92697
 vjluci.edu http://www.seweb.uci.edu/techsupport

 Your mouse has moved. Windows NT must be restarted for the
 change to take effect. Reboot now? [ OK ]

attached mail follows:


Vince LaMonica <vjluci.edu> wrote:
> On Fri, 18 Jul 2003, Curt Zirzow wrote:
>
> [snip]
> }
> } The only solution I can think of is while your looping through the
> } images they have build more pattern/replacemen array items
> }
> } foreach (row in db)
> } $pattern[] = /###Image($count+1)###
> } $$replacements[] = "<htmlstuff>$image_name</htmlstuff>";
>
> Do you mean:
>
> $patterns[3] = "/###Image($count+1)###/";
> $replacements[3] = "<html stuff....";

Actually I did mean to use the $patterns[] and $replacements[], php
will automatically increase the index for you kinda makes adding
different pattern/replacement arrays easier in any order.

The array will by default be FIFO.

>
> The problem with this is that I don't know how many rows are going to come
> back, since the first/only SQL statement just returns one row [whatever
> the current image placeholder is...in this case, ###Image1###. So I need
> to loop before I run the SQL statements.

<snip>
>$sel_image = "SELECT * from ppd_photos where ppd_id = '$_GET[ppdid]' AND > place_holder = '$thephoto[0]'";
</snip>
What does this return?

I'm a bit confused right now..

>
> Also, using $patterns[3] again overwrites the first call to it [the one
> you recommended i re-write for readablity]. I need to make sure the
> $replacements[3] contains all of the html stuff, so it needs a pattern for
> the preg_replace call later in the function:

by using the patters[] and replacements[] it will avoid the overwriting.

>
> $message = preg_replace($patterns, $replacements, $message);

>
> Thanks for your help with this!
>
> /vjl/

oh, i'm feeling helpful today.. another suggestion for performance:

after the user enters in his stuff, he wants, in your CMS and before you
save it, parse it for all the special tags you have and keep track of it
somewhere. That way when you output it (in this script) you only need
to apply the necessary pattern/replacements before outputing it to the
browser.

Curt.
--

attached mail follows:


Hi,
I know, I've posted a while back, but I still couldn't find any docuuments
on
how PHP and Java interact. I know what I've pulled out of the manual and I
knwo I could also connect via Java Servlet (thx Ray)
but that's just not enough, to satisfy. I mean if I'm using it, I sure want
to
know why it's working and how. To give you an rough idea on what I'm talking
about here is some sampe code:
<?php
  $system = new Java("java.lang.System");
  print "Java version=".$system->getProperty("java.version")." <br>\n";
....

thx I'd really apreciate it as my boss want's an answer, too.

Jan Bro

attached mail follows:


I have this form with 2 values under 1 name ColTemplate. I was hoping if i
can redirect it to another url? on the ?? if templateone or templatetwo.

Anyhelp would be good.

-- code ---------
$v_get_template = $_POST['ColTemplate'];

if ($v_get_template === 'TemplateOne') {
 ??

} elseif ($v_get_template === 'TemplateTwo') {
 ??
}
-- code ---------

--
Thank you,
Louie Miranda (louieaxishift.ath.cx)

attached mail follows:


My solution..

echo "<meta http-equiv=\"REFRESH\" CONTENT=\"0; URL=us/index.php\">";

Or you may have other more advance alternatives?

--
Thank you,
Louie Miranda (louieaxishift.ath.cx)

----- Original Message -----
From: "Louie Miranda" <louieaxishift.ath.cx>
To: <php-generallists.php.net>
Sent: Friday, July 18, 2003 2:08 PM
Subject: [PHP] redirecting to a url..

> I have this form with 2 values under 1 name ColTemplate. I was hoping if i
> can redirect it to another url? on the ?? if templateone or templatetwo.
>
> Anyhelp would be good.
>
> -- code ---------
> $v_get_template = $_POST['ColTemplate'];
>
>
> if ($v_get_template === 'TemplateOne') {
> ??
>
> } elseif ($v_get_template === 'TemplateTwo') {
> ??
> }
> -- code ---------
>
>
>
> --
> Thank you,
> Louie Miranda (louieaxishift.ath.cx)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Louie Miranda <louieaxishift.ath.cx> wrote:
> I have this form with 2 values under 1 name ColTemplate. I was hoping if i
> can redirect it to another url? on the ?? if templateone or templatetwo.

header('Location: http://domain/file');

 
Curt
--

attached mail follows:


thanks, this is much better.

--
Thank you,
Louie Miranda (louieaxishift.ath.cx)

----- Original Message -----
From: "Curt Zirzow" <curtzirzow.dyndns.org>
To: <php-generallists.php.net>
Sent: Friday, July 18, 2003 2:29 PM
Subject: Re: [PHP] redirecting to a url..

>
> Louie Miranda <louieaxishift.ath.cx> wrote:
> > I have this form with 2 values under 1 name ColTemplate. I was hoping if
i
> > can redirect it to another url? on the ?? if templateone or templatetwo.
>
> header('Location: http://domain/file');
>
>
> Curt
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


--- Louie Miranda <louieaxishift.ath.cx> wrote:
> echo "<meta http-equiv=\"REFRESH\" CONTENT=\"0; URL=us/index.php\">";
>
> Or you may have other more advance alternatives?

You can use a protocol redirect rather than relying on HTML:

header('Location: http://yoursite.org/us/index.php');

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

attached mail follows:


Is it possible to *gracefully* recover from php timing out?
For example, uploading a large file, and php times out, so display "Oops
Timed out"
This also assumes that we have no means of changing php's time out value??

Thanks for your comments..

attached mail follows:


change PHP's timeout value in php.ini :

max_execution_time = 30 ; Maximum execution time of each script, in
seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing
request data

don't know if you can have php do something like load a different script or
a basic HTML page on timeout. That would be pretty cool though, anyone
know?

- Anthony

"Gerard Samuel" <gsamtrini0.org> wrote in message
news:3F17925C.6020501trini0.org...
> Is it possible to *gracefully* recover from php timing out?
> For example, uploading a large file, and php times out, so display "Oops
> Timed out"
> This also assumes that we have no means of changing php's time out value??
>
> Thanks for your comments..
>

attached mail follows:


Anthony <atamponeattechcomputer.com> wrote:
> change PHP's timeout value in php.ini :
>
> max_execution_time = 30 ; Maximum execution time of each script, in
> seconds
> max_input_time = 60 ; Maximum amount of time each script may spend parsing
> request data
>
> don't know if you can have php do something like load a different script or
> a basic HTML page on timeout. That would be pretty cool though, anyone
> know?

I think this is what you want.

http://php.net/set_error_handler

curt
--

attached mail follows:


Rather than having the following scenario:

$GLOBALS['foo'] = 'foo';
$GLOBALS['fee'] = 'fee';

The following would be much cleaner and portable while still allowing
the ease of use of $GLOBALS based configuration:

$GLOBALS['myProjectName']['foo'] = 'foo';
$GLOBALS['myProjectName']['fee'] = 'fee';

Cheers,
Rob.

On Thu, 2003-07-17 at 22:58, Curt Zirzow wrote:
> Ow Mun Heng <ow.mun.hengwdc.com> wrote:
> > Hi All,
> >
> > Just a quick question on this. In my scripts, I'm using A LOT Of
> > $GLOBALS['my_parameter'] to get the declared values/string. 1 example below
> > :
> >
> > function display_menu_html()
> > {
> > echo '<table class="width100" cellspacing="0">'."\n";
> > echo '<tr>'."\n";
> > echo "\t".'<td class="menu">'."\n";
> > echo "\t".'<a href="home.php">' . $GLOBALS['home'] . "</a>
> >
> > [...]
> >
> > }
> >
> > This isn't really a Problem but.. is it bad programming practice?? Or I
> > should just write another function that can return the values/string?
>
>
> yes and no, that is rather a debatable question.
>
> To make my functions that echo stuff cleaner I usually do stuff like:
>
> function show_html() {
> <?
> <table class="width100" cellspacing="0">
> <tr>
> <td class="menu">
> <a href="someplace.php"><?php echo $var?></a>
> </td>
> </tr>
> </table>
> ?>
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'

attached mail follows:


Very Well Explained.. now I know how to use the code which I saw in
phpMyAdmin or Tiki.. Much better way to do it and a lot less conflicts to as
you say,variable names.

Thanks.

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168

-----Original Message-----
From: Lars Torben Wilson [mailto:torbenphp.net]
Sent: Friday, July 18, 2003 12:26 PM
To: Ow Mun Heng
Cc: php-generallists.php.net
Subject: RE: [PHP] Too much of $GLOBALS[] a problem??

On Thu, 2003-07-17 at 21:10, Ow Mun Heng wrote:
> > 'Loosely-coupled' code relied much less on the environment around it.
> > It would typically receive its values through an argument list, array
> > of values it needs, or perhaps by being a method in a class which has
> > attribute values for all of the necessary stuff.
>
> The $GLOBALS['parameter'] is actually defined in ONE(a config file that
> houses all the parameters and another a language file) place where it can
be
> changed. So, i would say that's an argument list, is it not?

No, it's a configuration file. An argument list is the bit between the
parentheses when you write a function call:

   $retval = some_func($this, $is, $the, $argument, $list);

If your config file had all of those variables in an array or something,
and you passed that array to your function, *that* would be an argument
list.

See below:

config.php:
<?php
$config = array('logout' => 1,
                'overall_summary' => 'Here is the summary',
                etc....);
?>

script.php:
<?php
include('config.php');
display_menu_html($config);
?>

Problem solved. The only thing left which can conflict is the name
$config, and you could solve that by calling it something you're sure
nobody else will be using (maybe $_omh_config or something). Now, you
can lift your config file and display_menu_html() function and drop
them into pretty much any script and be much more sure that you won't
have to crawl through all the code making sure there are no variable
name conflicts.

> The other way would be to write a function that obtains that from the
> argument list. But as I see it, it's basically the same thing? NO?

No, because say you want to use this function in another script. First
you need to make sure that this new script isn't already using any
globals with any of the names you want to use--otherwise, you'll have
variable clashes--where you expect one thing to be in $logout, for
instance, but the script is using the name $logout for something else,
and the value isn't what you expect.

> Class.. That's not somewhere I would want to venture, not right now
anyway.
> Just starting out.
>
> Cheers,
> Mun Heng, Ow
> H/M Engineering
> Western Digital M'sia
> DID : 03-7870 5168

There was a discussion on this list about programming practices and
books about programming--I think last week or the week before. Try a
search on the archives. Anyway, there are lot of great books on
programming which should help--and excellent and easy-to-read book which
covers a lot of things which you *don't* want to have to figure out
yourself is 'Code Complete', by Steve McConnell.

--
 Torben Wilson <torbenphp.net> +1.604.709.0506
 http://www.thebuttlesschaps.com http://www.inflatableeye.com
 http://www.hybrid17.com http://www.themainonmain.com
 -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----

attached mail follows:


I am using a form to submit to mysql. What I would like to do is to use a
link to submit the form instead of the standard submit button. Help is
appreicated.

attached mail follows:


Try to use javascript.
<a href="javascript:document.form1.submit()">submit</a>
Change form1 as your actual form name.

           ---------------------------------------------------------------------------------------------------------------------------------
                                                                                                                                             
                                                         To: php-generallists.php.net
                                                         cc:
           "Ron Allen" Subject: [PHP] Using href as a submit for a form
           <Ronald.Allenbondsteel2.areur.army.mil>
           07/18/03 03:47 PM
           Please respond to "Ron Allen"
                                                                                                                                             
                                                                                                                                             

I am using a form to submit to mysql. What I would like to do is to use a
link to submit the form instead of the standard submit button. Help is
appreicated.

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

attached mail follows:


On Fri, 18 Jul 2003, Ron Allen wrote:

} I am using a form to submit to mysql. What I would like to do is to use a
} link to submit the form instead of the standard submit button. Help is
} appreicated.

You could use a simple GET to submit the form. Make sure you have
register_globals off though!

Something like this:

https://www.mysite.org/submit_form.php?user=me&client=bsd&browser=galeon

The page that calls the above page would have to have form entities for
the 3 fields.

Then, on the submit_form page, you would take those vars and insert them
in the database:

$insert_user = $_GET["user"];
$insert_client = $_GET["client"];
$insert_browser = $_GET["browser"];

Obviously the user could easily change the values in the URL before they
submit [if they look at the html code behind the page]. Like all form
processing, you need to make sure that the values submitted by the user
are valid. register_globals being off is a step, but there are a lot of
error correction functions you should run before submitting form data into
a db.

HTH,

/vjl/

--
Vince LaMonica UC Irvine, School of Social Ecology
 W3 Developer <*> 116 Social Ecology I, Irvine, CA 92697
 vjluci.edu http://www.seweb.uci.edu/techsupport

"This is like losing a game by forfeit when your team was ahead
with the bases loaded and your best batter on deck."
 - Rep. John Conyers, on the DOJ agreeing to settle with Microsoft

attached mail follows:


Does any know how to catch the signal sent to a process called by PHP?

eg.

$something = `ulimit -t 30 -otherlimit; ./loop_to_death`;

ulimit should return something like SIGALRM

I use exec() but it only give me the exit code (always 128+9), not the signal......

because i need to know the reason of ulimit to terminated that program
whether is CPU time too much, or other limits exceeded

I was delighted to see "proc_get_status" but unluckily the machine only have PHP 4.3.0 .........
(can't install PHP5 because something were missing... XML? forgotten)

Please help!

--

- Eddy Wong
__________________________
inframatrix internet solutions
http://www.inframatrix.com/


       ¥¿¤KEddy
Regular Octa-Eddy
¡¢¨¡½¢ª¡½¢©¡
¢¨¢«¡¡¡½¢ª¢©
¡½¡¡¡¡½¡¡½ É\¿ß¡G eddyzitez.net
¡½¡½¡½¡¡½¡¡½ É\¨¦¡G news://news.fixip.net/chat.ed
¡½¡¡¡¡½¡¡½ É\®Þ¤Æ¡G news://news.fixip.net/
¢ª¢©¡¡¡½¢¨¢«
¡¢ª¡½¢¨¡½¢«¡

attached mail follows:


This is what I have
<META HTTP-EQUIV="refresh" content="0; URL=./ticket_admin.php">

What I would like is for this to carry a variable with it. I have tried
several different variations and they don't work obviously

<?PHP <META HTTP-EQUIV='refresh' content='0;
URL=./ticket_admin.php?ID=".'$ID." '> Does someone have an idea for this?

attached mail follows:


Got it

echo"<META HTTP-EQUIV='refresh' content='0;
URL=./ticket_admin.php?ID=$ID'>;" ?>

"Ron Allen" <Ronald.Allenbondsteel2.areur.army.mil> wrote in message
news:20030718094735.44525.qmailpb1.pair.com...
> This is what I have
> <META HTTP-EQUIV="refresh" content="0; URL=./ticket_admin.php">
>
> What I would like is for this to carry a variable with it. I have tried
> several different variations and they don't work obviously
>
> <?PHP <META HTTP-EQUIV='refresh' content='0;
> URL=./ticket_admin.php?ID=".'$ID." '> Does someone have an idea for
this?
>
>

attached mail follows:


Hi,

Try:

<META HTTP-EQUIV="refresh" content="0; URL=./ticket_admin.php?ID=<?php echo
$ID; ?>">

On 18/7/03 10:51 am, "Ron Allen" <Ronald.Allenbondsteel2.areur.army.mil>
wrote:

> This is what I have
> <META HTTP-EQUIV="refresh" content="0; URL=./ticket_admin.php">
>
> What I would like is for this to carry a variable with it. I have tried
> several different variations and they don't work obviously
>
> <?PHP <META HTTP-EQUIV='refresh' content='0;
> URL=./ticket_admin.php?ID=".'$ID." '> Does someone have an idea for this?
>
>

Ryan Gibson
-----------
ryan_gibsonjmp-partnerhip.co.uk

attached mail follows:


Greetings learned PHP(eople),

Scenario : User fills in text box, pushes Submit and textbox data gets
passed to MySQL database..

=============================================
The code from the HTML page :

<form action="savemail.php" method="GET" target="main">
<input type="text" class="mailinput" name="mailaddress" value="Your
Email Address">
==================================================

The code from savemail.php :

<?php
      $result = mysql_pconnect('localhost', 'user', 'pass');
      $query = "insert into email values ('" . $_REQUEST['mailaddress']
. "')";
   //Error stuff-------------------------------------------------
      $ResSaveMail = mysql_query($query);
      if (!$ResSaveMail)
           {
              echo("<P>Error performing query: " . mysql_error() . "</P>");
              echo("Your email has not been saved to the Delta Database.");
              exit();
           }
    //------------------------------------------------------------
?>
=======================================

THe problem :
The variable 'mailaddress' is not getting passed to savemail.php

echo $_REQUEST['mailaddress'] reveals blank....

On another programmers advice I tried using POST in my form, but that
don`t work either..

The database is getting populated with blank values...is my problem in
the php code somewhere..I been playing with this for a while now and no
joy has yet surfaced..

Any ideas greatly appreciated...

--
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379

Then there was the Formosan bartender named Taiwan-On.

attached mail follows:


echo $HTTP_GET_VARS['mailaddress'] ;

Un saludo, Danny

attached mail follows:


> <form action="savemail.php" method="GET" target="main">
...
...
...
> $query = "insert into email values ('" . $_REQUEST['mailaddress']

Use $_GET or $_POST, according to the method used...

$_GET['mailaddress']

attached mail follows:


Thanks to all who contributed, I managed to get it to work using just
$mailaddress.....

Much appreciated.....

--
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379

One learns to itch where one can scratch.
                -- Ernest Bramah

attached mail follows:


Hi every body !

I am writing a script which pops up download dialog box on click of a Link.

Headers i m sending out for downloading jpegs are:

        header("Cache-control: private");
        header("Content-Type: image/jpeg");
        header("Content-Type: application/octet-stream");
        header("Content-Length: $size");
        header("Content-Disposition: attachment; filename=$fname");
        header("Content-Transfer-Encoding: binary");
        readfile($fname);

All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its not popping up the dialog box rather it opens up the jpg file in the browser window. I don know where am i doing wrong. Please suggest me . I cracked my mind for hours but in vain. So please help me out.

Thanks in advance

Binay

attached mail follows:


if (!empty($file['file_data'])) {
  if (get_user_os() = "MAC") {
    header("Content-Type: application/x-unknown\n");
            header("Content-Disposition: attachment; filename=\"".$file
['file_name']."\"\n");
  }
  elseif (get_browser_info() = "MSIE") {
    $disposition = (!eregi("\.zip$", $file['file_name']) && $action !
= "zip" && $action != "lightbox") ? 'attachment' : 'inline';
    header("Content-Disposition: $disposition; filename=\"".$file
['file_name']."\"\n");
    header("Content-Type: application/x-ms-download\n");
  }
  elseif (get_browser_info() = "OPERA") {
    header("Content-Disposition: attachment; filename=\"".$file
['file_name']."\"\n");
    header("Content-Type: application/octetstream\n");
  }
  else {
    header("Content-Disposition: attachment; filename=\"".$file
['file_name']."\"\n");
    header("Content-Type: application/octet-stream\n");
  }
  header("Content-Length: ".$file['file_size']."\n\n");
  echo $file['file_data'];
}
exit;

Un saludo, Danny

attached mail follows:


On Friday 18 July 2003 06:34, Binay Agarwal wrote:
> Hi every body !
>
> I am writing a script which pops up download dialog box on click of a
> Link.
>
> Headers i m sending out for downloading jpegs are:
>
> header("Cache-control: private");
> header("Content-Type: image/jpeg");
> header("Content-Type: application/octet-stream");
> header("Content-Length: $size");
> header("Content-Disposition: attachment; filename=$fname");
> header("Content-Transfer-Encoding: binary");
> readfile($fname);
>
> All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its not
> popping up the dialog box rather it opens up the jpg file in the browser
> window. I don know where am i doing wrong. Please suggest me . I cracked my
> mind for hours but in vain. So please help me out.

Having two Content-Type: headers is probably confusing the poor Macs. You
don't want the first one anyway so remove it.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
When the speaker and he to whom he is speaks do not understand, that is
metaphysics.
                -- Voltaire
*/

attached mail follows:


Hi jason

Thanks for the quick suggestion. I tried removing the first content-type
header but still the problem reamains. I don know why??
Please let me know is there other way i can do the same?

Thanks
Binay

----- Original Message -----
From: "Jason Wong" <php-generalgremlins.biz>
To: <php-generallists.php.net>
Sent: Friday, July 18, 2003 4:00 PM
Subject: Re: [PHP] popping up download dialog box

> On Friday 18 July 2003 06:34, Binay Agarwal wrote:
> > Hi every body !
> >
> > I am writing a script which pops up download dialog box on click of a
> > Link.
> >
> > Headers i m sending out for downloading jpegs are:
> >
> > header("Cache-control: private");
> > header("Content-Type: image/jpeg");
> > header("Content-Type: application/octet-stream");
> > header("Content-Length: $size");
> > header("Content-Disposition: attachment; filename=$fname");
> > header("Content-Transfer-Encoding: binary");
> > readfile($fname);
> >
> > All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its
not
> > popping up the dialog box rather it opens up the jpg file in the browser
> > window. I don know where am i doing wrong. Please suggest me . I cracked
my
> > mind for hours but in vain. So please help me out.
>
> Having two Content-Type: headers is probably confusing the poor Macs. You
> don't want the first one anyway so remove it.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> When the speaker and he to whom he is speaks do not understand, that is
> metaphysics.
> -- Voltaire
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Binay Agarwal <binaym-web.com> wrote:
> Hi every body !
>
> I am writing a script which pops up download dialog box on click of a Link.
>
> Headers i m sending out for downloading jpegs are:
>
> header("Cache-control: private");
> header("Content-Type: image/jpeg");
> header("Content-Type: application/octet-stream");
> header("Content-Length: $size");
> header("Content-Disposition: attachment; filename=$fname");
> header("Content-Transfer-Encoding: binary");
> readfile($fname);
>
> All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its not popping up the dialog box rather it opens up the jpg file in the browser window. I don know where am i doing wrong. Please suggest me . I cracked my mind for hours but in vain. So please help me out.

No matter what you do you cant guarantee that the pop-up box, it all
depends on how the client's browswer software wants to do with that
paticular mime-type.

have you tried sending out something like just to see something unknown
forces it to open:
header("Content-Type: application/makeupyourown");

Curt.
--

attached mail follows:


Hi,
   I trying to send a binary file (exe, zip, etc etc) that is attached
using mail() function.
   I'm do a base64_encode and chunk_split after read the file, but the
result is a corrupt file so i can't read the attached file with my mail
client.
   When i call the script the attached file is corrupt.
   My server is Red Hat Linux 7.3, Apache 1.3.27-2, PHP 4.1.2
   Any idea?
   Please Help.

   This is my chunk of code.
<?php
// create a MIME boundary string
    $boundary = "=====XXXX." . md5(uniqid(time())) . "=====";
// add MIME data to the message headers
    $headers .= "MIME-Version:1.0\r\n";
    $headers .= "Content-Type:
multipart/mixed;\r\n\tboundary=\"$boundary\"\r\n\r\n";
// start building a MIME message
    $str ="This is a multi-part message in MIME format.\n";
    $str .= "--" . $boundary . "\r\n";
    $str .= "Content-Type: text/plain;\r\n\tcharset=\"us-ascii\"\r\n";
    $str .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $str .= "Hi all.\r\n\r\n";
//attach:w
    $str .= "--".$boundary."\n";
    $file="mapa.zip";
    $str .="Content-Type: application/octet-stream; name=\"".$file."\"\n";
    $str .="Content-Transfer-Encoding: base64\n";
    $str .="Content-Disposition: attachment; filename=\"".$file."\"\n\n";
    $fd=fopen ($file, "rb");
    $FileContent=fread($fd,filesize($file));
    fclose ($fd);
    $FileContent=chunk_split(base64_encode($FileContent));
    $str .=$FileContent;
//attach ends
    $body=$str;

//send mail
   mail("emaildomain.es", "I am really desperated", $body, $headers);
?>

attached mail follows:


Hello,

I am helping a friend with an eCommerce site. We have decided to use
osCommerce. The package looks really nice and is completely PHP. My
question is, does anyone have much experience with modifying it? We have to
make some changes but all of the code looks fairly intertwined.

Just looking for others who have done this and what changes you made...

Thanks,
Eddie

attached mail follows:


You might want to look at eShox, it's based on osCommerce, but in my opinion
it's quite a lot better.

Cheers!

Rick

"The intuitive mind is a sacred gift and the rational mind is a faithful
servant. We have created a society that honors the servant and has
forgotten the gift." - Albert Einstein

> From: epelokeechoman.com (Edward Peloke)
> Date: Fri, 18 Jul 2003 09:20:44 -0400
> To: "Php-GeneralLists. Php. Net" <php-generallists.php.net>
> Subject: [PHP] osCommerce and modifications
>
> Hello,
>
> I am helping a friend with an eCommerce site. We have decided to use
> osCommerce. The package looks really nice and is completely PHP. My
> question is, does anyone have much experience with modifying it? We have to
> make some changes but all of the code looks fairly intertwined.
>
> Just looking for others who have done this and what changes you made...
>
> Thanks,
> Eddie
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


thanks Richard, I will take a look. osCommerce does a create job of
creating an online marketplace. The problem is to add items, you need to go
through the admin pages. We need to be able to allow users to add items,
sort of like ebay without the auction.

-----Original Message-----
From: Richard Baskett [mailto:phpbaskettcase.com]
Sent: Friday, July 18, 2003 9:16 AM
To: PHP General
Subject: Re: [PHP] osCommerce and modifications

You might want to look at eShox, it's based on osCommerce, but in my opinion
it's quite a lot better.

Cheers!

Rick

"The intuitive mind is a sacred gift and the rational mind is a faithful
servant. We have created a society that honors the servant and has
forgotten the gift." - Albert Einstein

> From: epelokeechoman.com (Edward Peloke)
> Date: Fri, 18 Jul 2003 09:20:44 -0400
> To: "Php-GeneralLists. Php. Net" <php-generallists.php.net>
> Subject: [PHP] osCommerce and modifications
>
> Hello,
>
> I am helping a friend with an eCommerce site. We have decided to use
> osCommerce. The package looks really nice and is completely PHP. My
> question is, does anyone have much experience with modifying it? We have
to
> make some changes but all of the code looks fairly intertwined.
>
> Just looking for others who have done this and what changes you made...
>
> Thanks,
> Eddie
>
>
> --
> 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

attached mail follows:


On Friday 18 July 2003 21:20, Edward Peloke wrote:

> I am helping a friend with an eCommerce site. We have decided to use
> osCommerce. The package looks really nice and is completely PHP. My
> question is, does anyone have much experience with modifying it? We have
> to make some changes but all of the code looks fairly intertwined.
>
> Just looking for others who have done this and what changes you made...

Modifications are pretty straightforward if you're fairly experienced with
PHP. However the major drawback is that any modifications you make may need
to be redone each time you change versions (upgrade). And because there is no
plugin architecture most of the contributions (~plugins~) requires direct
modification of the OSC files and thus are mostly attached to a specific
version making upgrades very tedious.

My conclusion is that if the base system does more than 95% of what you need
then it should be a good choice.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I'm not a real movie star -- I've still got the same wife I started out
with twenty-eight years ago.
                -- Will Rogers
*/

attached mail follows:


Hi,
I have just been browsing the list and I see a recomendation for eShox
rather than OSCommerce, I did a search on google and found these 2 main
sites:
http://www.versiontracker.com/dyn/moreinfo/macos/17609
http://www.tenon.com/products/eshox/
and a lot others.

Most of the sites are selling the software, is this commercial software or
are these "companies" just swindling people?
If its the latter can you tell me where to download the free version please?
I would like to test it out being a fan of OSCommerce.

Thanks,
-Ryan

attached mail follows:


I downloaded osCommerce yesterday from sourceforge...very easy to set up and
looked really nice.

-----Original Message-----
From: Ryan A [mailto:ryanjumac.com]
Sent: Friday, July 18, 2003 9:46 AM
To: php-generallists.php.net
Subject: [PHP] eShox

Hi,
I have just been browsing the list and I see a recomendation for eShox
rather than OSCommerce, I did a search on google and found these 2 main
sites:
http://www.versiontracker.com/dyn/moreinfo/macos/17609
http://www.tenon.com/products/eshox/
and a lot others.

Most of the sites are selling the software, is this commercial software or
are these "companies" just swindling people?
If its the latter can you tell me where to download the free version please?
I would like to test it out being a fan of OSCommerce.

Thanks,
-Ryan

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

attached mail follows:


Mostly eShox you are paying for support. It's a great program and the
support is unmatchable.. whenever I had questions support would email me
back sometimes instantaneously, and other times.. within a couple of hours.
I can get you $50 off if you would like since I work with them quite a bit
for some of my clients, they give me a deal now :) Anyways I think it's a
great product with a great administration area.

You can most definitely download a free version I believe you can contact
"ben.harper" <bensecure.cc> and talk to him.

Cheers!

Rick

"Every person you meet - and everything you do in life - is an opportunity
to learn something." - Tom Clancy

> From: "Ryan A" <ryanjumac.com>
> Date: Fri, 18 Jul 2003 15:45:47 +0200
> To: <php-generallists.php.net>
> Subject: [PHP] eShox
>
> Hi,
> I have just been browsing the list and I see a recomendation for eShox
> rather than OSCommerce, I did a search on google and found these 2 main
> sites:
> http://www.versiontracker.com/dyn/moreinfo/macos/17609
> http://www.tenon.com/products/eshox/
> and a lot others.
>
> Most of the sites are selling the software, is this commercial software or
> are these "companies" just swindling people?
> If its the latter can you tell me where to download the free version please?
> I would like to test it out being a fan of OSCommerce.
>
> Thanks,
> -Ryan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


thanks Richard, I will let the guy know who I am doing this for...I really
appreciated it.

-----Original Message-----
From: Richard Baskett [mailto:phpbaskettcase.com]
Sent: Friday, July 18, 2003 9:45 AM
To: PHP General
Subject: Re: [PHP] eShox

Mostly eShox you are paying for support. It's a great program and the
support is unmatchable.. whenever I had questions support would email me
back sometimes instantaneously, and other times.. within a couple of hours.
I can get you $50 off if you would like since I work with them quite a bit
for some of my clients, they give me a deal now :) Anyways I think it's a
great product with a great administration area.

You can most definitely download a free version I believe you can contact
"ben.harper" <bensecure.cc> and talk to him.

Cheers!

Rick

"Every person you meet - and everything you do in life - is an opportunity
to learn something." - Tom Clancy

> From: "Ryan A" <ryanjumac.com>
> Date: Fri, 18 Jul 2003 15:45:47 +0200
> To: <php-generallists.php.net>
> Subject: [PHP] eShox
>
> Hi,
> I have just been browsing the list and I see a recomendation for eShox
> rather than OSCommerce, I did a search on google and found these 2 main
> sites:
> http://www.versiontracker.com/dyn/moreinfo/macos/17609
> http://www.tenon.com/products/eshox/
> and a lot others.
>
> Most of the sites are selling the software, is this commercial software or
> are these "companies" just swindling people?
> If its the latter can you tell me where to download the free version
please?
> I would like to test it out being a fan of OSCommerce.
>
> Thanks,
> -Ryan
>
>
> --
> 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

attached mail follows:


Hi

Can anybody help me grasp multidimensional arrays please? Basically, I am
retrieving all records from one table (two fields), and want to return them
in an array.

I am converting code from ASP to PHP, and in the former I did something like
this:
select id, name from customer
redim custarray(recordcount,2)
i = 0
while not eof
    custarray(i,0) = id;
    custarray(i,1) = name;
    i = i+1;
    movenext
wend

... but all my efforts to store them in the same kind of way in PHP have
proved fruitless. Any advice would be much appreciated.

Many thanks
Gary

attached mail follows:


<snip>
select id, name from customer
redim custarray(recordcount,2)
i = 0
while not eof
    custarray(i,0) = id;
    custarray(i,1) = name;
    i = i+1;
    movenext
wend
</snip>

Not sure what kind of db you are using but I put this together using
postgresql using the manual. So this is untested.

$conn = pg_connect("host=localhost dbname=whatever");
$result = pg_exec($conn, "select id, name from customer");
$i = 0;
while ($row = pg_fetch_array($result))
{
      $custarray[$i][0] = $row["id"];
      $custarray[$i][1] = $row["name"];
     $i++;
}

attached mail follows:


Hi

Many thanks for your time Matt. I tried that method amongst a few
others, and couldn't seem to get it right. What I have eventually come
across is the function 'array-push' (bizarre!) to add a new array line
for each record (after it's been initially defined). It seems to work
for me, and hopefully it is the correct, standard way to do such a task.

        $strCusts = array(array('id','name'));
/* setting up empty array for cust id and name */
        if (mysql_num_rows($resCusts) > 0) {
                $intCusts = mysql_num_rows($resCusts);
/* store the number of records retrieved */
                while ($oRsCusts = mysql_fetch_array($resCusts)) {
        
array_push($strCusts,array($oRsCusts["id"],$oRsCusts["name"])); /* add
new array row */
                }
        }

Many thanks once again.
Gary

"Matt Matijevich" <matijevichalliancetechnologies.net> wrote in message
news:<sf17b45d.017nw0102dsm.alliancetechnologies.net>...
> <snip>
> select id, name from customer
> redim custarray(recordcount,2)
> i = 0
> while not eof
> custarray(i,0) = id;
> custarray(i,1) = name;
> i = i+1;
> movenext
> wend
> </snip>
>
> Not sure what kind of db you are using but I put this together using
> postgresql using the manual. So this is untested.
>
> $conn = pg_connect("host=localhost dbname=whatever");
> $result = pg_exec($conn, "select id, name from customer");
> $i = 0;
> while ($row = pg_fetch_array($result))
> {
> $custarray[$i][0] = $row["id"];
> $custarray[$i][1] = $row["name"];
> $i++;
> }

attached mail follows:


How do I start a new browser window when using print in php?

Jeffry Lester
jeffsignalnetworking.com

attached mail follows:


Hello List,

i have a question about the require / include functions and performance.

I try to divide my application into several files (e.g. templates and common config files) and they are included with the require statement. But is this really good for the performance? With only one
user on the webserver it doesn´t look like a problem. But what about 10 or 100 at the same time? Or even more?

I made a test, i included 9 files (in different directories) with variable definitions and functions and it took 0.087 seconds. then i wrote all the content from these 9 files to only one file and it
took 0.0005 seconds to execute.

Could this be a bottle neck, when more users access the application? What do you think? Are there other ideas to scale/devide my application?

Greetings from germany

Thorsten Koch

attached mail follows:


Ok, I want to specify who the mail is coming from by using the sendmail_path
option in the PHP.ini. I've added the -fmemydomain.com to it, but I want
to be able to dynmaically change memydomain.com to youmydomain.com or
whatever else. Anyone have any ideas how I can do this? I'm pulling the
e-mail I'd like to change it to from a MySQL database but can I rewrite the
php.ini file on the fly or am I stuck. Any help is greatly appreciated.
Thanks!

Brian

attached mail follows:


> Ok, I want to specify who the mail is coming from by using the
sendmail_path
> option in the PHP.ini. I've added the -fmemydomain.com to it, but I want
> to be able to dynmaically change memydomain.com to youmydomain.com or
> whatever else. Anyone have any ideas how I can do this? I'm pulling the
> e-mail I'd like to change it to from a MySQL database but can I rewrite
the
> php.ini file on the fly or am I stuck. Any help is greatly appreciated.

Why not just put it in the extra headers?

$headers .= "From: $email_address_from_your_database\r\n";

Or you could possibly use ini_set() to change the php.ini setting.

---John Holmes...

attached mail follows:


I tried the extra header. The problem is with the return receipts. The
mail is being generated by a server other than my main e-mail server, so if
I want a delivery/read receipt I have to specify a "From" e-mail address or
else it will default to the user executing the script, i.e.
uucpmy.server.com ini_set() does not appear to work with sendmail_path.
sendmail_path is in the PHP_INI_SYSTEM group so it can only be set in the
php.ini or httpd.conf...Thanks for the suggestion though...

-----Original Message-----
From: CPT John W. Holmes [mailto:holmes072000charter.net]
Sent: Friday, July 18, 2003 11:09 AM
To: sysadminsaginawcontrol.com; php-generallists.php.net
Subject: Re: [PHP] Mail From option in PHP.ini

> Ok, I want to specify who the mail is coming from by using the
sendmail_path
> option in the PHP.ini. I've added the -fmemydomain.com to it, but I want
> to be able to dynmaically change memydomain.com to youmydomain.com or
> whatever else. Anyone have any ideas how I can do this? I'm pulling the
> e-mail I'd like to change it to from a MySQL database but can I rewrite
the
> php.ini file on the fly or am I stuck. Any help is greatly appreciated.

Why not just put it in the extra headers?

$headers .= "From: $email_address_from_your_database\r\n";

Or you could possibly use ini_set() to change the php.ini setting.

---John Holmes...

attached mail follows:


the sendmail_path in php.ini is to do with where abouts the sendmail program
is located, not where your sending mail from...

if you define the extra headers in the mail, such as FROM and REPLY-TO, you
shouldn't have any problems. basically, it's just like fake-mail, and your
recipient should be none-the-wiser unless he really wants to sift through
the headers.

----- Original Message -----
From: "Brian S. Drexler" <sysadminsaginawcontrol.com>
To: "'CPT John W. Holmes'" <holmes072000charter.net>;
<php-generallists.php.net>
Sent: Friday, July 18, 2003 4:10 PM
Subject: RE: [PHP] Mail From option in PHP.ini

> I tried the extra header. The problem is with the return receipts. The
> mail is being generated by a server other than my main e-mail server, so
if
> I want a delivery/read receipt I have to specify a "From" e-mail address
or
> else it will default to the user executing the script, i.e.
> uucpmy.server.com ini_set() does not appear to work with sendmail_path.
> sendmail_path is in the PHP_INI_SYSTEM group so it can only be set in the
> php.ini or httpd.conf...Thanks for the suggestion though...
>
> -----Original Message-----
> From: CPT John W. Holmes [mailto:holmes072000charter.net]
> Sent: Friday, July 18, 2003 11:09 AM
> To: sysadminsaginawcontrol.com; php-generallists.php.net
> Subject: Re: [PHP] Mail From option in PHP.ini
>
>
> > Ok, I want to specify who the mail is coming from by using the
> sendmail_path
> > option in the PHP.ini. I've added the -fmemydomain.com to it, but I
want
> > to be able to dynmaically change memydomain.com to youmydomain.com or
> > whatever else. Anyone have any ideas how I can do this? I'm pulling
the
> > e-mail I'd like to change it to from a MySQL database but can I rewrite
> the
> > php.ini file on the fly or am I stuck. Any help is greatly appreciated.
>
> Why not just put it in the extra headers?
>
> $headers .= "From: $email_address_from_your_database\r\n";
>
> Or you could possibly use ini_set() to change the php.ini setting.
>
> ---John Holmes...
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


... and how about this?
$headers .= "Return-Path: $email_address_from_your_database\r\n";
tell me, if it works.

ciao SVEN

Brian S. Drexler wrote:
&