php-general Digest 10 Mar 2003 07:30:17 -0000 Issue 1929

Topics (messages 138873 through 138924):

Content Management Systems
        138873 by: shaun

Re: Form input security
        138874 by: Petre Agenbag
        138876 by: John W. Holmes

php/mysql grouping output
        138875 by: Kelly Meeks
        138877 by: Jack

Help with session needed
        138878 by: Øystein Håland
        138879 by: Jack

Help me out plzzzz
        138880 by: Øystein Håland
        138923 by: Lord Loh.

Easy Way.
        138881 by: Vincent M.
        138883 by: Jason Sheets
        138884 by: Mark Heintz PHP Mailing Lists
        138885 by: Vincent M.
        138886 by: Chris Hayes

Can someone explain this?  include problem.....?
        138882 by: Beauford.2002
        138887 by: Chris Hayes
        138894 by: Beauford.2002
        138907 by: Leo Spalteholz

true, false
        138888 by: Liam Gibbs
        138889 by: Ernest E Vogelsinger

strange behaviour with login page
        138890 by: Steve  Pollard
        138891 by: Bob Irwin
        138892 by: Andre Dubuc
        138893 by: Leo Spalteholz
        138895 by: Bob Irwin

Join
        138896 by: Philip J. Newman

fgetcsv quit working......
        138897 by: CDitty
        138898 by: Jason Sheets
        138900 by: CDitty

fopen and file dump to a databace...
        138899 by: Mark Tehara
        138902 by: Jimmy Brake
        138903 by: Bob Irwin

Displaying a file
        138901 by: Todd Cary
        138904 by: Justin French
        138905 by: Mark Tehara
        138906 by: Justin French
        138909 by: Todd Cary
        138912 by: - Edwin
        138920 by: Justin French

MySQL or PHP question?
        138908 by: John Taylor-Johnston

Images out side the wwwroot
        138910 by: Philip J. Newman
        138913 by: - Edwin

auto_increment $value
        138911 by: John Taylor-Johnston
        138914 by: - Edwin
        138915 by: John Taylor-Johnston
        138917 by: John Taylor-Johnston

Re: What am i doing wrong? SQL Query in PHP
        138916 by: Rahul.Brenda

timestamp to english
        138918 by: Lord Loh.

Re: PERL/PHP, MSSQL, Unix AIX
        138919 by: Frank M. Kromann
        138921 by: Frank M. Kromann

dynamic/multidimensional arrays in classes
        138922 by: Patrick Teague
        138924 by: John W. Holmes

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 would really appreciate some advice from anyone who has worked with or
developed their own content management system.

This is my scenario, when i have finished creating a site, i want to be able
to add in the CMS with a minimum amount of fuss. I want to be able to get
the CMS to recognize all the tables and somehow allow me to set the tables
and fields that the client can update safely (i.e. if it is an employment
recruitment site then they will be able to add jobs but not job_id). This
will save me so much time rather than having to handcode the CMS for every
site.

I think i have an answer to my problem, and would be interested to hear your
opinion. When i install the CMS it will read the existing tables and create
2 new tables:

CMS_TABLES
cms_table_id(PK)
cms_table_name
cms_table_is_editable

CMS_FIELDS
cms_field_id(PK)
cms_table_id(FK)
cms_field_name
cms_field_is_editable
cms_field_type
cms_field_size
cms_field_is_primary_key

As an administrator I will be able to set fields and tables which are
editable. Now when i go to the database management page i can do 'SELECT *
FROM CMS_FIELDS WHERE cms_table_id = '$_GET[table_id]' AND
cms_field_editable = TRUE

Also does anyone have any suggestions for editing static content?

Any comments here would be greatly appreciated.

Thanks




--- End Message ---
--- Begin Message ---
It all depends on what you will do with the data... The use will dictate
the level of cleaning up.
You MUST clean it up for DB entries as you mentioned, but if you are
only going to e-mail the contents "as-is" to yourself etc, then cleaning
up the data becomes of lesser importance.

On Sun, 2003-03-09 at 21:18, Chris Cook wrote:
> Hello all,
> 
> When using forms, when do I have to worry about cleaning up user data? I 
> know to use escapeshellarg() when using system functions, but how about when 
> using the user data for database inserts? Also, if I do not insert the data 
> into the database or use any system commands, do I still need to clean the 
> data?
> 
> Thanks,
> Chris
> 
> 
> 
> 
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
> http://join.msn.com/?page=features/featuredemail
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



--- End Message ---
--- Begin Message ---
> When using forms, when do I have to worry about cleaning up user data?
I
> know to use escapeshellarg() when using system functions, but how
about
> when
> using the user data for database inserts? Also, if I do not insert the
> data
> into the database or use any system commands, do I still need to clean
the
> data?

If you're going to do anything with it, then you have to validate/clean
it. This means using it in a query, writing it to a file, displaying it
back to the user, using it in an email, etc. For you're very vague
question, I'd have to say the very vague answer is that you have to
clean EVERYTHING. 

---John W. Holmes...

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



--- End Message ---
--- Begin Message ---
I've got a multi-table query, (pulling from both an orders and an orders_products 
(line items) file), and I'd like to group the output to help reduce multiple 
appearances of of the product skus.

The query:

select 
orders.orders_id,orders.date_purchased,orders.customers_name,orders_products.products_name,orders_products.products_model,orders_products.products_quantity,
 orders_products.products_price from orders,orders_products where 
orders.date_purchased='2003-01-01' and orders.orders_id=orders_products.orders_id 
order by orders_products.products_model

You get output like 

Order Num               Order Date              Product Code            Product Name
---------------------------------------------------------------------------------------
1                       2003-01-01              12345                   product xyz
2                       2003-01-01              12345                   product xyz
3                       2003-01-01              abcde                   product abc
1                       2003-01-01              abcde                   product abc
5                       2003-01-01              12345                   product xyz

If I wanted to have the output grouped on any of the fields, how would I go about 
doing it?

TIA

Kelly


--- End Message ---
--- Begin Message ---
On Sun, 9 Mar 2003 14:56:31 -0500
Kelly Meeks <[EMAIL PROTECTED]> wrote:


> Order Num             Order Date              Product Code            Product Name
> ---------------------------------------------------------------------------------------
> 1                     2003-01-01              12345                   product xyz
> 2                     2003-01-01              12345                   product xyz
> 3                     2003-01-01              abcde                   product abc
> 1                     2003-01-01              abcde                   product abc
> 5                     2003-01-01              12345                   product xyz
> 
> If I wanted to have the output grouped on any of the fields, how would I go about 
> doing it?
> 

append to your query:
... GROUP BY tablename.column_name

--- End Message ---
--- Begin Message ---
Today I collect information from several forms and store it in a cookie:

function formCookie() {
 var cookieValue = document.$formName.totalAns.value+'|';
 cookieValue
+=document.form1.correct.value+'$test[1]'+document.form1.question1.value+doc
ument.form1.answer.value+'|';
 cookieValue
+=document.form2.correct.value+'$test[1]'+document.form2.question2.value+doc
ument.form2.answer.value+'|';

<more lines>

 document.cookie = '$ansCookie='+escape(cookieValue)+';expires=';
}

The problem is the cookie soon reaches the 4 kb limit, so I would like to
achieve the same using session. The trouble is, I don't know how to do. I
would appreciate any help that brings me closer to a solution on this.



--- End Message ---
--- Begin Message ---
On Sun, 9 Mar 2003 21:18:33 +0100
"Øystein Håland" <[EMAIL PROTECTED]> wrote:

> The problem is the cookie soon reaches the 4 kb limit, so I would like to
> achieve the same using session. The trouble is, I don't know how to do. I
> would appreciate any help that brings me closer to a solution on this.

have a look in the manual:

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

in the middle of that page are some examples, which may help you.

bye

--- End Message ---
--- Begin Message ---
Today I collect information from several forms and store it in a javascript
cookie:

function formCookie() {
 var cookieValue = document.$formName.totalAns.value+'|';

cookieValue+=document.form1.correct.value+'$test[1]'+document.form1.question
1.value+document.form1.answer.value+'|';

cookieValue+=document.form2.correct.value+'$test[1]'+document.form2.question
2.value+document.form2.answer.value+'|';

<more lines>

 document.cookie = '$ansCookie='+escape(cookieValue)+';expires=';
}

The problem is the cookie soon reaches the 4 kb limit, so I would like to
achieve the same using session. The trouble is, I don't know how to do. I
would appreciate any help that brings me closer to a solution on this.



--- End Message ---
--- Begin Message ---
You can't do it from java script...

See the php docs...there are good examples too.

Hope this helps.

Lord Loh.



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

Is there an easy way to change an integer to a 5 caracters string.
For example:
$i = 3 ;
$j = 110 ;
After having changed them:
$i = "00003" ;
$j = "00110" ;

Is there a php function to do so instead of doing this:
      if( ($i>0)&&($i<10)) {
        $i = "0000".$i ;
      } else if( ($i>9)&&($i<100)) {
        $i = "000".$i ;
      } else if( ($i>99)&&($i<1000)) {
        $i = "00".$i ;
      } etc...

Thanks :-)

Vincent.


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

Use str_pad, the manual page is available at http://www.php.net/str_pad,
a short example would be:

$i = 3;
$i = str_pad($i, 5, "0", STR_PAD_LEFT);

This function is described in the PHP manual in the string functions
section, the manual is an excellent place to go first when questions
such as this arise.

Jason
On Sun, 2003-03-09 at 14:17, Vincent M. wrote:
> Hello,
> 
> Is there an easy way to change an integer to a 5 caracters string.
> For example:
> $i = 3 ;
> $j = 110 ;
> After having changed them:
> $i = "00003" ;
> $j = "00110" ;
> 
> Is there a php function to do so instead of doing this:
>        if( ($i>0)&&($i<10)) {
>       $i = "0000".$i ;
>        } else if( ($i>9)&&($i<100)) {
>       $i = "000".$i ;
>        } else if( ($i>99)&&($i<1000)) {
>       $i = "00".$i ;
>        } etc...
> 
> Thanks :-)
> 
> Vincent.
-- 
Jason Sheets <[EMAIL PROTECTED]>

--- End Message ---
--- Begin Message ---
You're looking for the str_pad function.
http://www.php.net/str_pad

$i = 3;
$i = str_pad($i, 5, '0', STR_PAD_LEFT);
echo $i;  // outputs '00003'

Just keep in mind that it won't help you if your input is greater than 5
to begin with, you'll have to check that seperately.

$j = 123456;
$j = str_pad($j, 5, '0', STR_PAD_LEFT);
echo $j; // outputs '123456'


mh.


On Sun, 9 Mar 2003, Vincent M. wrote:

> Hello,
>
> Is there an easy way to change an integer to a 5 caracters string.
> For example:
> $i = 3 ;
> $j = 110 ;
> After having changed them:
> $i = "00003" ;
> $j = "00110" ;
>
> Is there a php function to do so instead of doing this:
>        if( ($i>0)&&($i<10)) {
>       $i = "0000".$i ;
>        } else if( ($i>9)&&($i<100)) {
>       $i = "000".$i ;
>        } else if( ($i>99)&&($i<1000)) {
>       $i = "00".$i ;
>        } etc...
>
> Thanks :-)
>
> Vincent.


--- End Message ---
--- Begin Message --- Jason Sheets wrote:
Hello,

Use str_pad, the manual page is available at http://www.php.net/str_pad,
a short example would be:

$i = 3;
$i = str_pad($i, 5, "0", STR_PAD_LEFT);

This function is described in the PHP manual in the string functions
section, the manual is an excellent place to go first when questions
such as this arise.

Yes I know, but it's not so easy to find to right function I need there are so many... ;-)


Thanks.


--- End Message ---
--- Begin Message --- At 22:23 9-3-2003, you wrote:
You're looking for the str_pad function.
http://www.php.net/str_pad

$i = 3;
$i = str_pad($i, 5, '0', STR_PAD_LEFT);
echo $i;  // outputs '00003'

