php-general Digest 22 Feb 2004 02:47:25 -0000 Issue 2604

Topics (messages 178442 through 178467):

Help with SQLite and ADOdb
        178442 by: user.domain.invalid

How can I use a value from a Html's Form
        178443 by: qm.fuwanjia.com.cn
        178446 by: John Nichel
        178447 by: qm.fuwanjia.com.cn
        178467 by: John Romero

Safe Mode
        178444 by: php4.nv.jakaranda.co.za
        178451 by: Lucas Gonze
        178462 by: user.domain.invalid
        178463 by: Lucas Gonze
        178466 by: Marek Kilimajer

Re: PHP class for XSL transformations?
        178445 by: memoimyself.yahoo.com.br

Re: Slight cleaning of code needed in str_replace command.
        178448 by: Dave G
        178449 by: Jason Wong

Re: Simple example of expiring download pages?
        178450 by: Jason Wong

tow dimenshional arrays
        178452 by: joe-at
        178455 by: Manuel Vázquez Acosta
        178461 by: adwinwijaya
        178464 by: Manuel Vázquez Acosta

Re: HTML email problem: IMAP
        178453 by: Ryan A

Re: delete a function
        178454 by: Adam Bregenzer

HELP!!!
        178456 by: Will

PHP Error
        178457 by: Tim Trimble

set global working??
        178458 by: Terry Romine
        178459 by: electroteque

using xp home
        178460 by: danny cobbinah
        178465 by: Gerard Samuel

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message --- I'm working on a website whose hosting package doesn't include any db (except maybe gdbm).

I've install sqlite in the home directory.
The question is what adjustment do I have to make to my PHP script and ADOdb
in order for it to exicute SQLite in from the account home direcory?

TIA,
Davd

--- End Message ---
--- Begin Message ---
hi,all!

if anyone can tell me how can i use a value from Html Form! I know, it is use like as 
"<%=Request.Form("item_name")%>" in a ASP's script. What i can do in a PHP script for 
a same function?

Thanks!

Mr.Zhaori

--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] wrote:

hi,all!

if anyone can tell me how can i use a value from Html Form! I know, it is use like as "<%=Request.Form("item_name")%>" in a ASP's script. What i can do in a PHP script for a same function?

Thanks!

Mr.Zhaori

The manual is your friend...


http://www.php.net/manual/en/language.variables.external.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--- End Message ---
--- Begin Message ---
The manual is your friend...

http://www.php.net/manual/en/language.variables.external.php

-- 
By-Tor.com
It's all about the Rush
http://www.by-tor.com

=================
It is work now. Thank you very much!

Mr.Zhaori


--- End Message ---
--- Begin Message ---
You can use the

$myvalue = $_REQUEST['htmlvariable'];

 to grab the variable you want.

-johnr
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hi,all!
>
> if anyone can tell me how can i use a value from Html Form! I know, it is
use like as "<%=Request.Form("item_name")%>" in a ASP's script. What i can
do in a PHP script for a same function?
>
> Thanks!
>
> Mr.Zhaori

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

I'm running PHP4.3 with Apache 1.3.26 on Linux with a number of vittual domains.

Safe_mode is set by default for obvious reasons.

I wan't to install "gallery"
http://gallery.menalto.com/modules.php?op=modload&name=News&file=index

It requires to be run without safe_mode.

Is it possible to set Apache in such a way that everyting is run under safe-mode, 
except for a directory and everything underneath in a virtual domain?

Thanks

Nico

--- End Message ---
--- Begin Message --- On Saturday, Feb 21, 2004, at 09:18 America/New_York, [EMAIL PROTECTED] wrote:
Is it possible to set Apache in such a way that everyting is run under safe-mode, except for a directory and everything underneath in a virtual domain?

Very likely yes, if your admin permits it. The place to look for an answer is in documentation for httpd.conf.


Good luck.

- Lucas
--- End Message ---
--- Begin Message --- Lucas Gonze wrote:
On Saturday, Feb 21, 2004, at 09:18 America/New_York, [EMAIL PROTECTED] wrote:

Is it possible to set Apache in such a way that everyting is run under safe-mode, except for a directory and everything underneath in a virtual domain?


Very likely yes, if your admin permits it. The place to look for an answer is in documentation for httpd.conf.

Good luck.

- Lucas
Can safe mode be turned off in the .htaccess file?
--- End Message ---
--- Begin Message ---
On Saturday, Feb 21, 2004, at 20:17 America/New_York, [EMAIL PROTECTED] wrote:


Lucas Gonze wrote:
On Saturday, Feb 21, 2004, at 09:18 America/New_York, [EMAIL PROTECTED] wrote:
Is it possible to set Apache in such a way that everyting is run under safe-mode, except for a directory and everything underneath in a virtual domain?
Very likely yes, if your admin permits it. The place to look for an answer is in documentation for httpd.conf.
Good luck.
- Lucas
Can safe mode be turned off in the .htaccess file?

My guess is no. That is a decision which should belong to the server admin.

--- End Message ---
--- Begin Message --- Lucas Gonze wrote:

On Saturday, Feb 21, 2004, at 20:17 America/New_York, [EMAIL PROTECTED] wrote:


Lucas Gonze wrote:

On Saturday, Feb 21, 2004, at 09:18 America/New_York, [EMAIL PROTECTED] wrote:

Is it possible to set Apache in such a way that everyting is run under safe-mode, except for a directory and everything underneath in a virtual domain?

Very likely yes, if your admin permits it. The place to look for an answer is in documentation for httpd.conf.
Good luck.
- Lucas

Can safe mode be turned off in the .htaccess file?


My guess is no. That is a decision which should belong to the server admin.


Definately no. It would not be safe mode if anyone can turn it off.


I don't know the gallery script but setting safe_mode_include_dir should help. Ask the admin to set it to your directory for your virtual host. Another option would be to use ftp functions to upload the images to your directory, but you would have to rewrite the script.
--- End Message ---
--- Begin Message ---
On 20 Feb 2004 at 16:25, Juan Torres wrote:

> you try with XMLDOM Functions. You look this function:
> DomXsltStylesheet->process --  Applies the XSLT-Transformation on a
> DomDocument Object

Thanks Juan, but I'm actually looking for a class that I can upload to a site rather 
than 
an extension that has to be compiled into PHP. The reason is that some of the hosts on 
which I need to run my code do not have either the XSLT or the DOM XML extensions.

--- End Message ---
--- Begin Message ---
> Well, you asked for it. The usage of str_replace() is not 
> exactly rocket 
> science, since the output is not what you expected just 
> juggle your search & 
> replacement strings until it does what you want.

It's not as if I haven't experimented with different settings, but they
haven't been successful.
In any case, rocket science or not, I was actually looking for advice
that might help me understand the logic behind the command better. I
can't see anything syntactically wrong with the string I have put
forward, so my current assumption is that there is something I don't
understand about how the string input going into the command is parsed
(it comes from a MySQL query), or about how the command interprets line
breaks.

Perhaps someone could offer something a little more concrete than
essentially recommending I just 'try different stuff'.

-- 
Yoroshiku!
Dave G
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Sunday 22 February 2004 00:23, Dave G wrote:

> It's not as if I haven't experimented with different settings, but they
> haven't been successful.

By "settings" one usually means something which alters behaviour, as such 
str_replace() does not have any "settings".

> In any case, rocket science or not, I was actually looking for advice
> that might help me understand the logic behind the command better.

It simply does a straight replacement: replace A with B in string C

> I can't see anything syntactically wrong with the string I have put
> forward, so my current assumption is that there is something I don't
> understand about how the string input going into the command is parsed
> (it comes from a MySQL query), or about how the command interprets line
> breaks.

var_dump() every variable of importance and check that they are what you 
expect them to be. You might want to wrap the output in some <pre> tags so 
the browser doesn't eat up your "\n"'s.

> Perhaps someone could offer something a little more concrete than
> essentially recommending I just 'try different stuff'.

Anything more concrete would probably mean writing the code for you, that 
would be too easy (for you!).

Here's another tip: start with a small test string (forget about grabbing 
stuff from the db), do a simple replacement, check your results, make the 
string more complex, repeat.

-- 
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
------------------------------------------
/*
"It takes all sorts of in & out-door schooling to get adapted
to my kind of fooling"
- R. Frost
*/

--- End Message ---
--- Begin Message ---
On Saturday 21 February 2004 21:41, Brian Dunning wrote:
> Hi, I'm building a very simple online store and I need expiring
> download pages for people to download the items they purchased.
> Surprisingly, I couldn't find an example of this code online.
>
> I know how to do it in Lasso, and it's quite easy. You just search the
> database against download attempts or expiration time/date, and if it
> succeeds, return this (it's Lasso code but you get the idea):

[snip]

> Can anyone suggest the PHP code for this?

Loads of examples in the archives, search for "download file" or similar.

-- 
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
------------------------------------------
/*
Those who can, do; those who can't, simulate.
*/

--- End Message ---
--- Begin Message ---
Hallo,
1) I want to work with the rows und columns of a tow dimensional
array[i][j]. With array[i] I get the i'th row. But how can I get the j'th
column?
2) Is there any command to transpose a two dimensional array?
Thanks for help

