php-general Digest 16 Jan 2003 14:08:49 -0000 Issue 1826

Topics (messages 131798 through 131857):

Re: Session Problem
        131798 by: Matt

Get the date of the last sunday
        131799 by: Renaldo De Silva
        131800 by: Daniel Kushner
        131804 by: Gladky Anton

MySQL Query - Not PHP Specific
        131801 by: Sean Malloy
        131802 by: Daniel Kushner
        131803 by: Sean Malloy

Re: Security in included PHP files
        131805 by: John W. Holmes
        131807 by: John W. Holmes
        131818 by: Jacob Copsey

Re: File() function and require()
        131806 by: John W. Holmes
        131854 by: Mike Tharp

Re: OOP
        131808 by: John W. Holmes

Re: Calendar problem
        131809 by: John W. Holmes

Problems with require() and variables
        131810 by: Phil Powell
        131837 by: Ford, Mike               [LSS]

Images : Store in dB or disk?
        131811 by: Bobby Patel
        131813 by: rw.xend.net
        131814 by: Bobby Patel
        131823 by: Jason Wong
        131841 by: Marek Kilimajer

emacs and php markup
        131812 by: Larry Brown

temporary DNS lookup in php?
        131815 by: Patrick Hsieh
        131842 by: Marek Kilimajer

Re: PHP/Flash Dynamic Graphs?
        131816 by: SED

execute shell commands
        131817 by: Mantas Kriauciunas
        131845 by: Marek Kilimajer

Re: Sessions 'funny' and Zone Alarm Pro 3
        131819 by: Neil Stirton

Php's future with Asp .NET?
        131820 by: Dhaval Desai
        131821 by: hitek
        131822 by: rw.xend.net
        131832 by: Brian McGarvie
        131836 by: Sean Malloy
        131846 by: Sancar Saran
        131849 by: John W. Holmes
        131856 by: Maxim Maletsky

Re: All Request to the same script
        131824 by: SLanger.spirit21.de

Re: Windows vs Linux
        131825 by: Jason Wong

intermittent session loss
        131826 by: Justin French

Re: Question about $_GET
        131827 by: Frank Keessen

Re: HTTP_REFERER work without a problem....
        131828 by: Jason Wong

Re: I wanta the PHP doc notes.
        131829 by: Jason Wong

Re: Session wierdness...
        131830 by: Jason Wong

Why oh Why????
        131831 by: WMB
        131843 by: Jason Wong

Random Row...
        131833 by: Brian McGarvie
        131835 by: Danny Shepherd

GD version 1.6.2 and resizing images...
        131834 by: Marco Alting
        131839 by: Jason Wong

Re: Getting a dynamic IP address
        131838 by: Marek Kilimajer
        131848 by: Chris Hayes

Re: [phplib template] file does not exist
        131840 by: Marek Kilimajer

Re: Free web-hosting
        131844 by: David T-G

Speed concerns with OOP and PHP4
        131847 by: John Wells
        131851 by: Maxim Maletsky

Re: "document contained no data"
        131850 by: Marek Kilimajer

MIME email...
        131852 by: Brian McGarvie

Problem with a for loop...
        131853 by: Davíð Örn Jóhannsson
        131855 by: John W. Holmes
        131857 by: Davíð Örn Jóhannsson

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 ---
>----- Original Message ----- 
>From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: [PHP] Session Problem


> Can some one pl  explain what this means ...
> Warning: Cannot send session cache limiter - headers already sent 
> (output started at /Users/pgarcha/Sites/edit.php:7) in 
> /Users/pgarcha/Sites/edit.php on line 8

Take a look here for an explanation: http://www.php-faq.com/#3

--- End Message ---
--- Begin Message ---
how can i easily get the date of the last sunday. php or javascript code to
do this would be appreciated.


--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.strtotime.php
strtotime ("last Sunday");


Regards,
Daniel Kushner
_________________________________________
Need hosting? http://thehostingcompany.us 


