php-general Digest 21 Jan 2002 11:40:12 -0000 Issue 1124

Topics (messages 81296 through 81346):

Re: Edit program
        81296 by: B. van Ouwerkerk
        81298 by: Richard Baskett
        81299 by: bvr
        81322 by: David Robley

best way to approach dates
        81297 by: Justin French
        81300 by: Martin Towell
        81342 by: DL Neil

Re: PHP-JavaScript
        81301 by: Bruce BrackBill
        81312 by: Andrew V. Romero
        81325 by: Martin Towell
        81340 by: Tim Ward

Re: Variable referencing/substitution
        81302 by: Martin Towell

Re: Confusing Problem
        81303 by: Martin Towell

PHP/XML gap?
        81304 by: Emile Bosch

'include' & anchors
        81305 by: Phil Schwarzmann
        81306 by: Emile Bosch
        81309 by: Bogdan Stancescu

Re: Opening more than one database at a time?
        81307 by: Miles Thompson
        81310 by: Jeff Lewis

Re: While on array?
        81308 by: Bogdan Stancescu
        81339 by: Tim Ward

Re: mailing list manager
        81311 by: Emile Bosch

PHP to another language
        81313 by: Andrew V. Romero
        81316 by: Peter J. Schoenster
        81326 by: Martin Towell

Re: agh - what am I doing wrong - regular expressions
        81314 by: Martin Towell

php.ini and mail()
        81315 by: Kancha .

Cookies w/PHP as CGI Binary, possible?
        81317 by: Kurtiigeek

Give people a break!
        81318 by: Alex Dowgailenko

Re: eval()
        81319 by: Alex Dowgailenko
        81320 by: Rasmus Lerdorf
        81321 by: Alex Dowgailenko

Code logic problem pulling data from a file / for loop / by array_push
        81323 by: Larry Brown

Re: <textarea>
        81324 by: David Robley

insert & select image in mySQL
        81327 by: Rio Uniwaly
        81329 by: Alex Dowgailenko

Having a problem with sessions, Part Deux.
        81328 by: Henrik Hudson

Just something some people mind find useful
        81330 by: Alex Dowgailenko

How to resolve IP with PHP
        81331 by: Police Trainee
        81332 by: Austin Gonyou
        81333 by: gaouzief

File Uploading
        81334 by: Uma Shankari T.
        81336 by: Jason Wong
        81343 by: J.F.Kishor

Re: php login scripts
        81335 by: LaserJetter

Re: Having a problem with sessions?
        81337 by: Yasuo Ohgaki

Re: manual : Call-time pass-by-reference has been deprecated
        81338 by: Yasuo Ohgaki

Re: Printing structure and data of array
        81341 by: Tim Ward

How to call Calling Non-Existing function
        81344 by: S. Murali Krishna

recursive
        81345 by: Sandeep Murphy

Protect your code
        81346 by: Jan Grafström

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

>
>Plesae forgive me for asking and OT question.  Can you please recommend an 
>edit program, (Freely downloadable).

Search the archive.. this really is a FAQ.

Bye,



B.

--- End Message ---
--- Begin Message ---
Wait.. I thought that was a Frequently Asked Question? *grin*

Check out http://marc.theaimsgroup.com/?l=php-general and do a search for
editors and you'll find several strings regarding that topic.

Cheers!

Rick

It is very nearly impossible . . . to become an educated person in a country
so distrustful of the independent mind. - James Baldwin

> From: "B. van Ouwerkerk" <[EMAIL PROTECTED]>
> Date: Mon, 21 Jan 2002 00:33:18 +0100
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Edit program
> 
> 
>> 
>> Plesae forgive me for asking and OT question.  Can you please recommend an
>> edit program, (Freely downloadable).
> 
> Search the archive.. this really is a FAQ.
> 
> Bye,
> 
> 
> 
> B.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

--- End Message ---
--- Begin Message ---


Or go to download.com, search for 'PHP'

Sort list by 'number of downloads'.

bvr.


>>> Plesae forgive me for asking and OT question.  Can you please recommend an
>>> edit program, (Freely downloadable).



--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Mehmet Kamil Erisen) wrote in
[EMAIL PROTECTED]:">news:[EMAIL PROTECTED]: 

> 
> Dear List member,
> 
> Plesae forgive me for asking and OT question.  Can you please recommend
> an edit program, (Freely downloadable). 
> 
> Thanks,

Search your local PHP mirror for 'editor'; there is a link to a page 
listing a lot of editors for both Windows and *nix. 
--- End Message ---
--- Begin Message ---
Hi all,

I'm looking to normalise the way in which I work with dates and times,
hopefully saving myself some time and effort along the way.

Currently, for, say, a news post, i'm using a MySQL DATE column
(YYYY-MM-DD), but since this isn't all that good (visually) for use on a
site, I find myself converting it back out to something like DD-MM-YY or
DD-MM for use on the site.  Not exactly hard, but it's gotta be done
every time.

Now I find myself wanting to sort things by date (where the ID might be
in the wrong order... so 2001-12-25 is listed before 2001-12-26, etc),
and more importantly, comparing two dates (3 days away, 3 days ago, 3
hours ago, etc etc).


Would I be better off using a unix timestamp for everything, then using
it to:

- convert to different formats
- compare
- sort in date order
- etc etc


Also, I've noticed there is a timestamp column type in MySQL... is there
a way to cut down on PHP code by using MySQl alone to enter the
timestamp (or date) for me?


Any other suggestions on a sensible method of implementing dates & times
accross many sites and many bits of code?