--- End Message ---
--- Begin Message ---
As far as I know, there is no such a function. Maybe you should use a
different approach.

Manu.


"Joe-At" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hallo,
> 1) I want to work with the rows und columns of a tow dimensional
> array[i][j]. With array[i] I get the i'th row. But how can I get the j'th
> column?
> 2) Is there any command to transpose a two dimensional array?
> Thanks for help

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

Sunday, February 22, 2004, 5:47:02 AM, you wrote:

MVA> As far as I know, there is no such a function. Maybe you should use a
MVA> different approach.
MVA> Manu.

MVA> "Joe-At" <[EMAIL PROTECTED]> wrote in message
MVA> news:[EMAIL PROTECTED]
>> Hallo,
>> 1) I want to work with the rows und columns of a tow dimensional
>> array[i][j]. With array[i] I get the i'th row. But how can I get the j'th
>> column?
>> 2) Is there any command to transpose a two dimensional array?
>> Thanks for help


1. $array_j = $array[$i] ;
   count($array_j) ;

2.
foreach($array as $sub_array){
   foreach($subarray as $key=>$value)
                     echo $key.'=='.$value ;
}


cmiiw

-- 
Best regards,
 adwinwijaya                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Namaste Adwinwijaya:

I meant there's no PHP function neither to get a column nor to transpose the
matrix.

The first answer you gave us, retrieves the amount of items in the column,
not the column itself as an array. And the second one, just prints the
matrix, but does not transpose it.

Joe-At: I suggest you to tell us your exact problem, maybe there's a way to
solve it avoiding matrices, maybe there's a more suitable representation to
the problem's parameters.

Manu.

PS:

This function retrives the j column, assuming that the matrix has no
non-numerical indeces:

function getColumn($arr, $j)
{
    if (isset($arr[$j]) && count($arr[$j])>0)
    {
        $result = array();
        foreach($arr[$j] as $which)
            $result[] = $which;                // You could make reference
instead
    }
}

function getTranspose($arr)
{
    if (count($arr)>0)
    {
        $result = array();
        for($i=0; $i<count($arr); $i++)
            for($j=0; $j<count($arr[$i]); $j++)
            {
                if (!isset($result[$j]))
                    $result[$j] = array();

                $result[$j][$i] = $arr[$i][$j];
            }
    }
}

Keep in mind this are inefficient functions.

Manu.


"Adwinwijaya" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Manuel,
>
> Sunday, February 22, 2004, 5:47:02 AM, you wrote:
>
> MVA> As far as I know, there is no such a function. Maybe you should use a
> MVA> different approach.
> MVA> Manu.
>
> MVA> "Joe-At" <[EMAIL PROTECTED]> wrote in message
> MVA> news:[EMAIL PROTECTED]
> >> Hallo,
> >> 1) I want to work with the rows und columns of a tow dimensional
> >> array[i][j]. With array[i] I get the i'th row. But how can I get the
j'th
> >> column?
> >> 2) Is there any command to transpose a two dimensional array?
> >> Thanks for help
>
>
> 1. $array_j = $array[$i] ;
>    count($array_j) ;
>
> 2.
> foreach($array as $sub_array){
>    foreach($subarray as $key=>$value)
>                      echo $key.'=='.$value ;
> }
>
>
> cmiiw
>
> -- 
> Best regards,
>  adwinwijaya                            mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hey,
Thanks, even that htmlmail example was a bit too much for my needs but in 10
mins I cut it down to the simple stuff
I wanted to do (just send a html message with a text part...).
I really didnt need the attachment part/s and cut that out. There are still
2 parts I really dont understand even though
I know how to use them :-)...but that class is really good and it shows how
much interest and time you put into it, only
thing I think is missing is a kind of readme file which contains
documentation explaining each of the functions and the
parameters they "take".

But no complaints from me...coz its working  great!

Cheers,
-Ryan