-----Original Message-----
From: Renaldo De Silva [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 10:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Get the date of the last sunday


how can i easily get the date of the last sunday. php or javascript code to
do this would be appreciated.



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


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

RDS> how can i easily get the date of the last sunday. php or javascript code to
RDS> do this would be appreciated.


<?php
$d=time();
while (date("w",$d)!="0") $d-=86400;
print "Last Sunday was ".date ("M/d/Y",$d);
?>


Gladky Anton



                       mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I know this isn't a PHP question per se, but it does relate to PHP
development.

Every day I work with MySQL as my PHP database, I become more dissalusioned
with its ability as a database server. Yes its fast, but its missing so many
useful features of other DB servers. I'm digressing...


Is there a functional equivelent of SQL Servers ISNULL() command? (Yes I am
aware of the MySQL ISNULL command and it is different)

Hrm.. I just found a solution...

SQL Server ISNULL takes two arguments, CheckField, And ReplacementValue
SELECT ISNULL(t.Task, 0) FROM Users u LEFT JOIN Tasks t ON t.UserID =
u.UserID;

instead of returning <NULL> where a Userid has no tasks, it would return 0.

The equivelent function in MySQL is COALESCE(Field, <ReplaceValue>)

I'm not sure it was meant for that usage, but it does work none the less.

--- End Message ---
--- Begin Message ---
http://www.mysql.com/documentation/mysql/bychapter/manual_Tutorial.html#Work
ing_with_NULL
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Con
trol_flow_functions




Regards,
Daniel Kushner
_________________________________________
Need hosting? http://thehostingcompany.us


-----Original Message-----
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 9:37 PM
To: PHP General
Subject: [PHP] MySQL Query - Not PHP Specific


I know this isn't a PHP question per se, but it does relate to PHP
development.

Every day I work with MySQL as my PHP database, I become more dissalusioned
with its ability as a database server. Yes its fast, but its missing so many
useful features of other DB servers. I'm digressing...


Is there a functional equivelent of SQL Servers ISNULL() command? (Yes I am
aware of the MySQL ISNULL command and it is different)

Hrm.. I just found a solution...

SQL Server ISNULL takes two arguments, CheckField, And ReplacementValue
SELECT ISNULL(t.Task, 0) FROM Users u LEFT JOIN Tasks t ON t.UserID =
u.UserID;

instead of returning <NULL> where a Userid has no tasks, it would return 0.

The equivelent function in MySQL is COALESCE(Field, <ReplaceValue>)

I'm not sure it was meant for that usage, but it does work none the less.


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


--- End Message ---
--- Begin Message ---
IFNULL! thanks

-----Original Message-----
From: Daniel Kushner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 1:51 PM
To: Sean Malloy; PHP General
Subject: RE: [PHP] MySQL Query - Not PHP Specific


http://www.mysql.com/documentation/mysql/bychapter/manual_Tutorial.html#Work
ing_with_NULL
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Con
trol_flow_functions




Regards,
Daniel Kushner
_________________________________________
Need hosting? http://thehostingcompany.us


-----Original Message-----
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 9:37 PM
To: PHP General
Subject: [PHP] MySQL Query - Not PHP Specific


I know this isn't a PHP question per se, but it does relate to PHP
development.

Every day I work with MySQL as my PHP database, I become more dissalusioned
with its ability as a database server. Yes its fast, but its missing so many
useful features of other DB servers. I'm digressing...


Is there a functional equivelent of SQL Servers ISNULL() command? (Yes I am
aware of the MySQL ISNULL command and it is different)

Hrm.. I just found a solution...

SQL Server ISNULL takes two arguments, CheckField, And ReplacementValue
SELECT ISNULL(t.Task, 0) FROM Users u LEFT JOIN Tasks t ON t.UserID =
u.UserID;

instead of returning <NULL> where a Userid has no tasks, it would return 0.

The equivelent function in MySQL is COALESCE(Field, <ReplaceValue>)

I'm not sure it was meant for that usage, but it does work none the less.


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


--- End Message ---
--- Begin Message ---
You already have your solution in your original question, then. If you
don't want to use any of these other techniques, then name your files
with a .php extension (I use .inc.php) and enclose everything in classes
or function. If you're just aware that your included files can be run
out of context, and program accordingly, your scripts will be just fine.


An include file full of functions or classes will not "run" anything
when called, it'll simply load it into memory. 

---John W. Holmes...

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

> -----Original Message-----
> From: Jacob Copsey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 15, 2003 3:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Security in included PHP files
> 
> I agree these are good solutions and I have considered them. However,
I am
> looking for an all-inclusive solution that is code only within PHP
that
> allows the admin of the application to copy the files to their server
and
> not need to do any server specific configuration. That is why I don't
name
> the included files with .inc. It would require configuration of the
server
> to prevent downloading of those files and I don't want to require that
> step
> of people who choose to run the app on their server.
> 
> Thanks for the input!
> 
> Jacob
> 
> "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > --- Jacob Copsey <[EMAIL PROTECTED]> wrote:
> > > My style of PHP is to name all included files with a .php
> > > extension and of course this raises the problem of people
> > > accessing these script files directly.
> >
> > I always name included files *.inc myself, but that's a
> > personal preference combined with a strong desire to adhere
> > to strict naming conventions.
> >
> > It is very easy to make sure people cannot access your
> > include files directly. There are two common ways to do
> > this, and I will mention my preference first.
> >
> > 1. Do not store your include files under document root.
> > This is a very simple and straightforward approach that
> > negates all of the types of questions you were asking.
> >
> > 2. Deny access to any file with an extension of inc. Of
> > course, you would have to conform to a naming standard a
> > bit more for this to work. A quick Google search revealed
> > this example for Apache:
> >
> > <Files ~ "\.inc$">
> >     Order Allow, Deny
> >     Deny from all
> > </Files>
> >
> > Chris
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
> I am beginning work on a new web-based application using PHP and
MySQL. I
> have been doing a lot of reading about PHP security and web
application
> security in general to make sure I am up-to-date on what is known in
this
> area.
> 
> My style of PHP is to name all included files with a .php extension
and of
> course this raises the problem of people accessing these script files
> directly. My main question is if all of the code inside an included
PHP
> file
> is put inside one or more functions this should prevent anyone from
> running
> any of that code by directly calling that PHP file correct? There is
no
> way
> for them to invoke a function just from a URL assuming I have no code
at
> all
> outside the functions.

No, the user can't run anything; it'll simply load the code into memory.

 
> And this leads to another question... if I encapsulate most of my
> variables
> inside one or more classes doesn't this help protect against attacks
also?
> Is there a way for someone to set a class variable to a value just
from a
> GET or POST request (or even file or cookie)? As long as I am
carefully
> validating what information I put into the object variable this seems
to
> be
> a way of adding another layer of protection.

No, the user can't set a class variable directly, but if you are doing
something like $this->var = $_GET['something'], then it's unsecure
unless you are validating $_GET['something'] first. 

---John W. Holmes...

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


--- End Message ---
--- Begin Message ---
Great!

I was just looking for confirmation that my assumptions in my original post
were correct. I have been using PHP for quite some time but have never read
a specific article about possible attacks that allow modification of values
in a class object or execution of functions in a PHP script. It is rarely
safe to assume things when it comes to security so I figured I would ask.

Thanks again for responding.

--Jacob


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
003801c2bd13$01fc85b0$7c02a8c0@coconut">news:003801c2bd13$01fc85b0$7c02a8c0@coconut...
> You already have your solution in your original question, then. If you
> don't want to use any of these other techniques, then name your files
> with a .php extension (I use .inc.php) and enclose everything in classes
> or function. If you're just aware that your included files can be run
> out of context, and program accordingly, your scripts will be just fine.
>
>
> An include file full of functions or classes will not "run" anything
> when called, it'll simply load it into memory.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
> > -----Original Message-----
> > From: Jacob Copsey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 15, 2003 3:53 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Security in included PHP files
> >
> > I agree these are good solutions and I have considered them. However,
> I am
> > looking for an all-inclusive solution that is code only within PHP
> that
> > allows the admin of the application to copy the files to their server
> and
> > not need to do any server specific configuration. That is why I don't
> name
> > the included files with .inc. It would require configuration of the
> server
> > to prevent downloading of those files and I don't want to require that
> > step
> > of people who choose to run the app on their server.
> >
> > Thanks for the input!
> >
> > Jacob
> >
> > "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > --- Jacob Copsey <[EMAIL PROTECTED]> wrote:
> > > > My style of PHP is to name all included files with a .php
> > > > extension and of course this raises the problem of people
> > > > accessing these script files directly.
> > >
> > > I always name included files *.inc myself, but that's a
> > > personal preference combined with a strong desire to adhere
> > > to strict naming conventions.
> > >
> > > It is very easy to make sure people cannot access your
> > > include files directly. There are two common ways to do
> > > this, and I will mention my preference first.
> > >
> > > 1. Do not store your include files under document root.
> > > This is a very simple and straightforward approach that
> > > negates all of the types of questions you were asking.
> > >
> > > 2. Deny access to any file with an extension of inc. Of
> > > course, you would have to conform to a naming standard a
> > > bit more for this to work. A quick Google search revealed
> > > this example for Apache:
> > >
> > > <Files ~ "\.inc$">
> > >     Order Allow, Deny
> > >     Deny from all
> > > </Files>
> > >
> > > Chris
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


--- End Message ---
--- Begin Message ---
> How can I get the file() function to ignore the first three lines of a
> file it is reading in?
> 
> I have a site with:
> 
> <?PHP
>         require("membercheck.php");
> ?>
> ... rest of file
> 
> 
> 
> at the top of all the pages to control user logins. The problem is the
> file() function only reads in the contents of that file, not the rest
of
> the contents after the require statement.
> 
> Is there a way to tell file() to ignore the first three lines?

I don't understand what you're asking... it's not making sense. The
file() function takes the path to a file and reads it into an array,
each element of the array being a line in the file. It could care less
if the first three lines were PHP code. It simply reads text and does
not evaluate anything (unless you are opening the file with a HTTP
connection, i.e. file('http://www...'))

Can you show your exact code and what the output is?

---John W. Holmes...

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


--- End Message ---
--- Begin Message ---
OK, I have a file called page.php that has the following code in it 
(example but same layout and concept).


<?PHP
        require("membercheck.php");
?>
<html>
<head>
        <title>Page Title</title>
</head>
<body>
        This is the text in the body of the page.
</body>
</html>

The membercheck.php file contains a login form that is used if a session 
variable doesn't exist, i.e. the user is not logged in. What happens is 
when I run file() to read in the contents of page.php it reads in the code 
that is in the membercheck.php file, and never reads in any code that is 
in the page.php file. What I would need is a way to read in the contents 
of the page.php file without reading the membercheck.php file.

Better explanation?

 
Mike Tharp
Lotus Notes Administrator
Herman Miller Inc.
[EMAIL PROTECTED] 
--- End Message ---
--- Begin Message ---
> > I'd recommend you make a separate database class and error class
that
> each
> > of your other classes access. That would make it the most modular
and
> > re-usable.
> >
> > ---John Holmes...
> 
> I was hoping someone would say that :)
> How could I code that though. I've only just started with OOP and
don't
> understand how I can inherit methods to classes? Is it a good idea to
> create
> a new object within each class which, for example, needs to do
database
> stuff
> or should I inherit the methods?