Justin French
--- End Message ---
--- Begin Message ---
Never worked with mysql but I would assume there's something like 'NOW' or
now() or something similar, don't know how you'd put a different date in
though :(

timestamps are handy within php, you can then convert it to whatever format
you want with date()

or, if you wanted to go even further, create a date class and do all your
date manipulation using objects... I've found that easier since I've got a
class already written, but don't know where I've put it now :( so I can't
send it...

Martin

-----Original Message-----
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 10:43 AM
To: php
Subject: [PHP] best way to approach dates


Hi all,

I'm looking to normalise the way in which I work with dates and times,
hopefully saving myself some time and effort along the way.

Currently, for, say, a news post, i'm using a MySQL DATE column
(YYYY-MM-DD), but since this isn't all that good (visually) for use on a
site, I find myself converting it back out to something like DD-MM-YY or
DD-MM for use on the site.  Not exactly hard, but it's gotta be done
every time.

Now I find myself wanting to sort things by date (where the ID might be
in the wrong order... so 2001-12-25 is listed before 2001-12-26, etc),
and more importantly, comparing two dates (3 days away, 3 days ago, 3
hours ago, etc etc).


Would I be better off using a unix timestamp for everything, then using
it to:

- convert to different formats
- compare
- sort in date order
- etc etc


Also, I've noticed there is a timestamp column type in MySQL... is there
a way to cut down on PHP code by using MySQl alone to enter the
timestamp (or date) for me?


Any other suggestions on a sensible method of implementing dates & times
accross many sites and many bits of code?


Justin French

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Gidday Justin,

For us guys that don't get dates very often, the subject is one of intense 
fascination! I answered a bunch of
these questions a couple of weeks back, and reproduce that discussion below. Also some 
comments/responses to you
interspersed:-

> I'm looking to normalise the way in which I work with dates and times,
> hopefully saving myself some time and effort along the way.
>
> Currently, for, say, a news post, i'm using a MySQL DATE column
> (YYYY-MM-DD), but since this isn't all that good (visually) for use on a
> site, I find myself converting it back out to something like DD-MM-YY or
> DD-MM for use on the site.  Not exactly hard, but it's gotta be done
> every time.

=to ease the effort of repeated activities employ/implement a function (as you say, 
saves time). Fortunately PHP
and SQL/MySQL provide us with plenty, out of the box.

> Now I find myself wanting to sort things by date (where the ID might be
> in the wrong order... so 2001-12-25 is listed before 2001-12-26, etc),
> and more importantly, comparing two dates (3 days away, 3 days ago, 3
> hours ago, etc etc).

=the reason many people find ISO-format dates confusing is simply that they've grown 
up with something else
(presumably in your case dd/mm/yy). If you sit down and think about the sequence of 
data, running from the
largest unit to the smallest, consistently, you will see that it makes good sense. 
These have been adopted as
local/national standards in various places, eg the EU, but we still don't see them too 
much - guess we're still
smarting from KM vs miles and KG vs pounds-weight (I'm still paying off the bill for 
that 1KM of sausages I
ordered...)

=the reason it makes good sense in a computer is because it will fulfil basic 
functions in both use of a date:
(1) to document some date/time, and (2) to be used in basic computations. The best 
example I can think of is a
logging function, eg OpSys tools and Apache. Take a look at the native output any of 
these and you'll see ISO
dates left, right, and center. Other date formats will fulfill one or other of these 
functions, but will not
compromise between both so well.

=if you want to sort an ISO date column, go ahead and do it. ISO dates can be 
compared, just as they are:

2001-12-25 < 2001-12-26 = true
thus Christmas Day came before Boxing Day, last year (and most other years...)

=This also applies to ISO dates expressed as an integer

20011225 < 20011226 = true

=If you want to perform calculations on ISO-dates then check out the date functions 
section in the MySQL manual
for DATE_ADD, DATE_DIFF, etc. They will achieve your comparisons, adjustments by 
period of time (days), etc.

=In the same way, PHP has a rich set of date calculation functions, also well covered 
in their manual. However
these are complementary and deal in the PHP prefered date formats.

=Sadly, there is no substitute for hitting the books (see advice on this below).

> Would I be better off using a unix timestamp for everything, then using
> it to:
>
> - convert to different formats
> - compare
> - sort in date order
> - etc etc
>
> Also, I've noticed there is a timestamp column type in MySQL... is there
> a way to cut down on PHP code by using MySQl alone to enter the
> timestamp (or date) for me?

=see comments below about selecting the date format to suit the usage/purpose intended 
(if you don't want to
spend all day converting back and forth - spending time, re-making time?).

=There is no ONE right answer - that's why we've been given choices. BEWARE of the 
word "timestamp" in that a
UNIX timestamp is not the same thing as a MySQL timestamp!

> Any other suggestions on a sensible method of implementing dates & times
> accross many sites and many bits of code?

=here they come... one of your respondents talked about doing subtraction on ISO 
dates. This will not work - the
discussion (below) started off with this question "why doesn't it work?":-


RE: [PHP] counting with dates (help!)

> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y)));
> $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y)));
> echo ($today - $last_week);
> The result is a number like 8876 (20020107-20011231 = 8876)
> But in date thinking it should be 7!
No, that's the difference in time represented by the number of seconds.
You still need to work with it a little more.
8876 / 60 = number of hours  /* 60 = number of seconds in an hour */
8876 / 60 / 24 = number of days.  /* 24 = number of hours in a day */

=I'm sorry but neither the above, nor the suggestion of Julian dates was correct (in 
all cases). The two numbers
($today and $last_week) generated in the PHP code above are in CCYYMMDD format (as 
used by MySQL to store dates,
BTW).

=So you are correct (Sander):
20020107 less
20011231 equals
00008876

=but this number is meaningless. If the formulae proposed above are applied, the 
answer is not 7 days.

=Similarly (Julian dates = CCYYDDD format)
2002007 less
2001365 equals
0000642

=However let's jump forward in time, to tomorrow (hey what's 45 minutes between 
friends?):
20020108 less
20020101 equals
00000007

=and:
2002008 less
2002001 equals
0000007

=woohoo! How come they 'work' tomorrow but not today? Because (using the first format) 
whilst the last and
second to last digits represent days (hence it 'works' tomorrow), the preceding pair 
of digits represent months,
and the procession of days into months is not a decimal progression. (smack your 
forehead into the wall
now...but don't do it too often, because no matter how good it feels, it'll feel a 
whole lot better when you
stop!)

=this is also the reason that using a Julian date format won't work - they look like 
decimal numbers (look like
a duck), you can perform arithmetic on them (walk like a duck), but if your 
calculation spans a year-break you
will discover that they are not really decimal numbers (and they bark like a dog).

=The three main date formats are:

1 CCYYMMDD (as mentioned above) because it is the way MySQL does things. You can't use 
this for 'real
arithmetic' as we've just discussed, but you can do comparisons,
eg is 'today' > 'yesterday' (when I was young...)

2 dd-mmmmmm-ccyy (or variant) which is the way humans like to read their dates. This 
is for appearances, and
once again not for arithmetic/logic.
PS never, never, never (did I say "never") use dd/mm/yy or mm/dd/yy because of the 
ambiguities it causes -
particularly between Americans and the rest of the world (and date-guessing functions 
- see your manual)

3 UNIX Epoch timestamp which is a count of the number of seconds since midnight 1 Jan 
1970 (GMT). This is an
absolutely ugly way to look at dates (and times), but it is really easy to use for 
arithmetic and after a while
you don't think it at all odd that without any effort you can recall that there are 
86,400 seconds in one day.

=Now that piece of trivia, a pocket protector, and band-aid keeping your spectacle 
frames together will make you
a babe-magnet in every bar (well those that serve Heineken anyway).