Just keep in mind that it won't help you if your input is greater than 5
to begin with, you'll have to check that seperately.

You can also have a look at http://nl.php.net/manual/en/function.sprintf.php


Example 5. sprintf(): zero-padded integers
$isodate = sprintf("%04d-%02d-%02d", $year, $month, $day);


if it is only for output, have a look at http://nl.php.net/manual/en/function.printf.php



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

I have a php script which does some stuff and at the end of the file I have
it include a file which has a form in it. The problem I am having is that it
is missing code.  If you go down to the second input - it has a value="0"
field - this does not show up when I view the source from my browser. The
first input value= works fine.

Anyone have any ideas on this.....TIA

i.e.  <? php stuff;  include("theform.inc"); ?>

This is theform.inc......

<FORM ACTION="stats-write.php" action="post" name="update">
<INPUT TYPE="hidden" name="FromPosted" value="TRUE">

<TABLE ALIGN="center" WIDTH="200">

<TR><TD COLSPAN="2"><HR SIZE="3" COLOR="#63687B"></TR></TD>
</TD></TR>
<TR><TD ID=WD CLASS="main">Player:</TD>
<TD ALIGN=right ID=WD>

<input type=text name="player" SIZE="10" value="<? echo $line['player'];
?>">

</TD></TR>
<TR><TD COLSPAN="2"><HR SIZE="3" COLOR="#63687B""></TR></TD>
<TR><TD ID=WD CLASS="main">Goals:</TD>
<TD ALIGN="right" ID=WD>

<input type=text name="goals" SIZE="5" value"0">

</TD></TR>

<TR HEIGHT=5><TD ID=WD></TD>
<TR><TD COLSPAN="2"><HR SIZE="3" COLOR="#63687B"></TD></TR>
<TD ALIGN="center" colspan=2>
<input type="submit" value="Update" name="submit">
</TD></TR></TABLE>

</FORM>



--- End Message ---
--- Begin Message --- At 22:15 9-3-2003, you wrote:
Hi,

I have a php script which does some stuff and at the end of the file I have
it include a file which has a form in it. The problem I am having is that it
is missing code.  If you go down to the second input - it has a value="0"
field - this does not show up when I view the source from my browser. The
first input value= works fine.
have a closer look at it!!

compare your first line:
<INPUT TYPE="hidden" name="FromPosted" value="TRUE">
to the failing line:
<input type=text name="goals" SIZE="5" value"0">

I'm sure you can see it :)



--- End Message ---
--- Begin Message ---
Sorry, the line I was actually referring to is the one below. I forgot the
hidden one was even there and serves no purpose and does not resolve the
problem by removing it.

This works:  <input type=text name="player" SIZE="10" value="<? echo
$line['player']; ?>">
It also works if I just hardcode a value (value="Bob")

This doesn't:   <input type=text name="goals" SIZE="5" value"0">

They are both exactly the same other than the way they get their values, so
I don't see a reason why I'm losing part of the second input line. Just to
be clear, when I view the souce code I see this:

<input type=text name="goals" SIZE="5">  The value= has been stripped from
the code....

Thanks



----- Original Message -----
From: "Chris Hayes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 09, 2003 4:32 PM
Subject: Re: [PHP] Can someone explain this? include problem.....?


> At 22:15 9-3-2003, you wrote:
> >Hi,
> >
> >I have a php script which does some stuff and at the end of the file I
have
> >it include a file which has a form in it. The problem I am having is that
it
> >is missing code.  If you go down to the second input - it has a value="0"
> >field - this does not show up when I view the source from my browser. The
> >first input value= works fine.
> have a closer look at it!!
>
> compare your first line:
> ><INPUT TYPE="hidden" name="FromPosted" value="TRUE">
> to the failing line:
> ><input type=text name="goals" SIZE="5" value"0">
>
> I'm sure you can see it :)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
On March 9, 2003 04:30 pm, Beauford.2002 wrote:
> Sorry, the line I was actually referring to is the one below. I
> forgot the hidden one was even there and serves no purpose and does
> not resolve the problem by removing it.
>
> This works:  <input type=text name="player" SIZE="10" value="<?
> echo $line['player']; ?>">
> It also works if I just hardcode a value (value="Bob")
>
> This doesn't:   <input type=text name="goals" SIZE="5" value"0">
>
> They are both exactly the same other than the way they get their
> values, so I don't see a reason why I'm losing part of the second
> input line. Just to be clear, when I view the souce code I see
> this:
>
> <input type=text name="goals" SIZE="5">  The value= has been
> stripped from the code....

Look really hard at that second line..  Notice anything missing?  I 
dont know why its stripped from your browser source but theres an 
obvious mistake.

leo

--- End Message ---
--- Begin Message ---
Why is it the following code produces nothing?

$responsesubmitted = FALSE;
print($responsesubmitted);

I have an if statement that says if($responsesubmitted), but it doesn't work.

--- End Message ---
--- Begin Message ---
At 23:37 09.03.2003, Liam Gibbs said:
--------------------[snip]--------------------
>Why is it the following code produces nothing?
>
>$responsesubmitted = FALSE;
>print($responsesubmitted);
>
>I have an if statement that says if($responsesubmitted), but it doesn't work.
--------------------[snip]-------------------- 

because $responsesubmitted is false :)