Inheriting would probably be the most modular. 
 
> I haven't found any clear examples of this kind of OOP, only the real
> basics
> (which I still need help with by the way :) ).

Use google. Do some more studying before you try to tackle this, or look
on phpclasses.org for some examples. 

---John W. Holmes...

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


--- End Message ---
--- Begin Message ---
> I have two fields in my form. When two dates are entered in these two
> boxes, I need to find the diiference in calendar months and remaining
days
> between these two dates. This "Calendar months and remaining days" is
> important. The functions that I know do not work for calendar months.
> Can anyone help me and tell me how this could be achieved and are
there
> any PHP functions to do this?

You can use strtotime() (probably) to convert what's entered into a unix
timestamp. From there you know how many seconds are in a day, so a
little math can figure out how many days are between the two dates. You
can use date() to find out the month of each one and do some more
math...

---John W. Holmes...

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


--- End Message ---
--- Begin Message ---
Consider this:

I have display.php, a script that will do XML parsing into an array and display its 
contents.

I have view.php, a script that will include display.php and have to manipulate the 
variables within display.php for itself.

So in view.php I have:

require('/.../.../display.php');

However, when display.php finishes being "required", I lose all of my variables that I 
need for view.php.  How do I retain them?? How can I ensure that these variables in 
display.php will also exist in view.php?

Thanx
Phil
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Phil Powell [mailto:[EMAIL PROTECTED]]
> Sent: 16 January 2003 04:33
> 
> I have view.php, a script that will include display.php and 
> have to manipulate the variables within display.php for itself.
> 
> So in view.php I have:
> 
> require('/.../.../display.php');
> 
> However, when display.php finishes being "required", I lose 
> all of my variables that I need for view.php.  How do I 
> retain them??

You don't need to -- the included file is effectively part of the including file, so 
all variables available in one are equally available in the other.

>  How can I ensure that these variables in 
> display.php will also exist in view.php?

By doing nothing.  You must be doing something else wrong.  Show us your code (or a 
relevant sample, if it's big!).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
Hello,
I have the Images table setup with columns (width, height, size, type,
etc...) the question is should I have the image data stored in this table or
disk?

I know, alot of people have said it is faster in disk, which is 1 page I/O.
But I need these images for displaying product pages, and I believe that it
would be faster to just pluck the properties from the dB (including the
image file) .

Usually I will need to pull 6 or 10 images per page, this is my rational for
this situation:

If all stored on db:
One query  - will take about 4-5 page I/O (assumiing index on filename)

If just properties stored on dB and image on disk:
One query to grab the rows of properties - 2-3 page I/O
to grab 6 or 10 images - 6 or 10 page I/O
Total - 8 - 13 Page I/O's

If all images stored on disk, no dB whatso ever:
to grab 6 or 10 images - 6 or 10 page I/O
cpu time to run getimagesize()  for each image - CPU time unknown?

I assume that "page I/O" is that same as "disk access".

I AGREE that storing images strored on disk is a valid approach PROVIDED
that you only need 1 image per page, but if you need to grab a bunch at a
time, I do beleieve that storing the actual file on the dB is faster.

I would like to hear from the list, of people that have worked with images
and PHP. I just started with images, so I just want to take the right path.


--- End Message ---
--- Begin Message ---
Have a look at:

http://vrscenes.com/2003/gallery.php?mls=230944

and tell me what you think - all images are stored in the filesystem

Don't worry about what it looks like - I extracted this from the frameset it goes in

Cheers!

RW

Quoting Bobby Patel <[EMAIL PROTECTED]>:

### Hello,
### I have the Images table setup with columns (width, height, size, type,
### etc...) the question is should I have the image data stored in this table
### or
### disk?
### 
### I know, alot of people have said it is faster in disk, which is 1 page
### I/O.
### But I need these images for displaying product pages, and I believe that
### it
### would be faster to just pluck the properties from the dB (including the
### image file) .
### 
### Usually I will need to pull 6 or 10 images per page, this is my rational
### for
### this situation:
### 
### If all stored on db:
### One query  - will take about 4-5 page I/O (assumiing index on filename)
### 
### If just properties stored on dB and image on disk:
### One query to grab the rows of properties - 2-3 page I/O
### to grab 6 or 10 images - 6 or 10 page I/O
### Total - 8 - 13 Page I/O's
### 
### If all images stored on disk, no dB whatso ever:
### to grab 6 or 10 images - 6 or 10 page I/O
### cpu time to run getimagesize()  for each image - CPU time unknown?
### 
### I assume that "page I/O" is that same as "disk access".
### 
### I AGREE that storing images strored on disk is a valid approach PROVIDED
### that you only need 1 image per page, but if you need to grab a bunch at a
### time, I do beleieve that storing the actual file on the dB is faster.
### 
### I would like to hear from the list, of people that have worked with
### images
### and PHP. I just started with images, so I just want to take the right
### path.
### 
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 



--- End Message ---
--- Begin Message ---
It looks nice. It does take a couple of seconds, (but I guess that is to be
expected with dealing with images).
I guess seeing your example, it seems that I can go with the filesystem. But
do you use the getimagezise function? do you set the width and height for
the IMG tag dynamically, or you don't use the image function and just have
the IMG tags already set in stone?

<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Have a look at:
>
> http://vrscenes.com/2003/gallery.php?mls=230944
>
> and tell me what you think - all images are stored in the filesystem
>
> Don't worry about what it looks like - I extracted this from the frameset
it goes in
>
> Cheers!
>
> RW
>
> Quoting Bobby Patel <[EMAIL PROTECTED]>:
>
> ### Hello,
> ### I have the Images table setup with columns (width, height, size, type,
> ### etc...) the question is should I have the image data stored in this
table
> ### or
> ### disk?
> ###
> ### I know, alot of people have said it is faster in disk, which is 1 page
> ### I/O.
> ### But I need these images for displaying product pages, and I believe
that
> ### it
> ### would be faster to just pluck the properties from the dB (including
the
> ### image file) .
> ###
> ### Usually I will need to pull 6 or 10 images per page, this is my
rational
> ### for
> ### this situation:
> ###
> ### If all stored on db:
> ### One query  - will take about 4-5 page I/O (assumiing index on
filename)
> ###
> ### If just properties stored on dB and image on disk:
> ### One query to grab the rows of properties - 2-3 page I/O
> ### to grab 6 or 10 images - 6 or 10 page I/O
> ### Total - 8 - 13 Page I/O's
> ###
> ### If all images stored on disk, no dB whatso ever:
> ### to grab 6 or 10 images - 6 or 10 page I/O
> ### cpu time to run getimagesize()  for each image - CPU time unknown?
> ###
> ### I assume that "page I/O" is that same as "disk access".
> ###
> ### I AGREE that storing images strored on disk is a valid approach
PROVIDED
> ### that you only need 1 image per page, but if you need to grab a bunch
at a
> ### time, I do beleieve that storing the actual file on the dB is faster.
> ###
> ### I would like to hear from the list, of people that have worked with
> ### images
> ### and PHP. I just started with images, so I just want to take the right
> ### path.
> ###
> ###
> ###
> ### --
> ### PHP General Mailing List (http://www.php.net/)
> ### To unsubscribe, visit: http://www.php.net/unsub.php
> ###
> ###
>
>
>