=Putting aside several HOURS to study the two manuals to get your head around date 
functions is time well spent
(yes I know, it takes me a little longer...) - particularly the sheer number of SQL 
date functions (the power of
which is all too frequently overlooked). Regarding the PHP functions, I made a page 
list, and as I made notes
about each one, I annotated it with a 'purpose' so that I could keep them straight in 
my mind. Well, enough of
me and the reasons why girls in bars don't talk to me...

=Regards,
=dn



--- End Message ---
--- Begin Message ---


Hi,

A little trick I did to get the text from a textbox in a form
( for user comments ) without the user having to submit it was to
use javascript to append the textbox contents to a url ( GET METHOD )
when the user clicked on a link, which pointed to a redirect script
which extracted the textbox contents then redirected the user to the
link requested. Hopefull this will give you some ideas.

[page.html]

<script LANGUAGE="JavaScript">
<!--
function modifyurl (theurl,textvar,thepagename) {
           // do validation here on textvar, textvalue, etc. then proceed 
with:
           theurl.href="redirect_script.php?requestedpage=" + thepagename + 
"&textvalue=" + escape(textvar);
}
// -->
</script>

<form name="thetextform" onSubmit="return false;">
<input type="text" name="textvariable" size=30 maxlength=45>
</form>

<a href="/another_page.html" onClick="modifyurl(this, 
thetextform.textvariable.value, 'another_page')">


[redirect_script.php]

...and here on the redirect page I would do validation of the 
variables/form_contents etc.,
insert it into a db, and then redirect:

<?

switch ($requestedpage) {
    case "another_page":
        Header("Location: http://www.site.com/path/to/another_page.html";); 
//Redirect browser
        break;
    case ...
}

Cheers,
Bruce







_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--- End Message ---
--- Begin Message ---
Would it be possible to have javascript insert a hidden input tag in the html
and then php could pick it up?
Just an idea,
    Andy

Mëòv î‰çîÎ òsyïn wrote:

> Is it posible to get values from javascript to PHP? Without having to post
> the variables..
>
> Thanks //Mårten
>
> _________________________________________________________________
> Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se

--- End Message ---
--- Begin Message ---
the only way php is going to know about a variable is if the server the
script is on is sent the variable, the normal way of doing that is through
posting/getting a page/script

Martin

-----Original Message-----
From: Andrew V. Romero [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 2:11 PM
To: [EMAIL PROTECTED];
=?iso-8859-1?Q?M=EB=F2v=20=EE=89=E7=EE=CE=20=F2sy=EFn?[EMAIL PROTECTED]
Subject: [PHP] Re: PHP-JavaScript


Would it be possible to have javascript insert a hidden input tag in the
html
and then php could pick it up?
Just an idea,
    Andy

Mëòv î?çîÎ òsyïn wrote:

> Is it posible to get values from javascript to PHP? Without having to post
> the variables..
>
> Thanks //Mårten
>
> _________________________________________________________________
> Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Or get the JS to rewrite a query string in a link, but personally I wouldn't
rely on JS that far.

Tim
www.chessish.com <http://www.chessish.com> 

        ----------
        From:  Richard Crawford [SMTP:[EMAIL PROTECTED]]
        Sent:  20 January 2002 23:32
        To:  Mårten Andersson
        Cc:  [EMAIL PROTECTED]
        Subject:  Re: [PHP] PHP-JavaScript

        In a word... No.

        Well...

        No.


        Mårten Andersson wrote:

        > Is it posible to get values from javascript to PHP? Without having
to 
        > post the variables..
        > 
        > Thanks //Mårten
        > 
        > _________________________________________________________________
        > Chatta med vänner online, prova MSN Messenger:
http://messenger.msn.se
        > 
        > 



        -- 
        Sliante,
        Richard S. Crawford

        mailto:[EMAIL PROTECTED] 
                http://www.mossroot.com
        AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
        MSN:  [EMAIL PROTECTED]

        "It is only with the heart that we see rightly; what is essential is

        invisible to the eye."  --Antoine de Saint Exupery

        "Push the button, Max!"

        
--- End Message ---
--- Begin Message ---
${$vNames[1]} = "new value";  // look at variable-variables in the manual
for more info

-----Original Message-----
From: Gaylen Fraley [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 20, 2002 3:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Variable referencing/substitution


How can this be done?

If I have the name of a variable that is stored in an array, how do I use
the stored value to represent the actual variable?

Example:

$variable = "old value";
$vNames[1] = '$variable';  //literal $variable

I want to say $vNames[1] = "new value";  /and have $variable actually
change.

How?

--
Gaylen
[EMAIL PROTECTED]
Home http://www.gaylenandmargie.com/
PHP KISGB v3.1 Guest Book http://www.gaylenandmargie.com/phpwebsite/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
you'll need to make them global then...
that's one thing that kept getting me when I started using php, global vars
are only global if you tell them to be.... sorta like "local to the global
scope" or something like that :)

-----Original Message-----
From: Tj Corley [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 10:09 AM
To: DL Neil
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Confusing Problem


they are in the same script outside the function.

all the admin functions reside in a admin_func.php
with the $db_host, etc, etc variables assigned before it.

----- Original Message -----
From: "DL Neil" <[EMAIL PROTECTED]>
To: "Tj Corley" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 4:56 PM
Subject: Re: [PHP] Confusing Problem


> Tj,
>
>
> > I am really baffled by this problem.  I have tried so many things to get
> > this working but to no avail.  Here is the
> > actual code:
> >
> > function verify_user($username, $password){
> >  $conn = mysql_connect($db_host, $db_user, $db_pass) or
> ...
> > Anyways the problem is I cannot get it to even get to the database.  It
> > works when I try to connect in the actual code before I call this
function.
> ...
> > But when I do it that way it won't let me run a query right.  I am so
> > baffled.  Any input would be appreciated.  Thanks.
>
>
> Remember the idea of the "scope" of a variable? (if not, please RTFM)
> Where do the values of $db_host, $db_user, etc come from?
> They are not in the argument list for verify_user().
>
> Regards,
> =dn
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Why does it seem that when spoken about XML, PHP is almost always left out?
And why does it seem that every XML based CMS is build in a non-php
language? Are there any XMLCMS OpenSource Classes/Projects available?

Warm regards,

Emile Bosch



--- End Message ---
--- Begin Message ---
I want a script to go to an anchor in an html page

This doesn't seem to work....

include "blah.htm#anchor";

....how is this possible

Thanks!
Phil in baltimore

P.S. Pittsburgh sucks Bill Gates' balls.
--- End Message ---
--- Begin Message ---
eh..
if i am not mistaken, that's clientside, and
that's more of an javascript thing than a php thing


"Phil Schwarzmann" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I want a script to go to an anchor in an html page
>
> This doesn't seem to work....
>
> include "blah.htm#anchor";
>
> ....how is this possible
>
> Thanks!
> Phil in baltimore
>
> P.S. Pittsburgh sucks Bill Gates' balls.
>


--- End Message ---
--- Begin Message ---
"A script to go to an anchor" - I don't know about that... If you need a
_link_ to go to an anchor then you just need to echo the proper link
(i.e. echo "blah.htm#anchor";). If you want a script to _redirect_ to an
anchor then Emile is right: this is a client-side thing and you either
have to go with JavaScript or with a META tag. Anyway, include() is
definitely not the way to go.

Bogdan

Phil Schwarzmann wrote:

> I want a script to go to an anchor in an html page
>
> This doesn't seem to work....
>
> include "blah.htm#anchor";
>
> ....how is this possible
>
> Thanks!
> Phil in baltimore
>
> P.S. Pittsburgh sucks Bill Gates' balls.

--- End Message ---
--- Begin Message ---
Jeff,

Can you let MySQL do the work for you, with INSERT ... SELECT? Here's the URL"
http://www.mysql.com/doc/I/N/INSERT_SELECT.html

HTH - Miles Thompson


At 06:20 PM 1/20/2002 -0500, Jeff Lewis wrote:
>I am trying to basically copy data from one database to another and am
>wondering if it is possible to have more than one database open at a time.
>So for example, I want to do something like this but am wondering if there
>is a better way:
>
>$dbcon = mysql_connect($db_server, $db_user, $db_passwd);  //Make source
>connection
>mysql_select_db($db_name);
>//Select source db
>$source_result = mysql_query("SELECT * FROM users");         //Select all
>info from users table
>while ($row_cat = mysql_fetch_array($result)){
>//Loop through and insert into new db
>      //Insert into new database
>}
>
>So where I have "Insert into new database" this is where I want to take some
>of the information from the source and insert into the new database (which
>uses a different user name and password as well).
>
>Any help would be greatly appreciated :)
>
>Jeff
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Not sure, the tables are in different databases with different users and
passwords.  I will look into it but the answer I got this afternoon
satisfied me :)

Jeff
----- Original Message -----
From: "Miles Thompson" <[EMAIL PROTECTED]>
To: "Jeff Lewis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 8:51 PM
Subject: Re: [PHP] Opening more than one database at a time?


> Jeff,
>
> Can you let MySQL do the work for you, with INSERT ... SELECT? Here's the
URL"
> http://www.mysql.com/doc/I/N/INSERT_SELECT.html
>
> HTH - Miles Thompson
>
>
> At 06:20 PM 1/20/2002 -0500, Jeff Lewis wrote:
> >I am trying to basically copy data from one database to another and am
> >wondering if it is possible to have more than one database open at a
time.
> >So for example, I want to do something like this but am wondering if
there
> >is a better way:
> >
> >$dbcon = mysql_connect($db_server, $db_user, $db_passwd);  //Make source
> >connection
> >mysql_select_db($db_name);
> >//Select source db
> >$source_result = mysql_query("SELECT * FROM users");         //Select all
> >info from users table
> >while ($row_cat = mysql_fetch_array($result)){
> >//Loop through and insert into new db
> >      //Insert into new database
> >}
> >
> >So where I have "Insert into new database" this is where I want to take
some
> >of the information from the source and insert into the new database
(which
> >uses a different user name and password as well).
> >
> >Any help would be greatly appreciated :)
> >
> >Jeff
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>


--- End Message ---
--- Begin Message ---
You should probably take a look at each() for that... The functionality is not
the same but it's the only answer I can think of for your question (i.e.
mysql_fetch_row() _returns_ a key-value array while each() _walks_ a key-value
array).