A "false" value is "empty", while true is "1" in PHP-speech (contrary to
languages like C where false is defined either being "!true" or "0".

In case the execution block after your if-statement doesn't get executed
this construction works just as it should.

-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
If anyone has come across a similar problem to the one described below, and
has a solution I'd be really grateful if you can help me out.

I'm trying to implement a user authentication process where users can click
on an external link to my site. If they're not logged in they get presented
with a login dialog. Once they log in they're redirected onwards to the page
they initially wanted to visit.

The system I have in place at the moment handles authentication using
sessions. The bizarre thing is, while everything seems to work on my home pc
(windows & iis web server, php 4.2.1), on the host server (linux, apache,
php 4.1.2) I get the login screen twice before I get redirected. My hunch is
that it's something to do with when session variable become available after
registering them. (I'm using the sesssion management functions built in to
php 4).

TIA

Steve




--- End Message ---
--- Begin Message ---
I have seen this as well.  Try using netscape or an earlier version of IE
and you will probably find it will work without issue.  I posted about this
many moons ago and unfortunately didn't get a solution.  I can't recall the
specifics of when it was doing it (and if I remember correctly, sometimes it
would work and sometimes it wouldn't - in the context of a members area
where sessions are used - some pages worked, others didn't - same sessions
method), but on some servers, we had no issues (exactly the same versions of
linux, php etc) and others this happens.  There must have been some sort of
variation at our end, but we couldn't see it.

We upgraded to PHP Version 4.2.3, and this fixed it.

Sorry I can't give you any more info.  At the time I was having the problem,
I was under a tight schedule and didn't have time to track down possible
causes.  As I said, the upgrade helped us (also fixed a few mysql query
caching problems we were having too - caused a few GD ones though).  My
guess is that its some sort of cookies problem with windows IE 6 (as that
was the only browser I saw the problem on).

Best Regards
Bob Irwin
Server Admin & Web Programmer
Planet Netcom

If anyone has come across a similar problem to the one described below, and
has a solution I'd be really grateful if you can help me out.

I'm trying to implement a user authentication process where users can click
on an external link to my site. If they're not logged in they get presented
with a login dialog. Once they log in they're redirected onwards to the page
they initially wanted to visit.

The system I have in place at the moment handles authentication using
sessions. The bizarre thing is, while everything seems to work on my home pc
(windows & iis web server, php 4.2.1), on the host server (linux, apache,
php 4.1.2) I get the login screen twice before I get redirected. My hunch is
that it's something to do with when session variable become available after
registering them. (I'm using the sesssion management functions built in to
php 4).

TIA

Steve


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

Just out of curiosity, when you mention "implement a user authentication 
process where users can click on an external link to my site" are you using 
the https protocol?

I had similar bizarre behavior with IE using a "Confirmation Required' 
script. Worked great at home (localhost), with apache, linux, et al, but with 
IE sometimes it worked, most often not. 

I finally traced the route of my problem to the https protocol. I found this 
quite by mistake -- AOL, Hotmail, and Yahoo users were not being redirected 
to my site. Almost exactly the same problem occurred as you describe: if I 
clicked the link twice, it sometimes worked. (Btw, I lost a lot of 
registrants because of this problem. I finally dumped the whole thing, and 
now, users once registered, go immediately to specified areas of the site. 
Apparently, with AOL, Yahoo, Hotmail users the https protocol is 'optional' 
or 'premium' or somesuch idiocy!)

If you do find the root of your problem, would you be so kind as to drop me 
an email with your resolution -- I'd like to get my little script to work.

Hth,
Andre


On Sunday 09 March 2003 06:18 pm, you wrote:
> I have seen this as well.  Try using netscape or an earlier version of IE
> and you will probably find it will work without issue.  I posted about this
> many moons ago and unfortunately didn't get a solution.  I can't recall the
> specifics of when it was doing it (and if I remember correctly, sometimes
> it would work and sometimes it wouldn't - in the context of a members area
> where sessions are used - some pages worked, others didn't - same sessions
> method), but on some servers, we had no issues (exactly the same versions
> of linux, php etc) and others this happens.  There must have been some sort
> of variation at our end, but we couldn't see it.
>
> We upgraded to PHP Version 4.2.3, and this fixed it.
>
> Sorry I can't give you any more info.  At the time I was having the
> problem, I was under a tight schedule and didn't have time to track down
> possible causes.  As I said, the upgrade helped us (also fixed a few mysql
> query caching problems we were having too - caused a few GD ones though). 
> My guess is that its some sort of cookies problem with windows IE 6 (as
> that was the only browser I saw the problem on).
>
> Best Regards
> Bob Irwin
> Server Admin & Web Programmer
> Planet Netcom
>
> If anyone has come across a similar problem to the one described below, and
> has a solution I'd be really grateful if you can help me out.
>
> I'm trying to implement a user authentication process where users can click
> on an external link to my site. If they're not logged in they get presented
> with a login dialog. Once they log in they're redirected onwards to the
> page they initially wanted to visit.
>
> The system I have in place at the moment handles authentication using
> sessions. The bizarre thing is, while everything seems to work on my home
> pc (windows & iis web server, php 4.2.1), on the host server (linux,
> apache, php 4.1.2) I get the login screen twice before I get redirected. My
> hunch is that it's something to do with when session variable become
> available after registering them. (I'm using the sesssion management
> functions built in to php 4).
>
> TIA
>
> Steve

--- End Message ---
--- Begin Message ---
On March 9, 2003 12:49 pm, Steve Pollard wrote:
> If anyone has come across a similar problem to the one described
> below, and has a solution I'd be really grateful if you can help me
> out.
>
> I'm trying to implement a user authentication process where users
> can click on an external link to my site. If they're not logged in
> they get presented with a login dialog. Once they log in they're
> redirected onwards to the page they initially wanted to visit.
>
> The system I have in place at the moment handles authentication
> using sessions. The bizarre thing is, while everything seems to
> work on my home pc (windows & iis web server, php 4.2.1), on the
> host server (linux, apache, php 4.1.2) I get the login screen twice
> before I get redirected. My hunch is that it's something to do with
> when session variable become available after registering them. (I'm
> using the sesssion management functions built in to php 4).
>
> TIA
>
> Steve

Hm.  I had a similar problem.  In my login verification script I would 
run through a bunch of checks, verify the login/pass in the database 
and if it was correct I would start a session, register the variables 
and redirect the user.  This wouldn't work most of the time in IE.  
For some reason it always took a few tries to login.  Then I moved 
the call to session_start() to the beginning of the script and it 
worked fine.  Not sure if this applies to your problem though...

Leo


--- End Message ---
--- Begin Message ---
In my case, it was a https website.  However, in testing, it was happening
on a normal http website as well.  It was something I ruled out trying to
find the problem.

Best Regards
Bob Irwin
Server Admin & Web Programmer
Planet Netcom
----- Original Message -----
From: "Andre Dubuc" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 10:44 AM
Subject: Re: [PHP] strange behaviour with login page


> Hi Steve,
>
> Just out of curiosity, when you mention "implement a user authentication
> process where users can click on an external link to my site" are you
using
> the https protocol?
>
> I had similar bizarre behavior with IE using a "Confirmation Required'
> script. Worked great at home (localhost), with apache, linux, et al, but
with
> IE sometimes it worked, most often not.
>
> I finally traced the route of my problem to the https protocol. I found
this
> quite by mistake -- AOL, Hotmail, and Yahoo users were not being
redirected
> to my site. Almost exactly the same problem occurred as you describe: if I
> clicked the link twice, it sometimes worked. (Btw, I lost a lot of
> registrants because of this problem. I finally dumped the whole thing, and
> now, users once registered, go immediately to specified areas of the site.
> Apparently, with AOL, Yahoo, Hotmail users the https protocol is
'optional'
> or 'premium' or somesuch idiocy!)
>
> If you do find the root of your problem, would you be so kind as to drop
me
> an email with your resolution -- I'd like to get my little script to work.
>
> Hth,
> Andre
>
>
> On Sunday 09 March 2003 06:18 pm, you wrote:
> > I have seen this as well.  Try using netscape or an earlier version of
IE
> > and you will probably find it will work without issue.  I posted about
this
> > many moons ago and unfortunately didn't get a solution.  I can't recall
the
> > specifics of when it was doing it (and if I remember correctly,
sometimes
> > it would work and sometimes it wouldn't - in the context of a members
area
> > where sessions are used - some pages worked, others didn't - same
sessions
> > method), but on some servers, we had no issues (exactly the same
versions
> > of linux, php etc) and others this happens.  There must have been some
sort
> > of variation at our end, but we couldn't see it.
> >
> > We upgraded to PHP Version 4.2.3, and this fixed it.
> >
> > Sorry I can't give you any more info.  At the time I was having the
> > problem, I was under a tight schedule and didn't have time to track down
> > possible causes.  As I said, the upgrade helped us (also fixed a few
mysql
> > query caching problems we were having too - caused a few GD ones
though).
> > My guess is that its some sort of cookies problem with windows IE 6 (as
> > that was the only browser I saw the problem on).
> >
> > Best Regards
> > Bob Irwin
> > Server Admin & Web Programmer
> > Planet Netcom
> >
> > If anyone has come across a similar problem to the one described below,
and
> > has a solution I'd be really grateful if you can help me out.
> >
> > I'm trying to implement a user authentication process where users can
click
> > on an external link to my site. If they're not logged in they get
presented
> > with a login dialog. Once they log in they're redirected onwards to the
> > page they initially wanted to visit.
> >
> > The system I have in place at the moment handles authentication using
> > sessions. The bizarre thing is, while everything seems to work on my
home
> > pc (windows & iis web server, php 4.2.1), on the host server (linux,
> > apache, php 4.1.2) I get the login screen twice before I get redirected.
My
> > hunch is that it's something to do with when session variable become
> > available after registering them. (I'm using the sesssion management
> > functions built in to php 4).
> >
> > TIA
> >
> > Steve
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
>


--- End Message ---
--- Begin Message ---
------
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

------
Friends are like stars
You can't allways see them,
but they are always there.

------
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED] 