--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 13:23, Bobby Patel wrote:

> I AGREE that storing images strored on disk is a valid approach PROVIDED
> that you only need 1 image per page, but if you need to grab a bunch at a
> time, I do beleieve that storing the actual file on the dB is faster.
>
> I would like to hear from the list, of people that have worked with images
> and PHP. I just started with images, so I just want to take the right path.

I would say develop your application so that it both stores the images in the 
DB _and_ copies it to the filesystem -- it should only require a few more 
lines of code. Then have a flag at runtime which decides whether to retrieve 
images from DB or from filesystem. Once you have enough data you can easily 
determine which method is faster and subsequently comment/remove the 
insertion code for the slower method.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Be sure to evaluate the bird-hand/bush ratio.
*/

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

Bobby Patel wrote:

Hello,
I have the Images table setup with columns (width, height, size, type,
etc...) the question is should I have the image data stored in this table or
disk?

I know, alot of people have said it is faster in disk, which is 1 page I/O.
But I need these images for displaying product pages, and I believe that it
would be faster to just pluck the properties from the dB (including the
image file) .

Usually I will need to pull 6 or 10 images per page, this is my rational for
this situation:

If all stored on db:
One query  - will take about 4-5 page I/O (assumiing index on filename)

images will be requested separate, so there will be query to get the properties (page request), and queries to get the actual image data (requests for images).


If just properties stored on dB and image on disk:
One query to grab the rows of properties - 2-3 page I/O
to grab 6 or 10 images - 6 or 10 page I/O
Total - 8 - 13 Page I/O's

If all images stored on disk, no dB whatso ever:
to grab 6 or 10 images - 6 or 10 page I/O
cpu time to run getimagesize() for each image - CPU time unknown?

I assume that "page I/O" is that same as "disk access".

I AGREE that storing images strored on disk is a valid approach PROVIDED
that you only need 1 image per page, but if you need to grab a bunch at a
time, I do beleieve that storing the actual file on the dB is faster.

I would like to hear from the list, of people that have worked with images
and PHP. I just started with images, so I just want to take the right path.





--- End Message ---
--- Begin Message ---
Does anyone out there use emacs and are proficient in customizing it?  I
love the highlighting it does while working on .php files.  However, I
usually use different extensions on my files than .php so is there a way to
tell emacs to treat certain extensions as php?  This would help out
immensely!

TIA

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388



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

I am trying to open a remote webpage in my php program with curl library. The 
webpage will redirect me to another webpage(Say, 
"http://www.anothersite.com/index.html";). Basically, the curl library will 
resolve the domain name via the DNS servers defined in the system, however, I 
hope I can customized the temporary DNS lookup in the php program for special 
purpose without modifying the /etc/resolv.conf or other system configuration 
files. Is it possible? How?