Bogdan


Daniel Alsén wrote:

> Hi,
>
> i am fiddling with a script and need to change a while-loop from running on
> mysql_fetch_array to a "normal" array?
>
> ie - i have:
> while($myrow=mysql_fetch_array($result)) { etc...
>
> But i want the loop to run with an array i created earlier ($anotherarray =
> [key1] => value1, [key2] => value2).
>
> How would i do that? Does the loop behave the same way - running until the
> array is out of data?
>
> Thanks!
> # Daniel Alsén    | www.mindbash.com #
> # [EMAIL PROTECTED]  | +46 704 86 14 92 #
> # ICQ: 63006462   | +46 8 694 82 22  #
> # PGP: http://www.mindbash.com/pgp/  #
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Foreach($anotherarray as $key=>$value)

Tim
www.chessish.com <http://www.chessish.com> 


        ----------
        From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
        Sent:  20 January 2002 20:30
        To:  PHP List
        Subject:  While on array?

        Hi,

        i am fiddling with a script and need to change a while-loop from
running on
        mysql_fetch_array to a "normal" array?

        ie - i have:
        while($myrow=mysql_fetch_array($result)) { etc...

        But i want the loop to run with an array i created earlier
($anotherarray =
        [key1] => value1, [key2] => value2).

        How would i do that? Does the loop behave the same way - running
until the
        array is out of data?

        Thanks!
        # Daniel Alsén    | www.mindbash.com #
        # [EMAIL PROTECTED]  | +46 704 86 14 92 #
        # ICQ: 63006462   | +46 8 694 82 22  #
        # PGP: http://www.mindbash.com/pgp/  #
        
--- End Message ---
--- Begin Message ---
check @ www.hotscripts.com

php / scripts and programs / mailing list managers

duh :-)


"Nu Webmaster" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> i need a mailing list manager in php, with which i can send html email and
> store my subscribers in a mysql database
>
> anyone knows where i can get one?
>
> thanks, Christophe
>
>
>


--- End Message ---
--- Begin Message ---
I was wondering if there are any tools to convert PHP to another
scripting language?  I have a script that only uses pretty basic
functions in PHP (arrays, plain variables, nothing exciting- no dB
things or anything like that) and am hoping there are some tools where
you can get the majority of the code switched over to a more universal
scripting langauge?  I designed this 2000 script and then learned that
our information systems people would feel a lot more comfortable using a
language that they are already familier with.  I originally designed it
in PHP because for one it is the only scripting language that my
university will allow your typical student to write in, and two because
I wanted to learn PHP.  So in order for my place of employment to
actually use this script I made while learning PHP, they would like it
if it could be converted to another language.  I am still waiting on
what languages they would be okay with, but thought I would start to
check into the problem here first.

Thanks for any information,
    Andrew V. Romero

--- End Message ---
--- Begin Message ---
On 20 Jan 2002, at 20:15, Andrew V. Romero wrote:

> I was wondering if there are any tools to convert PHP to another
> scripting language?  

> scripting langauge?  I designed this 2000 script and then learned that
> our information systems people would feel a lot more comfortable using
> a language that they are already familier with.  I originally designed

Have they looked at what your wrote? Have they given PHP ANY 
thought and a little attention to PHP??

I've been a Perl programmer for the last 6 years. Just about a 
month ago someone asked me to do something for him in PHP. I 
gave it a shot. A couple of weeks after I took a test at a consulting 
company and I scored higher on PHP than Perl :( 

But beyond the above, I would never use Perl for cgi. I still prefer 
mod_perl for large applications but I'd certainly argue to use PHP 
for anything involving a few screen shots. 

If your technical people are worth anything they ought to look at 
PHP. Even though I did not program in PHP for those 6 years I did 
encourage a talented html guy to learn PHP and he did a site for us 
using PHP (he and the designer worked on it without my 
intervention). I guess because he never knew about cgi 
programming in Perl he did not argue for all of us to do more in 
PHP.

BTW, if anyone has used the Perl HTML::Template module and 
knows a PHP templating module that is as good or better, please 
let me know. I might have missed it but I shudder at most of the PHP 
template systems I see in comparison.

Thanks,

Peter

---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
                -- Philip K. Dick
--- End Message ---
--- Begin Message ---
*light hearted reply* blasphemy! sacrilege!! how can you ask a php mail list
about converting code to another language?? (paraphase coming...) "php is
the one true language and you shall not code any other language before it"
:)

Martin

-----Original Message-----
From: Andrew V. Romero [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 2:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP to another language


I was wondering if there are any tools to convert PHP to another
scripting language?  I have a script that only uses pretty basic
functions in PHP (arrays, plain variables, nothing exciting- no dB
things or anything like that) and am hoping there are some tools where
you can get the majority of the code switched over to a more universal
scripting langauge?  I designed this 2000 script and then learned that
our information systems people would feel a lot more comfortable using a
language that they are already familier with.  I originally designed it
in PHP because for one it is the only scripting language that my
university will allow your typical student to write in, and two because
I wanted to learn PHP.  So in order for my place of employment to
actually use this script I made while learning PHP, they would like it
if it could be converted to another language.  I am still waiting on
what languages they would be okay with, but thought I would start to
check into the problem here first.

Thanks for any information,
    Andrew V. Romero


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
try this...
I changed
  1. the double quotes in "$pattern = ..." to single quotes
  2. escaped the "?"
  3. used ereg_replace to do everything, dropping the while loop

------------------------
$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = 'http://([\/~_\.0-9A-Za-z#&=-\?]+)';

$content = ereg_replace($pattern, "<A
HREF=\"javascript:externalURL('\\1');\">\\1</A>", $content);

print $content;
------------------------

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 2:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] agh - what am I doing wrong - regular expressions


Good morning everyone,

I'm trying to adapt existing php code that uses a while loop to scan content
for a url pattern, take the matches and add link tags (<a>) around them so
the url with be made into "hot links. Simple enough right? Nevertheless, I
seem to be having trouble with urls that have question marks in them.

Here is the existing code that works - except with question marks:

********************

$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = "http://([\/~_\.0-9A-Za-z#&=-]+)";

while(ereg($pattern, $content, $match)){
        $http_old = $match[0];  
        $http = "dubdubdub" . $match[1] . $match[2];
        $url = "<A HREF=\"javascript:externalURL('$http')\";>$http</A>"; 
        $content = ereg_replace($http_old, $url, $content);     
        };

$content = ereg_replace("dubdubdub", "http://";, $content);

print $content;

******************

Here's the same code with the question mark in the pattern variable.  When I
add the question mark and test the page, my browsers just "hang". Escaping
the question mark doesn't seem to help (and I also read that escapes aren't
necessary between square brackets]:

$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = "http://([\/~_\.0-9A-Za-z#&=?-]+)";

while(ereg($pattern, $content, $match)){
        $http_old = $match[0];  
        $http = "dubdubdub" . $match[1] . $match[2];
        $url = "<A HREF=\"javascript:externalURL('$http')\";>$http</A>"; 
        $content = ereg_replace($http_old, $url, $content);     
        };

$content = ereg_replace("dubdubdub", "http://";, $content);

print $content;


*************************

In an attempt to find the problem, I did a test with the following code and
received the result I want - which leads me to believe the problem is
possibly with the while loop or the ereg_replace??

$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = "http://([/~_.0-9A-Za-z#&=?-]+)";

ereg($pattern, $content, $match);

print "<A HREF=\"javascript:externalURL('$match[0]')\";>$match[0]</A>";

******************

I'm completely confused. I have a feeling there is any easy answer and if I
wasn't so frustrated I'd be embarrassed to say that I've spent hours on
this...

Thanks in advance for your help, Shawna

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
I've installed php 4.0.6 and sendmail in two different
servers. I want to use mail() function to send mails,
but as the server with php dosen't have a smtp server
it can't be done. Is there a way to point to my other
server which has sendmail; through php.ini

kancha

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
--- End Message ---
--- Begin Message ---
I don't know if it's possible because as far as I know
headers are sent immediately upon execution when PHP is 
installed as CGI binary. But my question is, if 
possible, how can I get cookies to work when PHP has been 
installed as CGI binary. 

This does NOT work for me:
// start of code

   #!/usr/bin/php
   <?php
      setcookie ("logName","someUser",time()+3600);
   ?>

// end of code

Any ideas?
Thanks,
- Kurtii
--- End Message ---
--- Begin Message ---
Hi list...

I'm new here and was reading all these posts on RTFM.

Heres how I figure it, there are always going to be lazy people asking
advanced (or who they think may be advanced) users of PHP to write out their
code. I know, I used to be one of these people when I was trying to figure
out *giggle* mIRC script. I would go into #mirc or #mirchelp on IRC and
should the slightest problem occur, I would automatically ask someone to
figure it out for me. And there are other people who discover PHP by some
friend or something and wishes that they could learn the language in 2 hours
and become as "cool" as their friend.

Also, there are people with absolutely no prior programming experience
trying to get into PHP and reading the manual, which IMHO was written to
complement past programmers looking for a new language, can be confusing.

When I first started PHP, it was my first programming experience before mIRC
script HEH. Sad but true. And when I first read the manual, I got confused!
The terminology blew over my head and yes, I right away asked for help. And
as I asked for help, and people told me the answers I looked back at the
manual and the terminology started to make sense.