--- End Message ---
--- Begin Message --- I have a customer who's webhost upgraded their server recently and a script that was working fine quit working. The error they are getting is this "fgetcsv(): supplied argument is not a valid stream resource". I don't know what they did with Apache, but as far as I know, nothing else changed.

Can anyone offer any advice on troubleshooting this one?

Chris


--- End Message ---
--- Begin Message ---
Check to make sure the file exists, you should probably through some
debug code around the area that is failing.

Jason
On Sun, 2003-03-09 at 18:50, CDitty wrote:
> I have a customer who's webhost upgraded their server recently and a script 
> that was working fine quit working.  The error they are getting is this 
> "fgetcsv(): supplied argument is not a valid stream resource".  I don't 
> know what they did with Apache, but as far as I know, nothing else changed.
> 
> Can anyone offer any advice on troubleshooting this one?
> 
> Chris
-- 
Jason Sheets <[EMAIL PROTECTED]>

--- End Message ---
--- Begin Message --- I thought about this possibility, but it turns out 4 different scripts on the same server accessing different files from different locations and using different methods are all failing.

Chris

At 07:53 PM 3/9/2003, Jason Sheets wrote:
Check to make sure the file exists, you should probably through some
debug code around the area that is failing.

Jason
On Sun, 2003-03-09 at 18:50, CDitty wrote:
> I have a customer who's webhost upgraded their server recently and a script
> that was working fine quit working. The error they are getting is this
> "fgetcsv(): supplied argument is not a valid stream resource". I don't
> know what they did with Apache, but as far as I know, nothing else changed.
>
> Can anyone offer any advice on troubleshooting this one?
>
> Chris
--
Jason Sheets <[EMAIL PROTECTED]>


--- End Message ---
--- Begin Message ---
HI, I'm looking to take the data from a CSV file, then upload it into a
mysql databace.

I figure i will need the following.

To count the number of lines ... and cut up each line in its veriables then
entering it into the databace.

I have:

$file = fopen("pricelist-snippet.csv","r");
$buffer = fread($file,10000);
echo $buffer;

This dumps the data to the screen ...

where would i start to making cutting this data up by the line?

/ Mark



--- End Message ---
--- Begin Message ---
hi mark!

i import data all the dang time and this is what i use (more or less)

<?

$file = file("sompath/somefile.csv");


for($a=1;$a<count($file);$a++)
{
        $d = csv_parse($file[$a],",");
                $first_name = make_safe($d[0]);
                $last_name = make_safe($d[1]);
                $company_name = make_safe($d[2]);
                $address_1_1 = make_safe($d[3]);
                $address_1_2 = make_safe($d[4]);
                $city = make_safe($d[5]);
                $state = make_safe($d[6]);
                $zipcode = make_safe($d[7]);
                $country = make_safe($d[8]);
                $start_date = make_safe($d[9]);

        $query = "some insert sql";
        $db->Insert($query); // i use a class for my mysql connections
}