-- 
Patrick Hsieh<[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message --- I'm not sure if I understand you, but you can simply specify IP address and correct Host header

Patrick Hsieh wrote:

Hello list,

I am trying to open a remote webpage in my php program with curl library. The webpage will redirect me to another webpage(Say, "http://www.anothersite.com/index.html";). Basically, the curl library will resolve the domain name via the DNS servers defined in the system, however, I hope I can customized the temporary DNS lookup in the php program for special purpose without modifying the /etc/resolv.conf or other system configuration files. Is it possible? How?




--- End Message ---
--- Begin Message ---
You should look for loadVariables() in ActionScript (Flash) in this case
rather than MING.


Regards,
Sumarlidi E. Dadason

SED - Graphic Design
_________________________________
E-mail: [EMAIL PROTECTED]
website: www.sed.is

-----Original Message-----
From: MH [mailto:[EMAIL PROTECTED]] 
Sent: 15. janúar 2003 13:36
To: [EMAIL PROTECTED]
Subject: [PHP] PHP/Flash Dynamic Graphs?


Hi,

I want to create dynamic graphs with PHP and Flash for data that changes
constantly (let's say every 2 seconds).  The graphs must change visibly
in the browser window without refreshing the page.  Is this possible?  I
have read most that I could find on MING and searched the web as well,
but didn't have much luck.  Is PHP/Flash approach the best?

Any info/scripts/url's would be appreciated.

TX
MH



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

--- End Message ---
--- Begin Message ---
Hey!
What I want to do is, There is user that logs into the channel. And I
need to make script to change his password. How do I execute shell
command: passwd ? or what should I do to change that password?
Thanks!
mNTKz
--- End Message ---
--- Begin Message ---
Use sudo (man sudo)

Mantas Kriauciunas wrote:

Hey!
What I want to do is, There is user that logs into the channel. And I
need to make script to change his password. How do I execute shell
command: passwd ? or what should I do to change that password?
Thanks!
mNTKz



--- End Message ---
--- Begin Message ---
> It does sound like you're right. Like ZA is perhaps allowing the user's
> request to go twice. This is akin to people who double click on links
> because that's what they're used to doing on windows icons. However, it
> seems a bit odd how it selects to do it. It seems that if it did it twice
> on every call, one would expect the count to go immediately to 2 rather
than
> start at one. Or does the session only begin after that first item is
> clicked?

The strange thing is that it is not necessarily twice. Say I buy 2 items
and then I buy 5 items, it will take 7 (2+5) and add that onto the first
purchase of 2 giving me 9 items (when I should only have 7). As you can
imagine, the more you buy the more this problem escalates.

> Have you tested this on several machines?

No I haven't I'm afraid.

> Mike

Another thing I have noticed is that the problem only occurs if I use ONE
PHP script to do everything (i.e. display and add to the cart)

If I split the code accross different scripts I then get nothing added to
the cart at all (even though the SID automatically gets inserted inside each
form, everytime I sumbit and look at the code the SID changes). I think this
is
probably to do with the fact that I have used the Rewrite rule in an
.htaccess file
and the SID (if in the URL) is not getting passed on to the script - not
sure about
that though.


Hmm, still scratching my head although I have the items being correctly
added to the
cart when no ZA and now I have them not being added at all when Privacy is
on. This
is after having split the code into multiple files.

Don't know why it should make a difference over multiple files though?

Thanks
Neil

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

I was just wondering what is php's future with something like Asp .Net coming up...I have read many articles by Php guys who think Asp.Net is the future. If that's the true case...is it really worth sticking to Php at all?

Thanx!
-Dhaval





_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus

--- End Message ---
--- Begin Message --- IMHO, and without even comparing the feature sets, php has one distinct advantage for me: It's free.
I'm pretty sure a lot of hosting companies feel the same way.


Keith

At 11:07 PM 1/15/2003, Dhaval Desai wrote:
Hello ppl,

I was just wondering what is php's future with something like Asp .Net coming up...I have read many articles by Php guys who think Asp.Net is the future. If that's the true case...is it really worth sticking to Php at all?

Thanx!
-Dhaval





_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus


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

--- End Message ---
--- Begin Message ---
What is asp.net?

It's something to catch a snake with!

Quoting Dhaval Desai <[EMAIL PROTECTED]>:

### Hello ppl,
### 
### I was just wondering what is php's future with something like Asp .Net 
### coming up...I have read many articles by Php guys who think Asp.Net is the
### 
### future. If that's the true case...is it really worth sticking to Php at
### all?
### 
### Thanx!
### -Dhaval
### 
### 
### 
### 
### 
### _________________________________________________________________
### MSN 8 with e-mail virus protection service: 2 months FREE* 
### http://join.msn.com/?page=features/virus
### 
### 
### -- 
### PHP General Mailing List (http://www.php.net/)
### To unsubscribe, visit: http://www.php.net/unsub.php
### 
### 



--- End Message ---
--- Begin Message ---
The 'problem' with ASP is that it really requires a Windows platform... and
while Unix is still primarily the OS of choice for web-servers then ASP &
PHP will 'co-exist' there will always be a PHP and ASP camp... naturally any
broad-minded developer will keep up with both technologies as this will
ultimatley make you more sellable when looking for work or a job.

I have very little ASP experiance, but that has cost me the oppertinity to
apply for several well-paying jobs, as there is very few PHP positions
around - I'm speaking for the UK market here.

Saying that, most companies that ask for ASP don't necessarily 'need' to use
ASP, they just request it cos it's the executive-level buzzword of the
moment, if you get in you can always show them the errors of their
misconceptions - I generally have!

However  I feel that will change - in the UK atleast there is a slowly
growing number of PHP-based projcets & roles appearing, and PHP is by far
the most flexible & powerfull of the 2 - IMHO. I have been a web-developer
for several years, and have deployed solutions in ASP, Cold Fusion and PHP,
PHP remains my platform of choice as it works equally well in both Unix &
Windows platforms.

This is of course just my views & hopes for the present and future :)

Long live PHP!!!


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.438 / Virus Database: 246 - Release Date: 08/01/03


--- End Message ---
--- Begin Message ---
I think that the developers of PHP know exactly where they want PHP
to sit in the big bad world of .NET/J2EE.

The whole reason the dotnet and java extensions have been written for
PHP, is to allow PHP to talk to java/net objects, but more importantly,
have PHP act as the front end, and .NET/J2EE do the business logic. I
can't remember where I read it, but one of the PHP developers was
mentioning that part of the modifications to ZE2 and its object
handling, was to enable better interactione with Java and .NET.

It will be more interesting once the Mono project reaches v1.0. Then
you will have a .NET runtime on Unix environments, as well as ASP.NET,
and the argument that 'ASP.NET is windows only' will cease to exist.

There will always be a place for PHP in the web world. As an application
engine, and as a frontend to other languages (Just look at what yahoo
are doing with PHP)

The 'ASP vs PHP' threads will still continue. What a waste of time
they are.

-----Original Message-----
From: Brian McGarvie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Php's future with Asp .NET?


The 'problem' with ASP is that it really requires a Windows platform... and
while Unix is still primarily the OS of choice for web-servers then ASP &
PHP will 'co-exist' there will always be a PHP and ASP camp... naturally any
broad-minded developer will keep up with both technologies as this will
ultimatley make you more sellable when looking for work or a job.

I have very little ASP experiance, but that has cost me the oppertinity to
apply for several well-paying jobs, as there is very few PHP positions
around - I'm speaking for the UK market here.

Saying that, most companies that ask for ASP don't necessarily 'need' to use
ASP, they just request it cos it's the executive-level buzzword of the
moment, if you get in you can always show them the errors of their
misconceptions - I generally have!

However  I feel that will change - in the UK atleast there is a slowly
growing number of PHP-based projcets & roles appearing, and PHP is by far
the most flexible & powerfull of the 2 - IMHO. I have been a web-developer
for several years, and have deployed solutions in ASP, Cold Fusion and PHP,
PHP remains my platform of choice as it works equally well in both Unix &
Windows platforms.

This is of course just my views & hopes for the present and future :)

Long live PHP!!!

--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 09:07, Dhaval Desai wrote:
> Hello ppl,
>
> I was just wondering what is php's future with something like Asp .Net
> coming up...I have read many articles by Php guys who think Asp.Net is the
> future. If that's the true case...is it really worth sticking to Php at
> all?
>
> Thanx!
> -Dhaval
>
Hi,
My opinon is Php future is very bright. .NET is marketing mumbo jumbo, and 
java is Sun's bug yard.

It was pretty clear. None of them able to compete against PHP. ASP.NET is 
expensive, JSP is hard to config and code. Both of them slower than PHP, 
learning PHP easier than others.

Sancar "Delifisek" Saran


--- End Message ---
--- Begin Message ---
> On Thursday 16 January 2003 09:07, Dhaval Desai wrote:
> > Hello ppl,
> >
> > I was just wondering what is php's future with something like Asp .Net
> > coming up...I have read many articles by Php guys who think Asp.Net is
the
> > future. If that's the true case...is it really worth sticking to Php at
> > all?
> >
> > Thanx!
> > -Dhaval
> >

Do you believe everything you hear? If so, email me, because I can get you
some great deals on anything you want!

Anyhow... PHP/ASP/JSP are all here to stay. PHP is moving further up and up.
Overall, the best recommendation is to use what you know and what
accomplishes your mission.

On a semi-related note, I read something the other day that MS was dropping
the .Net name from it's next round of OS releases. I guess there was
supposed to be a Windows Server .Net or something, but they decided to drop
it because even they admitted that _everything_ was .Net and it was getting
saturated.

---John Holmes...

--- End Message ---
--- Begin Message ---
"Dhaval Desai" <[EMAIL PROTECTED]> wrote... :

> Hello ppl,
> 
> I have read many articles by Php guys who think Asp.Net is the 
> future. 

What PHP guys?

> If that's the true case...is it really worth sticking to Php at all?

Definitely yes, unless you love paying the licenses for every single
form you add to your pages :)

--
Maxim Maletsky
[EMAIL PROTECTED]

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

First of all thanks for the suggestion. I thought something along these 
lines. The disadvantage to this approach in my opinion is that I have to 
include the controller in all pages and it is therefor not possible to 
integrate pages which I do not control without breaking the concept of 
redirecting all requests to the same script. 
Possibly the problem lies outside of PHP and can be solved by means of 
configuring the webserver appropriatly.
What do you think?