All of you have been through it at one stage in your life or another. A
newbie seeking help. So be kind, be fair, ect ect ect. This is my first and
last post that will be off topic of the mailing list. Toodles......

Alex

--- End Message ---
--- Begin Message ---
After getting very frustrated with arrays, I ended up using eval() in the
following way:

function top10() {
        $i = 0;
        $res = mysql_query("SELECT orders.pid, products.pid, orders.amount,
products.pname FROM orders, products WHERE orders.uid!='' AND
orders.pid=products.pid") or die(mysql_error());
        while (list($opid, $ppid, $amount, $pname) = mysql_fetch_row($res)) {
                $eval = '$temp["'.$pname.'"] = $temp["'.$pname.'"] + '.$amount.';';
                eval($eval);
                $i++;
        }
        arsort($temp);
        return $temp;
}

It works fine for me, though I don't really need to select orders.pid and
products.pid since they aren't used. They are there when I was debugging but
*shrug*, I'm just too lazy to remove them right now!

Alex.....

--- End Message ---
--- Begin Message ---
>       while (list($opid, $ppid, $amount, $pname) = mysql_fetch_row($res)) {
>               $eval = '$temp["'.$pname.'"] = $temp["'.$pname.'"] + '.$amount.';';
>               eval($eval);
>               $i++;

Whoa...  Why not simply:

$temp[$pname] += $amount;

??

-Rasmus

--- End Message ---
--- Begin Message ---
I tried that and strangely it didn't work and using eval() was really my
only solution :(
People told me to od $foo[$bar], $foo['$bar'], $foo["$bar"], $foo[($bar)],
and the manual doesn't seem to mind $foo[$bar], but I dunno. It just wasn't
working, and I was angry and depressed that I wasn't getting paid enough for
what I was doing so I took the easy way out. It's the only time I ever used
eval() in PHP.

> -----Original Message-----
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: January 20, 2002 11:22 PM
> To: Alex Dowgailenko
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: eval()
>
>
> >     while (list($opid, $ppid, $amount, $pname) =
> mysql_fetch_row($res)) {
> >             $eval = '$temp["'.$pname.'"] = $temp["'.$pname.'"]
> + '.$amount.';';
> >             eval($eval);
> >             $i++;
>
> Whoa...  Why not simply:
>
> $temp[$pname] += $amount;
>
> ??
>
> -Rasmus
>
>

--- End Message ---
--- Begin Message ---

If someone can help with this please examine the following problem...

----------------------------------------------------------------------------
-
$lefta = array();
$leftid = array();
$top = count($connarray); //connarray is an array of lines from a file with
repeating sections that have values in the form value=setting
for ($i=0;$i<$top;$i++)
{
        if (preg_match("/\bleft\b/", connarray[$i]))
        {
                array_push($lefta, "$connarray[$i]");
        }
        if (preg_match("/\bleftid\b/", connarray[$i]))
        {
                array_push($leftida, "$connarray[$i]");
        }
}

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

In later sequences I remove everything up to and including the "=" sign
which leaves the "setting" under a different array.  However, $lefta is not
modified itself.  After a number of cycles I found a problem.  In some cases
there is a leftid= that has a name, yet in that section there is no left=.
When this form displays the data using a for loop and populating the
variables with the $lefta and $leftida I found that when there is no left=
nothing gets added to the array.  How can I force an addition to the array
when the value is not found?  Also, this is over-simplified.  I'm only
showing two values out of the actual search having 15 possible and the
number of loops can be 5 sections (more or less) with less than or 15 lines
each.

I've been swimming around in this code for a while and I'm new to this stuff
so my apologies if I my description is hard to follow.



Larry S. Brown
President/CEO
Dimension Networks, Inc.
Member ICCA
(727) 723-8388


--- End Message ---
--- Begin Message ---
[posted and mailed]

[EMAIL PROTECTED] (Jtjohnston) wrote in 
[EMAIL PROTECTED]:">news:[EMAIL PROTECTED]:

> This is the input of a <textarea>. I don't suppose there is an easier
> way of doing this?
> 
> $mydata->KW = str_replace("\r", "", $mydata->KW);
> $mydata->KW = str_replace("\n", "<br>", $mydata->KW);
> $mydata->KW = str_replace("<br><br>", "<p>", $mydata->KW);
> 
> What does htmlspecialchars do exactly?
> Yes I've read the docs, but didn't really follow.
> 
> An email post & reply would be real helpful :)
> John
> 

Why not use nl2br() to modify the end of line characters? And there is 
probably no value, apart from saving characters in your source, to 
translate a pair of <BR> to <P>. In fact, it might have unexpected effects 
if you hapen to display the output inside of a closed <P> block. So,

$mydata->KW = nl2br($mydata->KW);

Depending on how this data is being used, you might prefer to do the 
translation before display rather than storing html in your database. For 
instance, if the data is to be edited, embedded html may be confusing, 
depending on the level of knowledge of the person editing.

In respect of htmlspecialchars, recall that symbols like < and> have 
special functions in html - they signal the start and end of html tags. So 
if you actually want to use a < or > in your text, you should use the 
special symbol &gt; (note the special use of the ampersand here!)

htmlspecialchars will perform the translations for you.

-- 
David Robley
Temporary Kiwi
--- End Message ---
--- Begin Message ---
aloo, sorry if this question was already asked before.. :-(
i'm going to insert an image from html form to the mysql
when i'm going to insert it's run good, but when i'm going to select it from mysql, 
i've got nothing..
could someone have an advice??
thank you...

Rio Uniwaly
www.prio.mysite.de
email:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Try this code. It assumes you are already connected to the database.
Usually, I put that script in something like database.inc and just do an
include.

<?php
mysql_connect ("mysql_server", "username", "password");
mysql_select_db("database_name");
$sql = mysql_query("SELECT image, type FROM table_name WHERE pid='$id'");
$file = mysql_fetch_row($sql);
header("Content-type: $file[1]");
echo $file[0];
?>

pid is the picture id. I'll assume you'll have an index or something in your
database setup.
Now, type is based on the extension of the file really. If filename.gif is
uploaded, it is assumed that the header type is image/gif.

How do you use this?

Save this little script as a seperate file. It is now the image file.
Observe:
<img src="foobar.php?id=24">

Now, assuming that the file you saved it as is foobar.php, the script will
fetch the binary data of whatever is at pid 24.





> -----Original Message-----
> From: Rio Uniwaly [mailto:[EMAIL PROTECTED]]
> Sent: January 21, 2002 12:01 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] insert & select image in mySQL
>
>
> aloo, sorry if this question was already asked before.. :-(
> i'm going to insert an image from html form to the mysql
> when i'm going to insert it's run good, but when i'm going to
> select it from mysql,
> i've got nothing..
> could someone have an advice??
> thank you...
>
> Rio Uniwaly
> www.prio.mysite.de
> email:[EMAIL PROTECTED]
>
>

--- End Message ---
--- Begin Message ---
Just FYI. I posted the forwarded question earlier, but did some more testing.

I was doing some testing tonight when server traffic was low (ie: stop / 
restart Apache) and I found out that when register_globals is On, the below 
code doesn't work. Is this something to do with the EGPCS  and how variables 
are inherited? When register_globals is off, the code works great. Could 
someone explain why that is? That'd be great :)

I would have thought that you can still access the HTTP_SESSION_VARS even if 
globals is on?

Thanks.

Henrik

On Sunday 20 January 2002 15:12, Henrik Hudson wrote:
> Hey List-
>
> Banging my head again the wall with this one. One of our developers was
> trying to get some session stuff to work and he couldn't and asked me to
> look into it.
>
> I have a script that contains the following (the sessions.php href
> reference is the same script accept it calls this one):
>
> _____________________________
> session_start();
>
> if (!isset($HTTP_SESSION_VARS[count])) {
>     $HTTP_SESSION_VARS[count] = 0;
> }
> else {
>     $HTTP_SESSION_VARS[count]++;
> }
> //Print the counter
>
> echo "Counter is now: $HTTP_SESSION_VARS[count];\n<br>\n";
> echo "Let's go to another <a href=\"sessions.php\">page</a>...<br><br>";
> _______________________________
>
> On my box at home running PHP 4.0.6 it works great.
>
> On the work server running PHP 4.0.6 it doesn't work. Just keeps setting
> count to 0.
>
> The work box is running Apache 1.3.20 with the following compile options:
>
>  './configure' '--with-apxs' '--with-config-file-path=/etc/php'
> '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2'
> '--with-pspell' '--enable-ftp' '--enable-gd' '--with-imap' '--with-mcrypt'
> '--with-mhash' '--with-mysql=/usr/local/mysql'
>
> The home box is running Apache 1.3.22 with the following compile options:
>
>  './configure' '--with-apxs' '--with-config-file-path=/etc/php'
> '--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2'
> '--with-mysql=/usr/local/mysql' '--with-mcrypt' '--with-mhash'
> '--disable-xml' '--enable-ftp' '--with-gettext' '--with-pspell'
> '--enable-inline-optimization'
>
> The only major difference that I could find in the php.ini file is that at
> home I have register globals off and at work they are on?
>
> Even with register globals on, you can still use the $HTTP_*_VARS, right?
>
> The sessionID cookie is getting put into my browser, I checked so the
> "session" is starting correctly, just not retaining the variable.
>
> Any ideas anyone?
>
>
> Thanks list.
>
> Henrik

-- 

Henrik Hudson
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
http://www.isi.edu/in-notes/iana/assignments/media-types/media-types has
been a great help for me and will probobally be a great help to a bunch of
other people designing web applications. It's a fairly long list of content
types with their RFC codes and whatnot.

Just thought I'd contribute something usefull *shrug*...

Alex...

--- End Message ---
--- Begin Message ---
Hello. Can anyone tell me how to resolve an IP into a
hostname? I've tried $REMOTE_HOST but all i get back
from it is the ip or blank. Is there another
environmental variable i need to use or do i have to
do something more complicated?

thanks sooooo much!
-mark

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
--- End Message ---
--- Begin Message ---
Did you look at the function list to see if gethostbyname() or something
similar exists?

On Mon, 2002-01-21 at 01:20, Police Trainee wrote:
> Hello. Can anyone tell me how to resolve an IP into a
> hostname? I've tried $REMOTE_HOST but all i get back
> from it is the ip or blank. Is there another
> environmental variable i need to use or do i have to
> do something more complicated?
> 
> thanks sooooo much!
> -mark
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
-- 
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-698-7250
email: [EMAIL PROTECTED]

"It is the part of a good shepherd to shear his flock, not to skin it."
Latin Proverb

Attachment: signature.asc
Description: This is a digitally signed message part

--- End Message ---
--- Begin Message ---
hi,

i think there is a function that does just that
look for gethostbyaddr($ip) in the documentation
beware of the implication on the ressources , this function performs a reverse dns 
lookup which can be time consuming

regards
21/01/2002 08:20:48, Police Trainee <[EMAIL PROTECTED]> wrote:

>Hello. Can anyone tell me how to resolve an IP into a
>hostname? I've tried $REMOTE_HOST but all i get back
>from it is the ip or blank. Is there another
>environmental variable i need to use or do i have to
>do something more complicated?
>
>thanks sooooo much!
>-mark
>
>__________________________________________________
>Do You Yahoo!?
>Send FREE video emails in Yahoo! Mail!
>http://promo.yahoo.com/videomail/
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>



--- End Message ---
--- Begin Message ---


Hello,

  How to upload files in a particular directory using php script in the
 browser itself


Regards,
Uma

--- End Message ---
--- Begin Message ---
On Monday 21 January 2002 10:34, Uma Shankari T. wrote:
> Hello,
>
>   How to upload files in a particular directory using php script in the
>  browser itself

The gory details can be found in the chapter "Handling File Uploads".

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Love is in the offing.
                -- The Homicidal Maniac
*/
--- End Message ---
--- Begin Message ---
hi,
 
        Solutions for your question is given in the PHP manual, and here's
a part from the manual.
 
Hope this would solve you problem.  
 
 Example 1. File Upload Form
 -------------------------------
 <FORM ENCTYPE="multipart/form-data" ACTION="_URL_" METHOD=POST>
 
 <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000">
 
 Send this file: <INPUT NAME="userfile" TYPE="file">
 
 <INPUT TYPE="submit" VALUE="Send File">
 </FORM>
 
 The _URL_ should point to a PHP file. The MAX_FILE_SIZE hidden field must
 precede the file input field and its value is the maximum filesize
 accepted. The value is in bytes. In this destination file, the following
 variables will be defined upon a successful upload:
 
      * $userfile - The temporary filename in which the uploaded file was
        stored on the server machine.
      * $userfile_name - The original name of the file on the sender's
        system.
      * $userfile_size - The size of the uploaded file in bytes.
      * $userfile_type - The mime type of the file if the browser provided
        this information. An example would be "image/gif".
 
 Example 2. Uploading multiple forms
 --------------------------------------
 
 <form action="file-upload.html" method="post" enctype="multipart/form-data">
   Send these files:<br>
 
   <input name="userfile[]" type="file"><br>
 
   <input name="userfile[]" type="file"><br>
 
   <input type="submit" value="Send files">
 </form>
 
   When the above form is submitted, the arrays $userfile,
   $userfile_name, and $userfile_size will be formed in the global scope
   (as well as in $HTTP_POST_VARS). Each of these will be a numerically
   indexed array of the appropriate values for the submitted files.
 
   For instance, assume that the filenames /home/test/review.html and
   /home/test/xwp.out are submitted. In this case, $userfile_name[0]
   would contain the value review.html, and $userfile_name[1] would
   contain the value xwp.out. Similarly, $userfile_size[0] would contain
   review.html's filesize, and so forth.
   
 
 cheers,
 
 kishor
 Nilgiri Networks
 
 
> On Mon, 21 Jan 2002, Uma Shankari T. wrote:
> 
> > 
> > 
> > Hello,
> > 
> >   How to upload files in a particular directory using php script in the
> >  browser itself
> > 
> > 
> > Regards,
> > Uma
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> 
> 

--- End Message ---
--- Begin Message ---
Depending on how secure the login information needs to be, you could just
store it in a text file, maybe using password() to encrypt passwords. You
could then access it using fopen() and save the contents of the file in an
array.

I'm not too hot on login and authentication though myself! I did get it
working, there was a useful example in the PHP manual.

LJ

"XX XX" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi. im new. i installed a login script on my site and after a few days, it
> stopped working. i reinstalled it and it still refused to work after a dew
> days. can anyone send me a good login script preferably with no MySql? im
> very busy atm with all my school stuff.
>
> Thanks
> aron
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.
>


--- End Message ---
--- Begin Message ---
Henrik Hudson wrote:
SNIP
> 
> _____________________________
> session_start();
> 
> if (!isset($HTTP_SESSION_VARS[count])) {
>     $HTTP_SESSION_VARS[count] = 0;
> }
> else {
>     $HTTP_SESSION_VARS[count]++;
> }
> //Print the counter
> 
> echo "Counter is now: $HTTP_SESSION_VARS[count];\n<br>\n";
> echo "Let's go to another <a href=\"sessions.php\">page</a>...<br><br>";
> _______________________________
> 
> On my box at home running PHP 4.0.6 it works great.
> 
> On the work server running PHP 4.0.6 it doesn't work. Just keeps setting 
> count to 0.
> 
SNIP

I don't see any significant options here.
What is your session save handlers?

> 
> The only major difference that I could find in the php.ini file is that at 
> home I have register globals off and at work they are on? 
> 
> Even with register globals on, you can still use the $HTTP_*_VARS, right?

Yes. It's supposed to work, but could you try without register_globals?
If it works without register_globals, submit bug report.

-- 
Yasuo Ohgaki

--- End Message ---
--- Begin Message ---
Bruce Brackbill wrote:
> 
> Hi,
> 
> If Call-time pass-by-reference has deprecated
> so long ago, why are the instructions on how
> to do it still in the manual?
> 
>http://www.php.net/manual/en/html/functions.arguments.html#functions.arguments.by-reference
> 
> 
> 
> At least it should point out that it has been
> deprecated.

Thanks for pointing it out.
I've deleted the description in CVS. Next time, please
submit bug report with type="Documentation problem" :)

-- 
Yasuo Ohgaki

--- End Message ---
--- Begin Message ---
Foreach($array as $key=>$value) ech0("$key=>$value<br>");

Tim
www.chessish.com <http://www.chessish.com> 

        ----------
        From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
        Sent:  20 January 2002 19:33
        To:  PHP List
        Subject:  Printing structure and data of array

        Hi,

        i know i have this answered before. But i can´t find that mail in
the
        archive.

        How do i print an array to see both the structure and the data
within?
        ("test" => "value", "test2" => "value2")...

        # Daniel Alsén    | www.mindbash.com #
        # [EMAIL PROTECTED]  | +46 704 86 14 92 #
        # ICQ: 63006462   | +46 8 694 82 22  #
        # PGP: http://www.mindbash.com/pgp/  #
        
--- End Message ---
--- Begin Message ---

Hi PHP Experts,

        Is there any way to call a non-existent or undeclared function
and redirect the call to someother function by knowing its non-existense.

        Is there any try() and catch() idea or any configurations,
or may be either error handler like thing.
        
for example if I call a function 'Draw_Table()' without declaring like
this

Draw_Table();

it should know the non-existense of Draw_Table() and redirect to 
'default_func'

function default_func()
{
....
}

Note:
----
Perl      programmers please recollect 'AUTOLOAD' Method of a package.
C++,Java  programmers please recollect exception handling.


Thanks in Advance.

S.Murali Krishna
[EMAIL PROTECTED]  
===================================== 
We grow slow trying to be great
                                                                
                   - E. Stanley Jones
-------------------------------------

--- End Message ---
--- Begin Message ---
hi,

I hv an XML tree with some elements which keep repeating.. As of now, I am
able to print only the last element..
I need to make the loop recursive in order to print all the elements..

wud appreciate any help..

TIA,
sands

like this:
<app_info>
                <app_id>001</app_id>
                <app_name>WORD</app_name>
                <app_info>
                        <app_id>002</app_id>
                        <app_name>excel</app_name>
                </app_info>
                <app_info>
                        <app_id>003</app_id>
                        <app_name>PPt</app_name>
                </app_info>
        </app_info>
        <app_info>
                <app_id>004</app_id>
                <app_name>ZIP</app_name>
        </app_info>
--- End Message ---
--- Begin Message ---
Hi!
Using the method to build a html-page from png s you can in a way make it
inconviniant for the user
to reuse the html-code.
The problem is that the textquality is not very good and my host doesn´t
have support for gif with fontfiles.

I wonder if there is any other way to put text on your page, something like:
$string = include ("textmaker.php3?text=testword");

I am trying to build blanks for use as a memberservice and want it difficult
to reuse my code.
Any tips?

Thanks in advance

Regards,
Jan
---------
filename=index.php
<?
$head = "<img
src=\"imgtext.php3?text=testtext&left=340&c3=0&textsize=5&imheight=20\"
width=750 height=20><br>";
echo $head;
?>
-----------
filename=imgtext.php3
<?php
$im = @ImageCreate (750, $imheight)
    or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, $c3);
ImageString ($im, $textsize, $left, 5,  $text, $black);
ImagePng ($im);
?>

--
Jan Grafström
Lillemans Hus AB

Bredsäter 2091
87010 Älandsbro
0611-60920
070-6409073

--- End Message ---

Reply via email to