> Hello,
>
> On 02/21/2004 01:39 AM, Ryan A wrote:
> > I downloaded a class from php classes called "clssendmail", the class
was
> > working on a different server
> > but now I get this error when I try to use it:
> > "Call to undefined function: imap_8bit() in............."
> >
> > The class is basically to send an email in 2 parts, plain text and
HTML...if
> > the person has html off or cannot view html email then the plain text
one
> > will display else the HTML part will display.
> >
> > After googleing I see that sometimes PHP is not compiled with Imap_8bit
> > which causes this problem...:-(
>
> Yes, IMAP extension is optional but fortunately it is not necessary for
> what you want.
>
> Just try this other class that comes with an example to do exactly what
> you want. Check the HTML message example as it explains how to compose
> and send a message with an HTML part and an alternative text part. It
> may also embed any images or attachment files if you want:
>
> http://www.phpclasses.org/mimemessage
>
> -- 
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
>
>

--- End Message ---
--- Begin Message ---
On Sat, 2004-02-21 at 06:02, Sztankó Demeter wrote:
> Hello!
> 
> Is there any way to delete (unset) a function?

No, why would you really want to delete a function?

> I want to write some function with one constantyl defined name, then call a
> function_manager function, that will gice this function an unique name, than
> delete the original function, so I can start the process from the beginning.
> 
> I will call this function through a wrapper, which will find the function I
> need.

I'm not completely sure what your intended use of the process you
described is, but it sounds to me like you are trying to implement the
factory pattern[1].  I would recommend looking into using classes in PHP
and giving it a shot.

http://www.phppatterns.com/index.php/article/articleview/49/1/1/

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

--- End Message ---
--- Begin Message --- Hello All,
I am trying to do a modify script. The problem is I can get only one thig to work, it is either the tables modified or the photos uploaded not both here is my code:


HTML FORM:
<p><b>Image File Name:</b><br>
<input type="text" name="female_image" value="<?echo $female_image;?>" size="30" maxlenght="200"></p>
<p><b>Image Thumbnail File Name:</b><br>
<input type="text" name="female_image_thumb" value="<?echo $female_image_thumb;?>" size="30" maxlenght="200"></p>
<p><b>Image File:</b><br>
<input type="file" name="application" size="20" maxlenght="200"></p>
<p><strong>Image Thumbnail File Name:</strong><br>
<input type="file" name="application1" size="20" maxlenght="200"></p>
<p><input type="submit" name="submit" value="Modify This Female Reptile"></p>
NOTE: This is only the last part of the form.


AND THE PHP SCRIPT:
?>
$sql = "UPDATE $table_name9 SET
     female_latin = '$_POST[female_latin]',
     female_born_date = '$_POST[female_born_date]',
         female_date = '$_POST[female_date]',
     female_where_purchased = '$_POST[female_where_purchased]',
     female_cost = '$_POST[female_cost]',
     female_size = '$_POST[female_size]',
     female_weight = '$_POST[female_weight]',
     female_humidity_level = '$_POST[female_humidity_level]',
     female_notes = '$_POST[female_notes]',
     female_image = '$_POST[female_image]',
     female_image_thumb = '$_POST[female_image_thumb]'
     WHERE female_id = '$_POST[female_id]'";

$result = @mysql_query($sql,$conn) or die(mysql_error());


if ($_FILES[application] != "") { header ("Location: main.php"); exit;

} else {
@copy($_FILES[application][tmp_name], "$path" .$_FILES[application][name])
or die( "Sorry Could not copy file!!" );


@copy($_FILES[application1][tmp_name], "$path1" .$_FILES[application1][name])
or die( "Could not copy file!!" );


header("Location: main.php");
exit;
}
?>
NOTE This is the whole script minus the setup file.

Thanks in advance,
~WILL~

--- End Message ---
--- Begin Message ---
May be the cause is, that you've specified some include file with
include('somefile');

but the file doesn't exist in /usr/share/php dir, which is the default path
for include (.inc) files to be saved.

OK, I see your point.  The problem is I don't know what file/ directory it's
looking for, so I don't know where to look for it.  Like I said this a
generic install, I didn't make any changes.

--- End Message ---
--- Begin Message --- Not quite a mystery, but I wondered if anyone could throw a couple of suggestions my way.

My client's websites were moved last year from an old php server to a newer one. At that time, I had to upgrade all her scripts because set_globals were off on the new server, and so I went to using $_SESSION variables. All seemed to be doing fine until sometime last week when the scripts on a new website I am working on, being hosted on her server, started flaking out. Variables were becoming persistent, retaining previous values and refusing to change.

I checked the php settings and found that the version running on the sever is 4.1.2 with globals on. That surprised me. I don't have admin access and would be cautious about trying to change this and possibly messing up someone else's site.

Anyway, to test my theory, I created a simple script that turns session_start on and off. If session_start is off, variables work fine. With session_start on, variable will change once, and then refuse to change. I've attached the script.

Does this indeed mean that I have to go through all my scripts and comment out session_start and convert my $_SESSION defines back?? Yeachh!!

Terry

<?
        if($pers)
                session_start();
        // check for persistance
        if(!$ag) $ag=8; // set as default
        switch($ag){
                case "8": $office="Modesto"; break;
                case "7": $office="Livermore";break;
                case "9": $office="Fremont"; break;
                case "10": $office="San Lorenzo"; break;
                case "28": $office="Berkeley"; break;
                case "25": $office="Mountain View"; break;
        }
        if($switch) $pers=(!$pers);             // switch persistence on/off
?>

<div align="center"><font size="5" color="#00015d" face="Verdana"><b><?=$office?></b></font></div></td>
<br />
<a href="check.php?ag=<?=$ag?>&pers=<?=$pers?>&switch=1">Switch Persistence <?=$pers?></a>
<br />
<a href="check.php?ag=7&pers=<?=$pers?>">Livermore</a>
<a href="check.php?ag=8&pers=<?=$pers?>">Modesto</a>
<a href="check.php?ag=9&pers=<?=$pers?>">Fremont</a>
<a href="check.php?ag=10&pers=<?=$pers?>">San Lorenzo</a>
<a href="check.php?ag=28&pers=<?=$pers?>">Berkeley</a>
<br />

--- End Message ---
--- Begin Message ---
you can turn register globals off using htaccess, i dont have an example for
you but that should fix it.

-----Original Message-----
From: Terry Romine [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 22, 2004 10:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP] set global working??


Not quite a mystery, but I wondered if anyone could throw a couple of
suggestions my way.

My client's websites were moved last year from an old php server to a
newer one. At that time, I had to upgrade all her scripts because
set_globals were off on the new server, and so I went to using
$_SESSION variables. All seemed to be doing fine until sometime last
week when the scripts on a new website I am working on, being hosted on
her server, started flaking out. Variables were becoming persistent,
retaining previous values and refusing to change.

I checked the php settings and found that the version running on the
sever is 4.1.2 with globals on. That surprised me. I don't have admin
access and would be cautious about trying to change this and possibly
messing up someone else's site.

Anyway, to test my theory, I created a simple script that turns
session_start on and off. If session_start is off, variables work fine.
With session_start on, variable will change once, and then refuse to
change. I've attached the script.

Does this indeed mean that I have to go through all my scripts and
comment out session_start and convert my $_SESSION defines back??
Yeachh!!

Terry

<?
        if($pers)
                session_start();
        // check for persistance
        if(!$ag) $ag=8; // set as default
        switch($ag){
                case "8": $office="Modesto"; break;
                case "7": $office="Livermore";break;
                case "9": $office="Fremont"; break;
                case "10": $office="San Lorenzo"; break;
                case "28": $office="Berkeley"; break;
                case "25": $office="Mountain View"; break;
        }
        if($switch) $pers=(!$pers);             // switch persistence on/off
?>

                <div align="center"><font size="5" color="#00015d"
face="Verdana"><b><?=$office?></b></font></div></td>
                <br />
                <a href="check.php?ag=<?=$ag?>&pers=<?=$pers?>&switch=1">Switch
Persistence <?=$pers?></a>
                <br />
                <a href="check.php?ag=7&pers=<?=$pers?>">Livermore</a>
                <a href="check.php?ag=8&pers=<?=$pers?>">Modesto</a>
                <a href="check.php?ag=9&pers=<?=$pers?>">Fremont</a>
                <a href="check.php?ag=10&pers=<?=$pers?>">San Lorenzo</a>
                <a href="check.php?ag=28&pers=<?=$pers?>">Berkeley</a>
<br />


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

--- End Message ---
--- Begin Message ---
is it better to use apache 1.3.29 or apache 2.0.48?

i am having the worst trouble ever trying to get this thing to work

--- End Message ---
--- Begin Message ---
Cant say for XP home, but on XP Pro, I've run both without any problems.
Just follow the instructions at the php manual...

On Saturday 21 February 2004 07:11 pm, danny cobbinah wrote:
> is it better to use apache 1.3.29 or apache 2.0.48?
>
> i am having the worst trouble ever trying to get this thing to work

--- End Message ---

Reply via email to