Best regards
Stefan
----
Stefan Langer - SPIRIT21/AG

Max-Planck-Str. 3
85716 München - Unterschleissheim

Tel.: +49 (0)89 3740639 - 14
Fax.: +49 (0)89 3740639 - 22
--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 09:15, Beauford.2002 wrote:
> The settings in both were virtually identical. It's a mute point however as
> I have uninstalled both PHP and MySQL. This was just a test project anyway,
> and I really don't want to put the time into it. I have a working copy of
> both on my Linux box and prefer this anyway.

Jeez. As a programmer you should know that "virtually identical" is not good 
enough!

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"This is lemma 1.1.  We start a new chapter so the numbers all go back to 
one."
                -- Prof. Seager, C&O 351
*/

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

I think I may have made some headway with my server problems.  I loaded the
site onto another account within the same machine, and I can't seem to
replicate the "document contained no data" error at all.

BUT I did notice that once I login (it says "you are logged in as justin"
across the top of the screen), if I refresh the same page a few times, it
will MOSTLY say "you are logged in as..." but OCCASIONALLY it says "click
here to login"...

The server does use trans-sid, but in my case, it's using cookies... the
session doesn't get LOST (because it's "back" next time I refresh), but I do
appear to be "logged out" until I refresh again.

VERY strange.

To investigate further, I turned off cookies, and tried again... after 5 or
so refreshes, I lost the session ID out of the URL.


Whilst I can't repeat the problem on the original account, I have a feeling
these two issues are related.


What's likely to cause this?


Here's the Session section of phpinfo():

--
Session Support enabled
Directive                   Local Value         Master Value
session.auto_start          Off                 Off
session.cache_expire        180                 180
session.cache_limiter       nocache             nocache
session.cookie_domain       no value            no value
session.cookie_lifetime     0                   0
session.cookie_path         /                   /
session.cookie_secure       Off                 Off
session.entropy_file        /dev/urandom        /dev/urandom
session.entropy_length      256                 256
session.gc_maxlifetime      900                 900
session.gc_probability      1                   1
session.name                PHPSID              PHPSID
session.referer_check       no value            no value
session.save_handler        mm                  mm
session.save_path           /tmp                /tmp
session.serialize_handler   php                 php
session.use_cookies         On                  On
session.use_trans_sid       1                   1
--

My LAN server's values (not compiled with trans-sid) are:
--
Session Support enabled
Directive                   Local Value     Master Value
session.auto_start          Off             Off
session.cache_expire        180             180
session.cache_limiter       nocache         nocache
session.cookie_domain       no value        no value
session.cookie_lifetime     0               0
session.cookie_path         /               /
session.cookie_secure       Off             Off
session.entropy_file        no value        no value
session.entropy_length      0               0
session.gc_maxlifetime      1440            1440
session.gc_probability      1               1
session.name                PHPSESSID       PHPSESSID
session.referer_check       no value        no value
session.save_handler        files           files
session.save_path           /tmp            /tmp
session.serialize_handler   php             php
session.use_cookies         On              On
--