function csv_parse($data, $separator)
{
        $quote = '"';
        $values = array();
        $toggle = 0;
        $len = strlen($data);
        $count = 1;
        for ($i = 0; $i < $len; $i++)
        {
                $tmp = substr ($data, $i, 1);
                if (strcmp($tmp, $quote) == 0)
                {
                        $toggle = $toggle ^ 1;
                }
                $value = $value . $tmp;
                if (strcmp($tmp, $separator) == 0)
                {
                        if (! $toggle)
                        {
                                # End of word
                                $value = ereg_replace(",$", "", $value);
                                $value = ereg_replace("^\"", "",
$value);
                                $value = ereg_replace("\"$", "",
$value);
                                $value = ereg_replace("\"+", "\"",
$value);
                                $num_of_elems = count($values);
                                $values[$num_of_elems] = $value;
                                $value = "";
                        }
                }
        }
        $value = ereg_replace("^\"", "", $value);
        $value = ereg_replace("\"$", "", $value);
        $value = ereg_replace("\"+", "\"", $value);
        $num_of_elems = count($values);
        $values[$num_of_elems] = $value;
        return ($values);
}

function make_safe($text)
{
        $text = preg_replace("/(\cM)/", " ", $text);
        $text = preg_replace("/(\c])/", " ", $text);
        $text = str_replace("\r\n", " ", $text);
        $text = str_replace("\x0B", " ", $text);
        $text = str_replace('"', " ", $text);
        $text = explode("\n", $text);
        $text = implode(" ", $text);
        $text = addslashes(trim($text));
        return($text);
}



On Sun, 2003-03-09 at 18:02, Mark Tehara wrote:
> HI, I'm looking to take the data from a CSV file, then upload it into a
> mysql databace.
> 
> I figure i will need the following.
> 
> To count the number of lines ... and cut up each line in its veriables then
> entering it into the databace.
> 
> I have:
> 
> $file = fopen("pricelist-snippet.csv","r");
> $buffer = fread($file,10000);
> echo $buffer;
> 
> This dumps the data to the screen ...
> 
> where would i start to making cutting this data up by the line?
> 
> / Mark
> 
> 


--- End Message ---
--- Begin Message ---
I would use something like this (assuming you're just going to read the
entire file and bung it into the database).

Be careful reading large files in, it can fill up PHP's allocated memory
resource.  I've used this with 4 meg files though, and its worked ok.


$fp = file("yourfile.txt");
//This reads the file into an array, each element of the array is a line.
Which you can then, test,  manipulate, explode etc to put into the database.

while (list($barry, $tbone) = each($fp))
        {
        //barry is the index of the array element, $tbone is the value of
that element in the array.

        echo"Index: $barry Value: $tbone <BR>";

       //just insert into the database what you need to.

        }


Best Regards
Bob Irwin
Server Admin & Web Programmer
Planet Netcom
----- Original Message -----
From: "Mark Tehara" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 1:02 PM
Subject: [PHP] fopen and file dump to a databace...


> HI, I'm looking to take the data from a CSV file, then upload it into a
> mysql databace.
>
> I figure i will need the following.
>
> To count the number of lines ... and cut up each line in its veriables
then
> entering it into the databace.
>
> I have:
>
> $file = fopen("pricelist-snippet.csv","r");
> $buffer = fread($file,10000);
> echo $buffer;
>
> This dumps the data to the screen ...
>
> where would i start to making cutting this data up by the line?
>
> / Mark
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
>


--- End Message ---
--- Begin Message --- I want to display a file under program control in the same manner as one would with using an >a> tag e.g.

Click <a href="files/raceschedule.pdf" Name="Race Schedule" Target="_blank">here</a> to open the Race Schedule

In other words, if certain conditions are met, then I want to display the file. What is the best way to do that?

Many thanks.....

Todd
--
Ariste Software, Petaluma, CA 94952 \n [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Change your link to something like:

<a href="view.php?file=raceschedule.pdf" ...>...</a>

view.php will NOT be a "HTML page" -- it will be responsible for:

a)  some conditional stuff, like checking for a logged in user
b)  output an appropriate header for the file type
c)  pass through the actual file contents


You would actually want to store the target files outside the doc root, or
forbid apache to serve them directly over http.

There's a decent article here:
http://www.zend.com/zend/trick/tricks-august-2001.php


Justin French



on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote:

> I want to display a file under program control in the same manner as one
> would with using an >a> tag e.g.
> 
> Click <a href="files/raceschedule.pdf" Name="Race Schedule"
> Target="_blank">here</a> to open the Race Schedule
> 
> In other words, if certain conditions are met, then I want to display
> the file.  What is the best way to do that?
> 
> Many thanks.....
> 
> Todd


--- End Message ---
--- Begin Message ---
On that note, how would i load an image from outside the document root?



----- Original Message -----
From: "Justin French" <[EMAIL PROTECTED]>
To: "Todd Cary" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 4:06 PM
Subject: Re: [PHP] Displaying a file


> Change your link to something like:
>
> <a href="view.php?file=raceschedule.pdf" ...>...</a>
>
> view.php will NOT be a "HTML page" -- it will be responsible for:
>
> a)  some conditional stuff, like checking for a logged in user
> b)  output an appropriate header for the file type
> c)  pass through the actual file contents
>
>
> You would actually want to store the target files outside the doc root, or
> forbid apache to serve them directly over http.
>
> There's a decent article here:
> http://www.zend.com/zend/trick/tricks-august-2001.php
>
>
> Justin French
>
>
>
> on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote:
>
> > I want to display a file under program control in the same manner as one
> > would with using an >a> tag e.g.
> >
> > Click <a href="files/raceschedule.pdf" Name="Race Schedule"
> > Target="_blank">here</a> to open the Race Schedule
> >
> > In other words, if certain conditions are met, then I want to display
> > the file.  What is the best way to do that?
> >
> > Many thanks.....
> >
> > Todd
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
Same way

<img src='image.php?file=myimage.gif' />