Biggest difference I can see (not that I really know what I'm looking for)
is that locally, the save_handler is 'mm' (memory?), and on the server, it's
files.  And the entropy stuff, which I don't understand :)


So, what could cause the session to drop (then kick back in again) by simply
refreshing the page a few times?


Many thanks in advance,

Justin French




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

Thanks for the great help! It's working now!

The solution:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
{$_GET['id']}";


Regards,

Frank
----- Original Message -----
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "Frank Keessen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 1:22 PM
Subject: Re: [PHP] Question about $_GET


> Make life easy for yourself:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
".$_GET['id'];
> ----- Original Message -----
> From: "Frank Keessen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 15, 2003 4:50 AM
> Subject: [PHP] Question about $_GET
>
>
> Hi All,
>
> Can you please help me with the following problem? I've had code wich was
running fine with php till
> i've upgraded to PHP version 4.2.3.
>
> The original code line was:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
'$id'";
>
> but it's not working when you have register_globals=Off
> So i've read everywhere to use the $_Get:
>
> So the code looks like this:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
$_GET['id']";
>
> But all i'm getting in my browser is:
>
> parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
>
>
> Can someone please help?
>
> Thanks and regards,
>
> Frank
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 05:38, Scott Fletcher wrote:
> Or worse, not substituting the characters in the Session ID.  Just use the
> same Session ID.  What if there is leftover session file in the /tmp
> directory of the Unix machine and we're dealing with hundred of users each
> day.  Some of those session files aren't deleted because the user just
> closed the browser without logging out.  It is unfortunate that there is no
> better solution to this.

I've been sort of following this thread and as I understand it you're trying 
to use HTTP_REFERER to ascertain whether a user has 'logged in'? IE if 
HTTP_REFERER isn't the login page then they haven't 'logged in'? 

If that is the case then you should know that this provides no security at 
all.

Use a proper authentication system based on sessions.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
If Robert Di Niro assassinates Walter Slezak, will Jodie Foster marry Bonzo??
*/

--- End Message ---
--- Begin Message ---
On Wednesday 15 January 2003 21:16, Avenger wrote:
> Hey,I wanta used the PHP doc user notes.
>
> Where can i get it.

http://weblabor.hu/php-doc-chm

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
HOW YOU CAN TELL THAT IT'S GOING TO BE A ROTTEN DAY:
        #32: You call your answering service and they've never heard of you.
*/

--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 04:17, Timothy Hitchens \(HiTCHO\) wrote:
> Now what is the output if you do this outside of the function after
> registering a session var??
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: [EMAIL PROTECTED]
>
> > -----Original Message-----
> > From: Duncan Abbott [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, 16 January 2003 4:53 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: RE: [PHP] Session wierdness...
> >
> >
> > I did what you suggested and I've attached the output -
> > there's no $_SESSIONS array in there.
> >
> > But I've managed to register session vars outside of this
> > function I'm having trouble with so what's going on?

You've probably realised by now that it is the $_SESSION variable you're 
looking for?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Man who arrives at party two hours late will find he has been beaten
to the punch.
*/

--- End Message ---
--- Begin Message ---
As a beginner I have been trying and trying, but to no suc6. Hope there's
someone here able to help me out:

Am trying to get rid of spaces and change all into uppercase in an entered
form variable, which I am able to do when trying things out but when running
the full php statement it refuses to change and enters the original variable
into the database anyway. Haven't got a clue why.

Please, what's wrong with the following:

 if(mysql_result($query, 0, 0) == 0)// && (mysql_result($query2) > 0)#)
          {
          $password = md5($_POST['strPassword']);
          $newstrUserName = $_POST['strUsername'];
          $newstrUserName = strtoupper(ereg_replace(" ", "",
$newstrUserName));
          $strQuery = "INSERT INTO users (";
          $strQuery .= "`username`, `password`, `level`, `firstname`,
`lastname`, `ngfnummer`, `email`) VALUES (";
          $strQuery .= "'$newstrUserName', '$password', '1',
'{$_POST['strFirstName']}', '{$_POST['strLastName']}',
'{$_POST['strNgfnummer']}', '{$_POST['strEmail']}')";
                if(mysql_query($strQuery)) etc etc etc

original username given f.i. 'joe 8', $newstrUserName makes this 'JOE8', but
the above still enters 'joe 8' into database, how come?????
Thanks,
Martin




--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 17:17, WMB wrote:

Please use a descriptive subject!

> Am trying to get rid of spaces and change all into uppercase in an entered
> form variable, which I am able to do when trying things out but when
> running the full php statement it refuses to change and enters the original
> variable into the database anyway. Haven't got a clue why.
>
> Please, what's wrong with the following:
>
>  if(mysql_result($query, 0, 0) == 0)// && (mysql_result($query2) > 0)#)
>           {
>           $password = md5($_POST['strPassword']);
>           $newstrUserName = $_POST['strUsername'];
>           $newstrUserName = strtoupper(ereg_replace(" ", "",
> $newstrUserName));

So here if you echo $newstrUserName, it is correct and what you had expected?

>           $strQuery = "INSERT INTO users (";
>           $strQuery .= "`username`, `password`, `level`, `firstname`,
> `lastname`, `ngfnummer`, `email`) VALUES (";
>           $strQuery .= "'$newstrUserName', '$password', '1',
> '{$_POST['strFirstName']}', '{$_POST['strLastName']}',
> '{$_POST['strNgfnummer']}', '{$_POST['strEmail']}')";

What if you now echo $strQuery? Is it still what you expected?

>                 if(mysql_query($strQuery)) etc etc etc

And you should have error checking in your code, something like:

  if (mysql_query($strQuery)) {
     do_your_stuff; }
  else { //an error
    echo mysql_error();
  }

or checkout the examples in the manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
The most costly of all follies is to believe passionately in the palpably
not true.  It is the chief occupation of mankind.
                -- H.L. Mencken
*/

--- End Message ---
--- Begin Message ---
$sql = "
    select count(*) as theCount
    from myTable
";
...
$row_id = rand(1, $myrow["theCount"]);
...
$sql_randow_row "
    select *
    from myTable
    where id = $row_id
";

I assume I'm right with the method above to select a random row? or any
other way?



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.438 / Virus Database: 246 - Release Date: 08/01/03


--- End Message ---
--- Begin Message ---
Don't make life difficult for yourself :)

SELECT * FROM myTable ORDER BY RAND() LIMIT 0,1

HTH

Danny.

----- Original Message ----- 
From: "Brian McGarvie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 9:37 AM
Subject: [PHP] Random Row...


> $sql = "
>     select count(*) as theCount
>     from myTable
> ";
> ...
> $row_id = rand(1, $myrow["theCount"]);
> ...
> $sql_randow_row "
>     select *
>     from myTable
>     where id = $row_id
> ";
> 
> I assume I'm right with the method above to select a random row? or any
> other way?
> 
--- End Message ---
--- Begin Message ---
My provider has GD version 1.6.2 running, and I'm trying to dynamically
resize uploaded JPEG images. But ofcourse that doesn't work with that
version. Does anyone have another solution to automatically resize JPEG
images upon upload?


--- End Message ---
--- Begin Message ---
On Thursday 16 January 2003 17:43, Marco Alting wrote:
> My provider has GD version 1.6.2 running, and I'm trying to dynamically
> resize uploaded JPEG images. But ofcourse that doesn't work with that
> version. Does anyone have another solution to automatically resize JPEG
> images upon upload?

If you can install your own programs then you can use netpbm or ImageMagick 
(or you can ask your host to do so).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
He who knows, does not speak.  He who speaks, does not know.
                -- Lao Tsu
*/

--- End Message ---
--- Begin Message ---
it is stored in $_SERVER["SERVER_ADDR"]

Kyle Lampkin wrote:

Hello all,
Newbie here---- I need to know if there is a way I can get my dynamic IP address for use in a php script?

--- End Message ---
--- Begin Message ---
At 00:41 16-1-2003, you wrote:
Hello all,
Newbie here---- I need to know if there is a way I can get my dynamic IP address for use in a php script?
--
There are loads of variables in the arrays $_SERVER and $_ENV, dump these arrays and see if there is something in it that you can use. Maybe you can get a hint by running the
<?PHP
phpinfo()
?>
function. It will output loads of info.



--- End Message ---
--- Begin Message --- First go to the file that generates the error and find out how it knows the template file does not exists

roel wrote:

Hi,

i'm having a problem. I just installed a webserver with mysql and php. I
copied my files that i had stored on another webserver to my new. I didn't
change anything to these files and the files worked fine on the other
server.

Now in this server i get this error with a template:
Template Error: filename: file ./templates/nav_left_body.tpl.php does
not exist.
Halted

But that file does exist. I can see it through ftp an i can get to it via
http browser.

What could be wrong? Could it be a config failure in my php.ini? Or in
httpd.conf? In case it is the config, what could it be?

Thanks in advance!!





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

...and then Gladky Anton said...
% 
% Hello everybody!

Hi!


% Can anybody advice me the best free web-hosting with PHP?

No, there's still no new advice (I can understand posting a second time
because of a lack of response the first time -- and so I'll stop a third
post right now).  Check the mailing list archives for the last million
times this has come up.


% Thank you.


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg93195/pgp00000.pgp
Description: PGP signature

--- End Message ---
--- Begin Message ---
I'm working on a large VB/Sql Server to Php/Postgresql conversion (approx.
60k lines of code).

I'd like to design this thing as OO as possible, because I think
ultimately it leads to better, more extendable and readable software. 
However, since php does the whole copy thing with objects, I'm a little
concerned.

Is this "deficiency" on the part of PHP 4 something I should be concerned
about?  If I have a 60k loc fully object-oriented php app with a large
amount (approx. 500 or so) queries to a db, am I making a mistake by going
OO?  Will it really slow down the app *that* much, or consume memory like
a pack of hungry piranhas?

Thanks for the input, guys.

John




--- End Message ---
--- Begin Message ---
"John Wells" <[EMAIL PROTECTED]> wrote... :

> I'm working on a large VB/Sql Server to Php/Postgresql conversion (approx.
> 60k lines of code).

First of all, VB is precompiled and PHP is not. This will already be
slower. So, you gonna need to create a logic that loads only the
necessary classes for every request. In VB you wouldn't probably need it.

> I'd like to design this thing as OO as possible, because I think
> ultimately it leads to better, more extendable and readable software. 

Good idea.

> However, since php does the whole copy thing with objects, I'm a little
> concerned.
>
> Is this "deficiency" on the part of PHP 4 something I should be concerned
> about?

Depends al on the logic you will give to it.

> If I have a 60k loc fully object-oriented php app with a large
> amount (approx. 500 or so) queries to a db, am I making a mistake by going
> OO? 

500 queries wan't really matter because it has few to do with OO/PHP.
60k of code, if all together on the same request will be definitely slow.
So, make sure that *only* the required classes are loaded on each
execution.


--
Maxim Maletsky
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message --- If the server crashes, it is definetly NOT fault of your scripts, the server/php should return errors when there is something wrong, not crash. Remember that on multithreaded server you are taking other requests down too. The server, php, some extenssion might have been miscompiled, wrong versions of libraries are used, there is a bug, anything. But you should not be able to take server down from a script language.
Take a look at extenssions used, if any of them is unstable/experimental

Justin French wrote:

Just as an update, the sysadmin definitely thinks it's my code... I'm not
convinced, but I'm faced with the task of finding out :)


It appears your site is causing the webserver to segfault (crash), which is
why nothing comes up some times - these crashes are logged in the main Apache
logfile, which is why you saw nothing in your site logfile when this happened.
I don't know exactly what is causing it to crash, but it is definately
something in your PHP code.

I asked for a copy of the logfiles she talked about:


[Wed Jan 15 08:23:32 2003] [notice] child pid 8153 exit signal Segmentation
fault (11)
[Wed Jan 15 08:34:57 2003] [notice] child pid 7702 exit signal Segmentation
fault (11)
[Wed Jan 15 08:34:58 2003] [notice] child pid 7366 exit signal Segmentation
fault (11)
[Wed Jan 15 08:34:59 2003] [notice] child pid 7511 exit signal Segmentation
fault (11)
[Wed Jan 15 08:35:00 2003] [notice] child pid 7512 exit signal Segmentation
fault (11)


Not very helpfull :)


As far as I can tell, the error I receive (basically a "document contained
no data" error) is the result of the server shitting itself because of
ANOTHER script on my site, that was accessed before it.

This makes debugging even worse, because I don't even know what script to
look in!

It could be in any include()'d file in my header or footer, or the guts of
any script on my site!! Yay!!


The other possibility is that the crash occurs on the actual script I'm
calling, which IS a bit easier to debug... I think!


The sysadmin has pretty much ruled out memory leaks:


I checked the httpd processes
to see if any memory was leaking (if the memory usage climbs constantly,
memory is being leaked), but it was all fine.


Has any one got any suggestions on how I might track down this bug, or
ascertain which script/include file is causing the server to segfault?


Justin




--- End Message ---
--- Begin Message ---
All,

I have a problem sending Multipart - MIME (plaintext + html) email....

 $bodyPlaintext = " (PLAINTEXT)";

 $bodyHTML = " (HTML CODE)";
 $headers = "";
 $headers .= "From: [EMAIL PROTECTED]\r\n";
 $headers .= "Reply-To: [EMAIL PROTECTED]\r\n";
 $headers .= "X-Mailer: PHP " . phpversion();

 $subject = "Alert! Confirmation!";

 //unique boundary
 $boundary = uniqid("HTMLBODY");
 //add From: header
 //$headers = "From: [EMAIL PROTECTED]\r\n";
 //specify MIME version 1.0
 $headers .= "MIME-Version: 1.0\r\n";
 //tell e-mail client this e-mail contains//alternate versions
 $headers .= "Content-Type: multipart/alternative; boundary =
$boundary\r\n\r\n";
 //message to people with clients who don't
 //understand MIME
 $headers .= "This is a MIME encoded message.\r\n\r\n";
 //plain text version of message
 $headers .= "--$boundary\r\n" .
    "Content-Type: text/plain; charset=ISO-8859-1\r\n" .
    "Content-Transfer-Encoding: base64\r\n\r\n";
 $headers .= chunk_split(base64_encode($bodyPlaintext));
 //HTML version of message
 $headers .= "--$boundary\r\n" .
    "Content-Type: text/html; charset=ISO-8859-1\r\n" .
    "Content-Transfer-Encoding: base64\r\n\r\n";
 $headers .= chunk_split(base64_encode($bodyHTML));

sent with:

mail($email, $subject, "", $headers);

Now... the problem I have is some people are reporting they get the
Multi-part stuff as the body... for others it'll work as wanted... i.e.
display Plaintext or render the HTML as wanted.

Anyone had this problem?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.438 / Virus Database: 246 - Release Date: 07/01/03


--- End Message ---
--- Begin Message ---
I have al for loop that looks something like this:
 
$checkCurrName  = "SELECT imgName FROM $db_img ORDER BY imgName DESC";
$resultCurrName = mysql_query($checkCurrName, $db);
 
 
for ($i = 0; $i < $n; $i++){
            list($currName) = mysql_fetch_row($resultCurrName);
            $newName = $currName++;
print($newName);
 
//insert $newName into db
} 
 
The problem is that I get the first printout right (the current value in
the database + 1) but all after that equal the first one, it looks
like i’m not getting the newest value from the database after the first
loop.
 
Any Ideas about this
 
Thanks, David
--- End Message ---
--- Begin Message ---
Are you sure $n is being set somewhere?

Why not do it like this:

while($row = mysql_fetch_row($resultCurrName))
{
  print $row[0]+1;

  //do rest of whatever...
}

---John Holmes...

----- Original Message -----
From: "Davíð Örn Jóhannsson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 8:39 AM
Subject: [PHP] Problem with a for loop...


I have al for loop that looks something like this:

$checkCurrName  = "SELECT imgName FROM $db_img ORDER BY imgName DESC";
$resultCurrName = mysql_query($checkCurrName, $db);


for ($i = 0; $i < $n; $i++){
            list($currName) = mysql_fetch_row($resultCurrName);
            $newName = $currName++;
print($newName);

//insert $newName into db
}

The problem is that I get the first printout right (the current value in
the database + 1) but all after that equal the first one, it looks
like i'm not getting the newest value from the database after the first
loop.

Any Ideas about this

Thanks, David

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

-----Original Message-----
From: Davíð Örn Jóhannsson [mailto:[EMAIL PROTECTED]] 
Sent: 16. janúar 2003 13:59
To: '1LT John W. Holmes'
Subject: RE: [PHP] Problem with a for loop...

I only want the last inserted row in the mysql database, and each time
the script goes trough the loop it adds a new row into the database, so
I want to get the newest row from the database when the script goes
throug the loop
The second time. But it dosent look like im geting the new row from the
database even though it is inserted. I'm wondering if mysql_querys don't
work in loops in order to get the newst row but if it works how would I
be able to accomplis that?

-----Original Message-----
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: 16. janúar 2003 13:51
To: Davíð Örn Jóhannsson; [EMAIL PROTECTED]
Subject: Re: [PHP] Problem with a for loop...

Are you sure $n is being set somewhere?

Why not do it like this:

while($row = mysql_fetch_row($resultCurrName))
{
  print $row[0]+1;

  //do rest of whatever...
}

---John Holmes...

----- Original Message -----
From: "Davíð Örn Jóhannsson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 8:39 AM
Subject: [PHP] Problem with a for loop...


I have al for loop that looks something like this:

$checkCurrName  = "SELECT imgName FROM $db_img ORDER BY imgName DESC";
$resultCurrName = mysql_query($checkCurrName, $db);


for ($i = 0; $i < $n; $i++){
            list($currName) = mysql_fetch_row($resultCurrName);
            $newName = $currName++;
print($newName);

//insert $newName into db
}

The problem is that I get the first printout right (the current value in
the database + 1) but all after that equal the first one, it looks
like i'm not getting the newest value from the database after the first
loop.

Any Ideas about this

Thanks, David

--- End Message ---

Reply via email to