image.php would do simular things to what view.php does in the script below.

Justin


on 10/03/03 2:07 PM, Mark Tehara ([EMAIL PROTECTED]) wrote:

> On that note, how would i load an image from outside the document root?
> 
> 
> 
> ----- Original Message -----
> From: "Justin French" <[EMAIL PROTECTED]>
> To: "Todd Cary" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Monday, March 10, 2003 4:06 PM
> Subject: Re: [PHP] Displaying a file
> 
> 
>> Change your link to something like:
>> 
>> <a href="view.php?file=raceschedule.pdf" ...>...</a>
>> 
>> view.php will NOT be a "HTML page" -- it will be responsible for:
>> 
>> a)  some conditional stuff, like checking for a logged in user
>> b)  output an appropriate header for the file type
>> c)  pass through the actual file contents
>> 
>> 
>> You would actually want to store the target files outside the doc root, or
>> forbid apache to serve them directly over http.
>> 
>> There's a decent article here:
>> http://www.zend.com/zend/trick/tricks-august-2001.php
>> 
>> 
>> Justin French
>> 
>> 
>> 
>> on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote:
>> 
>>> I want to display a file under program control in the same manner as one
>>> would with using an >a> tag e.g.
>>> 
>>> Click <a href="files/raceschedule.pdf" Name="Race Schedule"
>>> Target="_blank">here</a> to open the Race Schedule
>>> 
>>> In other words, if certain conditions are met, then I want to display
>>> the file.  What is the best way to do that?
>>> 
>>> Many thanks.....
>>> 
>>> Todd
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
> 
> 


--- End Message ---
--- Begin Message --- OK! This makes sense. What is the syntax to do

b)  output an appropriate header for the file type
c)  pass through the actual file contents

if I were doing an HTML file - if I were doing a PDF file?

Todd


Justin French wrote:


Same way

<img src='image.php?file=myimage.gif' />

image.php would do simular things to what view.php does in the script below.

Justin


on 10/03/03 2:07 PM, Mark Tehara ([EMAIL PROTECTED]) wrote:




On that note, how would i load an image from outside the document root?



----- Original Message -----
From: "Justin French" <[EMAIL PROTECTED]>
To: "Todd Cary" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 4:06 PM
Subject: Re: [PHP] Displaying a file




Change your link to something like:

<a href="view.php?file=raceschedule.pdf" ...>...</a>

view.php will NOT be a "HTML page" -- it will be responsible for:

a)  some conditional stuff, like checking for a logged in user
b)  output an appropriate header for the file type
c)  pass through the actual file contents


You would actually want to store the target files outside the doc root, or forbid apache to serve them directly over http.

There's a decent article here:
http://www.zend.com/zend/trick/tricks-august-2001.php


Justin French




on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote:



I want to display a file under program control in the same manner as one
would with using an >a> tag e.g.

Click <a href="files/raceschedule.pdf" Name="Race Schedule"
Target="_blank">here</a> to open the Race Schedule

In other words, if certain conditions are met, then I want to display
the file.  What is the best way to do that?

Many thanks.....

Todd


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











-- Ariste Software, Petaluma, CA 94952 \n [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Todd Cary <[EMAIL PROTECTED]> wrote:

> OK!  This makes sense.  What is the syntax to do

Hmm, did you read (and try) the article mentioned earlier?

- E

__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


--- End Message ---
--- Begin Message ---
on 10/03/03 3:40 PM, Todd Cary ([EMAIL PROTECTED]) wrote:

> OK!  This makes sense.  What is the syntax to do
> 
> b)  output an appropriate header for the file type
> c)  pass through the actual file contents
> 
> if I were doing an HTML file - if I were doing a PDF file?

*Slaps forehead loudly*

Did you read that article?  Didn't think so.

It deals with PDF, headers, and plenty of other stuff.

If you still have a question after reading the article and trying the sample
code, THEN ask away.


Justin


--- End Message ---
--- Begin Message ---
I don't know whether this is a MySQL or PHP quesiton.

$SQL = "SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;";

I would like to get the autoindex value of my table and use it in my SQL. Can I get 
the autoindex? :) How?


--- End Message ---
--- Begin Message ---
If i was to use PHP to call all my images from out side the wwwroot, dose
anyone have a method that they use?

------
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

------
Friends are like stars
You can't allways see them,
but they are always there.

------
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
"Philip J. Newman" <[EMAIL PROTECTED]> wrote:

> If i was to use PHP to call all my images from out side the 
> wwwroot, dose anyone have a method that they use?

By using an absolute path?

- E

__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


--- End Message ---
--- Begin Message ---
Anyone know how to get the auto_increment $value out of a mysql table.
I'm thinking it is in mysql_fetch_array but don't see how to get it.



> $SQL = "SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;";
>
> I would like to get the autoindex value of my table and use it in my SQL. Can I get 
> the autoindex? :) How?


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

John Taylor-Johnston <[EMAIL PROTECTED]> wrote:

> Anyone know how to get the auto_increment $value out of a mysql 
> table.
> I'm thinking it is in mysql_fetch_array but don't see how to 
> get it.

What do you exactly mean by "get the auto_increment $value"?

Perhaps, you're looking for this?

  http://www.php.net/manual/en/function.mysql-insert-id.php

- E

__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


--- End Message ---
--- Begin Message ---
 $news = mysql_query("SHOW TABLE STATUS FROM ".$db2." LIKE '$table2'");
 while ($table_status = mysql_fetch_array($news))
  {
         $autoindex = $table_status['Auto_increment'];
  }

Got it. Thanks.


--- End Message ---
--- Begin Message ---
I'll have a look at that too. Thanks!

What do you make of this: My browser is all snuffed up! It dodnint wwork aniwore!

http://ccl.flsh.usherbrooke.ca/tools/

Choose Greid. Works ok.
Choose JDaxell and the <select> stops working after 184.

Even with:

<?php
ob_start("ob_gzhandler");
?>

Too much HTML or too much in one <table>. I'll have to get my LIMIT x,y code out for 
my sql?

Internet Exploder 5.5 & NS 4.8 all jammed up.


> you can use mysql_insert_id() if you want the last value from a
> connection you still have open. Alternatively you could select
> max(whatever_colname) and use that.


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

Thanks.. i went through your reply and certainly now i
understand the mistake i was making. Quite logical
actually, that i hadn't actually selected the "title"
column. But i'm sure i wouldnt' have been able to
figure this out myself. 

And surely, i too try to stay away from Numerical
Indexes. 

Well thank you, this does enlighten quite a bit.

Rahul S. Johari

> In case you're wondering, your method is fine. You
> can continue to use
> this or what chris suggested. Either way, the
> problem is that you need
> an alias for your column that you selected. With the
> above code, you
> didn't select a column called "title" so you can't
> use $row['title'].
> You created a column called "substring_index(title,
> ' ', 3)" so you'll
> have to use $row["substring_index(title, ' ', 3)"].
> As you can probably
> guess, there's an easier way to do it, though...
> 
> If you use a query such as:
> 
> SELECT SUBSTRING_INDEX(title, ' ', 3) AS f_title
> FROM news ORDER BY id
> LIMIT 4
> 
> You can then use $row['f_title'] to print the
> result. Using "AS" in your
> query will rename the column to "f_title" or
> whatever you put there.
> This is called assigning the column an alias. 
> 
> Of course, though all of this you could of just used
> $row[0] to get the
> value. I tend to stay away from using numerical
> indexes though, as it
> makes it harder for other people to follow your
> code. When you see
> $row['f_title'], it gives you a good idea of what
> you're displaying.
> When you see $row[0], you have no idea what it is
> and you have to go
> find the query that was run in order to determine
> what column zero was. 
> 
> Hope that helps. 
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP
> Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
How do I convert the unix time stamp (the one I get by the time()) to a
readable English language time....

I am getting data from mySQL by the "now()" function....

Please Help
Thank You.

Lord Loh.



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

You can use both PERL and PHP (prefered :-)).

You need to download, compile and install FreeTDS (http://freetds.org). If
you are using PHP you need to recompile it using --with-mssql. This will
enable the mssql extension. You can then create a php script to read the
text file, parse it and create the data in a MSSQL server on a Win32 box
(PHP is running on your AIX box).

- Frank

> Hi,
> 
> I got a little project and I need to come up with a solution on how to
> finish it and was hoping if you guys can give me any ideas.
> 
> I have a PERL script on a Unix AIX machine that checks for incoming
update
> of data.  Specificly what it does is, when it runs, it will look at the
> corresponding directories in the AIX machine and record the time WHEN a
data
> has come in and check if the time is delayed or on time, kind of like
how
> the flight Arrival/departure information work in an airport.  After it
> collects this information, it will store these information in a text
file.
> 
> I need to display this information in a form of a web page so that my
> internal staff can see this information.  I usually store this kind of
> information in a MSSQL table and use PHP to general a page that collects
its
> information from the database/MSSQL table.
> 
> The way I want to do it, somehow store/update the data in the text file
of
> the AIX machine to the MSSQL table so that my php page would be able to
get
> the updated information for display. 
> 
> My problem is I haven't come up with a solution as to how I can pull
this
> text file out fo the AIX machine and transfer the data to the MSSQL
table.
> 
> Anyone have an ideas?  IS there anything in PHP I can use to do this?  
> 
> Any help is appreicated, thanks!
> 
> Kelvin
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 




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

You can use both PERL and PHP (prefered :-)).

You need to download, compile and install FreeTDS (http://freetds.org). If
you are using PHP you need to recompile it using --with-mssql. This will
enable the mssql extension. You can then create a php script to read the
text file, parse it and create the data in a MSSQL server on a Win32 box
(PHP is running on your AIX box).

- Frank

> Hi,
> 
> I got a little project and I need to come up with a solution on how to
> finish it and was hoping if you guys can give me any ideas.
> 
> I have a PERL script on a Unix AIX machine that checks for incoming
update
> of data. Specificly what it does is, when it runs, it will look at the
> corresponding directories in the AIX machine and record the time WHEN a
data
> has come in and check if the time is delayed or on time, kind of like
how
> the flight Arrival/departure information work in an airport. After it
> collects this information, it will store these information in a text
file.
> 
> I need to display this information in a form of a web page so that my
> internal staff can see this information. I usually store this kind of
> information in a MSSQL table and use PHP to general a page that collects
its
> information from the database/MSSQL table.
> 
> The way I want to do it, somehow store/update the data in the text file
of
> the AIX machine to the MSSQL table so that my php page would be able to
get
> the updated information for display. 
> 
> My problem is I haven't come up with a solution as to how I can pull
this
> text file out fo the AIX machine and transfer the data to the MSSQL
table.
> 
> Anyone have an ideas? IS there anything in PHP I can use to do this? 
> 
> Any help is appreicated, thanks!
> 
> Kelvin
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>




--- End Message ---
--- Begin Message ---
I'm having problems figuring this out.  This first way gives me a 'Fatal
Error: Cannot use [] for reading in class.php on line xx'

class myClass
{
   var $arr = array();

   function add_something( $value )
   {
      $this->$arr[] = $value;      // this is the line causing the error
   }
}

I've also tried using count() to find out how many items are in $arr, but it
keeps saying that $r == 0...  i.e.

function add_something( $value )
{
   $r = count($arr);
/*
   if( is_null( $r )
   {
      $r = 0;
   }
*/
   //print( $r );
   $this->$arr[$r] = $value;
}

I've tried this both with & without the commented section & still $r = 0
even if you use '$class->add_something("my value");' 50 times.  I'm guessing
once this problem is solved it will work for multidimensional arrays as
well?

Patrick



--- End Message ---
--- Begin Message ---
> I'm having problems figuring this out.  This first way gives me a
'Fatal
> Error: Cannot use [] for reading in class.php on line xx'
> 
> class myClass
> {
>    var $arr = array();
> 
>    function add_something( $value )
>    {
>       $this->$arr[] = $value;      // this is the line causing the
error

$this->arr[] = $value

---John W. Holmes...

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



--- End Message ---

Reply via email to