Re: [PHP] Global varialbes in functions

2003-10-04 Thread Matt Schroebel
Jeff McKeon said on Saturday, October 04, 2003 at 11:35 AM

However on the third funtion I get an undefined index error for
'ticketid'

Post some code ...

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



RE: [PHP] Correct Coding

2003-08-14 Thread Matt Schroebel
Roger B.A. Klorese wrote:
 if (Add == $Task)
I call that 'defensive programming', defending yourself from yourself!

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



RE: [PHP] Best PHP CMS

2003-08-09 Thread Matt Schroebel

 -Original Message-
 From: Anthony [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, August 05, 2003 9:52 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Best PHP CMS
 
 
 I'm just looking for some opinions.  I've been going though 
 sourceforge
 looking at different CMS systems.  There are a lot of really good CMS
 projects out there.  I'm looking for some opinions on the 
 best ones out
 there.  I'm obviously looking at something PHP based and using mySQL
 backend.  Some of the features that I'd like are an easy template
 implementation, blog features, media gallery and something 
 that's easy to
 build custom modules to add features.  So far I'm looking at 
 about 6 CMS
 systems, I like certain things in each of them. so what's 
 your opinion.
I've looked at these:

http://www.midgard-project.org/
Midgard looked good but I couldn't get the admin to work right, and it
requires php-4.2.2 or lower (which drove me a little nuts at first).
It's optimized for php as it's functions are written in C and become
built in php functions with --with-midgard, plus it has a mod_midgard to
link into apache.  Midgard allows lots of customization and you could
place php code just about anywhere.  Runs on *nix only and requires
access to add modules to php and apache.

http://www.tikiwiki.org/
TikiWiki had lots of cool features.  It looked to me to be more suitable
for a community CMS (baseball team etc) rather than a general CMS. All
php.

http://www.geeklog.net/
There's also GeekLog, with a similar community slant as TikiWiki, and it
was reviewed in last months php-architect magazine. All php.

http://www.typo3.org
I agree with what Nick Tabbet said.  Of these 4 CMSs, this one has the
most refined user interface, and most general purpose features.  It's
written in all object oriented php and will easily install on an ISP
hosted system.  Quick setup 1-2-3, and your ready to go.  It does have a
long learning curve, but anything complex does.  Since it's all OO, has
it's own TypoScript code to design content and big, it will really
benefit if run with a php accelerator to cache the intermediate code.
Has good tutorial for getting started, and another good intro to it's
templates.  It's more for small to mid-sized sites, as anything larger
should be written in native C, C++, etc.

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



[PHP] PHP CMS for high load

2003-07-23 Thread Matt Schroebel
Is anyone using a php/mysql/apache CMS (either custom or open source)
that is performing well serving on the order of 1 million page views a
month with 2600+ items of content?  If so, I'd like to know what your
using and a description of your server setup, such as if the backend
runs on a different server then the frontend, whether the DB server is
separate, memory and CPU speeds.  Thanks

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



RE: [PHP] So in summary this can't be done due to permission problems?

2003-07-11 Thread Matt Schroebel
 -Why the concern about letting that user have execute permissions,
 and then prevent anyone (except those that have valid reasons) from
 having write/execute permission to the webroot.

The permissions are Read, Write, and Execute.  Read and Write are self
explanatory (for directories Write means you can add new files).
Execute means you can run an program or shell script (for directories
this means you can change directories to it).  There are 3 settings for
the permissions, User-rwx, Group-rwx, and Other-rwx.  Apache usually
runs as an unprivileged user, so it uses the Other permissions.  Other
is everyone that isn't the owner or group, so it's basically anyone else
on the server.  If you give other write access to the directory with
other execute permission, then anyone can read/write to the directory.
Which means that they can delete, change text, images, what have you.
On a shared server with lots of untrusted users if could be interesting.

So create a temp directory, and give chmod o=rwx.  Do your writing
there, when done stick the final file into a table in a db, and have
your main page fetch the contents. 


For the CMS, before you work too much, take a look at typo3 ...
http://www.typo3.com/

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



RE: [PHP] PHP Auto-Date Select Box

2003-04-04 Thread Matt Schroebel
 -Original Message-
 From: Jay Fitzgerald [mailto:[EMAIL PROTECTED] 
 Sent: Friday, April 04, 2003 9:17 AM
 Subject: [PHP] PHP Auto-Date Select Box
 
 
 Does anyone know how I can make a PHP form select box that 
 has the dates in 
 it for the next 7 days including today and the remaining days 
 from this week?
 
 eg:
 SELECT NAME=date
 OPTION VALUE=2003-04-05Friday, April 5
 OPTION VALUE=2003-04-06Saturday, April 6
 OPTION VALUE=2003-04-07Sunday, April 7
 OPTION VALUE=2003-04-08Monday, April 8
 OPTION VALUE=2003-04-09Tuesday, April 9
 OPTION VALUE=2003-04-10Wednesday, April 10
 OPTION VALUE=2003-04-11Thursday, April 11
 OPTION VALUE=2003-04-12Friday, April 12
 OPTION VALUE=2003-04-05Saturday, April 13
 OPTION VALUE=2003-04-05Sunday, April 14
 /SELECT

I'd use date() and time() and a function such as

Function buildSelect($howMany,$name) {
$str = SELECT NAME=\$name\\n;
$t = time();
For (i=0;$i$howMany;$i++) {
 $str .= 'OPTION VALUE=';
 $str .= date('your numeric format string',$t);
 $str .= ''
 $str .= date('your verbose format string',$t) . \n;;
 $t += 86400;
}
$str .= /SELECT\n;
return $str;
}

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



RE: [PHP] RE: [newbie] embed php in html file

2003-04-03 Thread Matt Schroebel
 -Original Message-
 From: Bobby Rahman [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 03, 2003 11:25 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] RE: [newbie] embed php in html file
 
 I have a header.php :
 ?
 session_start();
 echo BRfont face=\Verdana\font 
 color=\red\size=\3\Logged in as: 
 .$_SESSION['curr_user'].BR/fontbr;
 ?

Not your question, but in case you don't know the syntax of arrays in
double quotes, you can also write that as:
echo BRfont face=\Verdana\font color=\red\size=\3\Logged in
as: {$_SESSION['curr_user']}BR/fontbr;

 
 Now I have many html forms which user's see
 What I want to know is how to include the header.php into 
 every html form 
 page.
 
 One way is to rename the html file with extension .php
 then
 ?
 require_once(header.php)
 ?
 
 This seems a bit wasteful for one line of php to change all 
 the forms to 
 .php. Is there any other ways of embedding the header.php 
 file in html 
 forms.

Take a look at auto_prepend.  You'll need to change the config to parse
the file, so you might want to name the pages with the user name .htm,
and parse .htm as a php file.

http://www.php.net/manual/en/configuration.directives.php#AEN2371

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



RE: [PHP] datetime

2003-04-03 Thread Matt Schroebel

 -Original Message-
 From: Tim Haskins [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 03, 2003 2:45 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] datetime
 
 
 How does one retrieve the date and time off a server in the following
 format?
 
 2003-04-03 11:11:38

Plenty of examples here:
http://www.php.net/manual/en/function.date.php

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



RE: [PHP] How to Return 403 Forbidden headers

2003-03-27 Thread Matt Schroebel

 -Original Message-
 From: Christopher Ditty [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 27, 2003 10:42 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] How to Return 403 Forbidden headers

header('HTTP/1.0 403 Forbidden');

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



RE: [PHP] How to Return 403 Forbidden headers

2003-03-27 Thread Matt Schroebel


 -Original Message-
 From: Christopher Ditty [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 27, 2003 10:59 AM
 To: Matt Schroebel; [EMAIL PROTECTED]
 Subject: RE: [PHP] How to Return 403 Forbidden headers
 
 
 Thanks, but it returns a blank page.

Works for me in I.E 6.

?php
header('HTTP/1.0 403 Forbidden');
?

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



RE: [PHP] How to Return 403 Forbidden headers

2003-03-27 Thread Matt Schroebel


 -Original Message-
 From: Christopher Ditty [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 27, 2003 11:15 AM
 To: Matt Schroebel
 Subject: RE: [PHP] How to Return 403 Forbidden headers
 
 
 Try it in Netscape 7 if you have it.

6.5 showed blank, and if you add html it shows up.  H

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



RE: [PHP] RE: Anew set of eyes

2003-03-27 Thread Matt Schroebel
 -Original Message-
 From: Richard Whitney [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 27, 2003 1:02 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] RE: Anew set of eyes
 
 
 Can you folks help me out b y looking at this code?
 
 It all of a sudden is not grabbing the email address from the DB, yet
 array_count_values displays it nicely.

I always use the curly brace assist on arrays in double quotes. It's the
proper way.  And you ought to single quote the index, so it's like:
$mailheaders = From: {$row_c['customers_firstname']}
{$row_c['customers_lastname']} {$row_c['customers_email_address']};

If you do that to all of your array references, and set error_reporting
to E_ALL, you'll find your typo.

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



RE: [PHP] redirect using header

2003-03-27 Thread Matt Schroebel


 -Original Message-
 From: David Banning [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 27, 2003 2:15 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] redirect using header
 
 
 I have been trying to do a redirect with header;
 
 HTML
 HEAD
TITLEOptex Staging and Services Inc. /TITLE
 /HEAD
 BODY
 ?php
 header('http://newwebpage.com');
 ?
 H3
 FONT COLOR=#FFStand By For Terminal.../FONT/H3
 
 /BODY
 /HTML

If you want to send output before the re-direct you need to use
javascript.

body
onLoad=setTimeout(location.href='http://mywebdomain.com/index.html',100
00);
This will execute right after the page is completely loaded and move to
the next page after 10 seconds. If javascript is disabled this will not
work, so provide a link in that case to be clicked on.

You can also use the meta tag:

meta http-equiv=refresh content=10; URL=index.php

body
Hello there
/body
Since meta starts counting when page is first accessed (as opposed to
when the page is comepletly loaded), people with slow connection might
not see the message -- depending on how big things are.

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



RE: [PHP] new to PHP

2003-03-06 Thread Matt Schroebel
 From: juan [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 06, 2003 9:36 AM
 Subject: [PHP] new to PHP
 
 New to php and looking to by this book
 PHP For the World Wide Web: A Visual QuickStart Guide
 
 The book says it covers  PHP version 4.04.  
 Will this book be current enough for me

Get something newer ... Something at least at 4.1.2, because of changes
in register_globals and enhancements.

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



RE: [PHP] Process array after form submission problem

2003-02-13 Thread Matt Schroebel


 -Original Message-
 From: Steve Jackson [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, February 13, 2003 2:10 PM
 To: Php-General
 Subject: [PHP] Process array after form submission problem
 
 
 Hi,
 
 My problem is that I have a dynamic form with vars which I 
 want to process.
 
 The variables are checkbox names with a variable number of 
 checkboxes but
 all currently have the same variable name.
 
 ie.
 form action='process.php' method='post'
 input type = text name = user value = name
 input type = checkbox name = grant value = {$array[code]}
 input type = checkbox name = grant value = {$array[code]}
 input type = checkbox name = grant value = {$array[code]}
 
 The array code works fine in that the values reflect what is 
 in the DB.
 
 I understand that $grant will be an array? (am I right?) so 
 how do I use PHP
 to look at $grant as an array in my processing script rather than an
 ordinary variable? I can get the DB to update if there is 
 only one checked
 box but otherwise it updates the DB with the value of the 
 last checkbox.
Add [] to the end of the item name like:
input type = checkbox name = grant[] value = {$array[code]}

?php
$grant = $_POST['grant'];
if (is_array($grant)) {
  echo 'Items checked:br';
  foreach ($grant as $value) {
echo $valuebr;
  }
}

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




RE: [PHP] tracking bulk email

2003-02-04 Thread Matt Schroebel
 -Original Message-
 From: Lowell Allen [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, February 03, 2003 12:38 PM
 To: PHP
 Subject: [PHP] tracking bulk email
 (1) My client is nervous about the script failing mid-list 
 and not being
 able to determine which contacts were sent mail. I need a way 
 to build this
 check into the content management system. I could write a flag to the
 database every time mail() returns true, but that would mean 
 1400 database
 updates! If I instead append to a variable each time through 
 the mail()
 loop, I'll lose the record if the script times out. Can 
 anyone suggest a way
 to record the position in a loop if a time out or failure occurs?

What's wrong with 1,400 database updates?  Seems to me that's the most
straight forward solution, easiest to recover from, easier for someone
following your footsteps to work on later, and is what db's are for..
Have you timed it, and felt pain?  You could email yourself 1,400 times
to test, and see if it hurts.

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




RE: [PHP] How to compare 2 strings

2003-02-03 Thread Matt Schroebel


 -Original Message-
 From: Roman Duriancik [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, February 03, 2003 9:31 AM

 Subject: [PHP] How to compare 2 strings
 

 How to compare 2 strings in PHP
 I hawe 2 array where I have only string values some values in 
 both arrays
 are same but if command don't send me a good result.
 e.g
 
 foreach ($array1 as $a1) {
   foreach($array2 as $a2){
if ($a1 == $a2) echo good;   //never system send me a good result
  else echo bad;
   }
 }

See Strcmp()

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




RE: [PHP] checkboxes and php...

2003-01-31 Thread Matt Schroebel
 -Original Message-
 From: Mr. BuNgL3 [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 31, 2003 8:43 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] checkboxes and php...
 
 
 Hi...
 can you give me some lights in this subject? How checkboxes 
 work with php?
 Or where i can find some info about this? Or both :)
 Ex: if i want to erase from db all data with the checkbox active...

Search the archives ...
http://marc.theaimsgroup.com/?l=php-generalw=2r=1s=checkboxq=b


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




RE: [PHP] HTTP_GET_VARS[]

2003-01-30 Thread Matt Schroebel
 -Original Message-
 From: Mike Tuller [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, January 30, 2003 11:02 AM
 Subject: [PHP] HTTP_GET_VARS[]

 The issue I am 
 having now is that I have the editsoftwareassest.php's form 
 action set 
 to POST to a script called updatesoftwareasset.php that is 
 supposed to 
 take the values from the fields in editsoftwareasset.php and 
 update the 
 information. I have the following statement sent to the database.
 
 $query = UPDATE assets SET title = '$title', version = '$version', 
 developer = '$developer', serial_number = '$serial_number',  WHERE 
 asset_id = '$HTTP_GET_VARS[id]' ;

Change the var to '{$HTTP_POST_VARS['id']}' (with the curly braces since
the array reference is inside a double quoted string.  If your version
of php is 4.1.2 or higher, you really ought to use '{$_POST['id']}'
since it's a magic global and easier to use since you won't have to
declare it global inside functions.
 

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




RE: [PHP] HTTP_GET_VARS[]

2003-01-30 Thread Matt Schroebel
  $query = UPDATE assets SET title = '$title', version = '$version',
  developer = '$developer', serial_number = '$serial_number',  WHERE
  asset_id = '$HTTP_GET_VARS[id]' ;
 
  Change the var to '{$HTTP_POST_VARS['id']}' (with the curly braces 
  since
  the array reference is inside a double quoted string.  If 
 your version
  of php is 4.1.2 or higher, you really ought to use '{$_POST['id']}'
  since it's a magic global and easier to use since you won't have to
  declare it global inside functions.

My bad, I misunderstood what you meant. Yes, you'll need to save the id
from the get, and put it in a hidden field on the form or in a session
var, and use that in the update.  Still, make sure to wrap the array
reference in curly braces inside the double quoted string.

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




RE: [PHP] while loop- will this work?

2003-01-30 Thread Matt Schroebel

 -Original Message-
 From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, January 30, 2003 12:57 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] while loop- will this work?
 
 
 
 
 Should this work?
 
 $f1 = rand(999,999);
 
   while($check_sid = mysql_query(SELECT * FROM 
 that_table WHERE this =
 '$f1')){
 
   $f1 = rand(999,999);
 
 }
 
 
 i.e. put the random number in a loop to check and make sure 
 it is already
 not in use?

If you check the result set for a match.  $result being true will only
mean the sql executed, and not that the value was in the table.  So you
should do a mysql_fetch_row($result) and if it succeeds the row exists
in the table.

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




RE: [PHP] apache webprotect logout

2003-01-27 Thread Matt Schroebel

 -Original Message-
 From: Tommy Jensehaugen [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, January 27, 2003 10:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] apache webprotect logout
 
 When I browse to this folder I get a popup to type my name 
 and password
 in( automatic popup by internet explorer or something ).
 My question is, how do I log out? 

You can't. There is no way to log out of http authentication other then
closing the browser.

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




RE: [PHP] mysql_fetch_row problem

2003-01-23 Thread Matt Schroebel
 -Original Message-
 From: Bryan Brannigan [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, January 23, 2003 9:03 AM
 Subject: [PHP] mysql_fetch_row problem 

 $db = mysql_connect(localhost, webapp);
 mysql_select_db(helpdesk,$db);
 $result = mysql_query(SELECT contactemail FROM loc WHERE ...

Try putting the sql into a var, using that in the mysql_query, and
adding:

if (!$result) {
  echo Sql was: $sqlbr\n;
  echo mysql_error();
}

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




RE: [PHP] Need help.

2003-01-22 Thread Matt Schroebel
 -Original Message-
 From: thkiat [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, January 22, 2003 10:23 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP] Need help.
 
 
 Can someone tell me what should I do to solve this problem?
 
 Warning: mysql_fetch_row(): supplied argument is not a valid 
 MySQL result
 resource in 
 /home/epcc/public_html/exoops/class/database/mysql.php on line
 134

Wherever you're running the query with mysql_query()- you should echo
out the sql statement so you see what you're running, and echo out
mysql_error() to see what mysql doesn't like about it.

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




RE: [PHP] File upload problem

2003-01-21 Thread Matt Schroebel
 -Original Message-
 From: John M [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, June 30, 2003 3:05 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] File upload problem
 
 
 Hello,
 
 I have the code below. It's a simple file upload. But it doesn't work.
 Before the line if(isset( $Submit )) is an echo which can I 
 read. But after
 choosing a file and press a submit nothing happens. Why is if(isset(
 $Submit )) always false? Maybe my apache or php config is wrong?

Shouldn't you be looking at $_POST['Submit'] or do you have
register_globals turned on?

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




RE: [PHP] Header sent polem

2003-01-17 Thread Matt Schroebel
 -Original Message-
 From: Cesar Aracena [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 17, 2003 12:56 PM
 Subject: [PHP] Header sent polem
 
 
 Hi all,
 
 Following Chris's idea on how to handle visitors sessions, 
 I'm trying to
 setup a cookie with a randomly generated session ID but it 
 throws me the
 headers already sent notice but there's nothing above the setcookie
 function. Here's part of my code:
 
 ?
 if (!isset($sessid))
 {
 require_once(PasswordGenerator.php);

Look for white space in the include file ...

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




RE: [PHP] Problem with a for loop...

2003-01-16 Thread Matt Schroebel
 -Original Message-
 From: Davíð Örn Jóhannsson [mailto:[EMAIL PROTECTED]] 
 Sent: 16. janúar 2003 13:59
 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 ...

If you only want the most recent row, why read all of the roww in the table? Why not 
add a auto_increment column, or a timestamp, sorting on that column with a limit of 
0,1?

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




RE: [PHP] Imagecreatefromjpeg()

2003-01-16 Thread Matt Schroebel
 
 ?
 Header(Content-type: image/jpeg);
 $im = ImageCreateFromJpeg('1234_1.jpg');
 ImageJpeg($im);?
 
   The file is in the folder, it has execute and write
 permissions set, and the error given is The image
 cannot be displayed, because it contains errors.,
 which is not very useful.  Anyone have any suggestions?

Comment out the header statement and see if gd tells you anything.

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




RE: [PHP] Windows PHP vs Linux PHP

2003-01-15 Thread Matt Schroebel
 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, January 15, 2003 1:00 PM
 To: Beauford.2002; PHP General
 Subject: Re: [PHP] Windows PHP vs Linux PHP
 
 
 Set your php.ini file and error reporting as such:
 
 error_reporting  =  E_ALL  ~E_NOTICE

Or initialize your variables before using them ...  especially true if
register_globals is on.

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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Matt Schroebel
 -Original Message-
 From: Simon Dedeyne [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 9:03 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Mysql/php database performance question

 So I think I have to reformulate the question: which is 
 better 5 varchar columns of size 50 or 1 varchar column of size 250
 (regardless of parsing).

You ought to read the mysql manual on that.  
http://www.mysql.com/doc/en/MyISAM_table_formats.html

Where's the pain?  The trade off between char and varchar is speed vs
table size.  Are just trying to be as fast as possible?  If the db is
small, I wouldn't worry about it and do what ever way you want (i.e.
what's a microsecond or two?)  You could try both ways and profile it
several thousand times to see if it really matters.

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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Matt Schroebel

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 11:04 AM
 To: Matt Schroebel
 Cc: Simon Dedeyne; [EMAIL PROTECTED]
 Subject: Re: [PHP] Mysql/php database performance question
 

 
 char of greater size than 3 is converted to varchar anyways

Are you sure?  I've been reading up on this stuff over the last few
days, and my understanding is that char is stored fixed width with
trailing spaces padding the string to the length specified in the
schema, whereas varchar is stored is strlen(rtrim(column))+1.  So a
column char(45) will always take 45 bytes of space, while varchar(45)
will vary from 1 to 46 bytes of space.

The first way makes locating a row in the db fast (as long as all
columns are fixed width [No blob, text, or varchar columns]) since it's
simple math, whereas the latter way saves space but makes MYSQLs finding
a row a little harder (since the offset varies) and thus a bit slower.
I have always been using varchar and have been considering changing to
char.

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#CHAR

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




RE: [PHP] Mysql/php database performance question

2003-01-10 Thread Matt Schroebel
 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, January 10, 2003 11:45 AM
 To: Matt Schroebel
 Cc: Simon Dedeyne; [EMAIL PROTECTED]
 Subject: Re: [PHP] Mysql/php database performance question
 
 
 Sure, just tried it (32-bit platform, might be 7 for 64-bits).
 I have a feeling it is somewhere in the manual.

How'd you try it?  

I created a 1 column 42 char record in phpMyAdmin.  Everytime I add a
row, regardless of size the dataspace increases by 42.

With a second table, with 1 column varchar(42), each 4-5 char insert
resulted in 20 bytes of space (must be some minimum overhead), and a
full 42 resulted in 44 bytes of dataspace used.

I'm curious here, as it seems the trade off is speed of access with char
[and the overhead of removing trailing spaces on each retrieval] vs
storage size in varchar [and it's improved strip right spaces on storage
only happening once].  That's what the man page I pointed to last time
said.  There are some examples of truncating data to 4 bytes on that
page but no mention of storing char as varchar.  


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




RE: [PHP] Undefined index a different problem

2003-01-07 Thread Matt Schroebel
Try:
echo($GLOBALS[$i]);

Or
echo {$GLOBALS[$i]};

This times it's the array in the double quoted strings ...

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




RE: [PHP] Information Retrieval.. help

2002-11-05 Thread Matt Schroebel
Why don't you use full text search, which creates a score?

Two tutorials:
http://www.mysql.com/doc/en/Fulltext_Search.html
http://www.zend.com/zend/tut/tutorial-ferrara1.php

The match words need to be at least 3 characters in length or you'll get
no results.

 -Original Message-
 From: Kevin Stone [mailto:kevin;helpelf.com] 
 Sent: Tuesday, November 05, 2002 2:44 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Information Retrieval.. help
 
 
 Hey list!  I have written several simple search scripts to 
 retrieve basic data.. that is to say I wasn't worried about 
 the actual relevancy of what I was retrieving.  Now I need to 
 write a search script that retrieves information based on the 
 search terms in order of relevancy.  It doesn't have to 
 feature boolean operations but it does have to be fast and 
 flexible.  This is what I have so far.
 
 The database contains:
 ID   Description
 --   
 1   jade gold ring
 2   grandmas golden ring with leaves
 3   silver and gold diamond bracelet
 
 The user enters the search string:
 ring gold leaves
 
 I split the string into words and query them separately:
 SELECT ID FROM jewlry WHERE description LIKE \%ring%\
 returns 1,2
 SELECT ID FROM jewlry WHERE description LIKE \%gold%\
 returns 1,2,3
 SELECT ID FROM jewlry WHERE description LIKE \%leaves%\  returns 2
 
 Then I combine the results into one array and use 
 arraycountvalues() to eliminate redundencies and count the 
 number of occurances of each row.  The number of occurances 
 of a row should be equal to its relevancy so I sort the array 
 by value:
 array (
 2 = 3,
 1 = 2,
 3 = 1);
 
 Hopefully that wasn't too hard to follow.  I as examine my 
 code I get the distinct impression that this is an 
 extraordinarily Primative method.  :)  If so do you have any 
 suggestions for improving it or can you please point me to 
 resources (tutorials, books, websites, etc..) that would help 
 me develope more a sophisticated technique?
 
 Much appreciated!
 Kevin Stone
 [EMAIL PROTECTED]
 
 

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




RE: [PHP] Packaging files for download

2002-10-24 Thread Matt Schroebel
Look at the user notes on the man page for zip
http://www.php.net/manual/en/ref.zip.php, there are several solutions
there

 -Original Message-
 From: Brent Baisley [mailto:brent;landover.com] 
 Sent: Thursday, October 24, 2002 10:30 AM
 To: php-gen
 Subject: [PHP] Packaging files for download
 
 
 Can anyone point me in the right direction for packaging multiple 
 files together for a single download? Something like tar and 
 gzip combo 
 is what I'm looking for, but I need something that wouldn't work on 
 multiple platforms (Windows, Mac 8,9,X). Something like 
 creating a zip 
 file would be ideal, but I haven't found anything can do this.

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




RE: [PHP] Setting date fields in mysql queries

2002-10-02 Thread Matt Schroebel

 From: Brad Harriger [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, October 02, 2002 3:17 PM
 Subject: [PHP] Setting date fields in mysql queries
 
 
 I have the following line in a program I'm working on:
 
 $query = UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id
 
 $ndate is a properly formated date read from a text field on 
 a form on 
 the previous page.  When I run the query using mysql_query, 
 it returns 
 TRUE each time, but the field is not updated.  The only explanation I 
 can think of is that there is something wrong with the date 
 value.  I've 
 echoed it to the screen and it looks fine, but the query 
 still doesn't 
 work.  Any suggestions?

When you say it looks fine, are you meaning it looks like 2002-10-02?

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




RE: [PHP] freetype - could not open font problem

2002-09-24 Thread Matt Schroebel

 From: andy [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, September 24, 2002 7:29 AM
 Subject: [PHP] freetype - could not open font problem
 
 I am trying to use freetype, but do always get the message
 
 Warning: Could not find/open font in test.php on line 18
 
 The font is available and ok. I double checked it.
 
 What could cause this error exept of the given reason? I am 
 trapped ;-)
 
 Thanx for any help on that.
 
 Andy

When I've done this, I put the ttfs in /usr/local/fonts/ttf
Then I defined a const for the dir,
define('FONTDIR','/usr/local/font/ttf/') 
And used concat to build the absolute path:
$font = FONTDIR . 'arial.ttf';
You can uses file_exists() to make sure it's not a permissions problem

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




RE: [PHP] Jpeg resize quality problem

2002-09-24 Thread Matt Schroebel


 -Original Message-
 From: Michael F. [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, September 24, 2002 12:09 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Jpeg resize quality problem
 
 
 Hello,
 
 I have a php script which resizes a jpeg file.  I use 
 ImageCopyResized and
 ImageJPEG function. But the result picture quality is not 
 enough good. I use
 ImageJPEG with quality = 90 but the picture is not as nice as 
 a picture I
 made with AcdSee and 65%.
 Is it normal?
 
 Thanks!

See http://www.php.net/manual/en/function.imagecopyresampled.php it uses
a different method to re-size/sample images.

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




RE: [PHP] Re: Displaying PDF file

2002-09-12 Thread Matt Schroebel

 -Original Message-
 From: Erwin [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, September 12, 2002 11:02 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Displaying PDF file
 
 
 Joseph Szobody wrote:
  Thanks Erwin, that helps but I'm still not getting it to work.
  Should I still use the  
  
  Header(Content-type: application/pdf);
  
  line?
  
  I tried using readfile() keeping the header. When I click 
 the link to
  the PHP script that should show me the PDF, the IE status bar says
  something like Downloading from site .blah, then says Done.
  Nothing happens. I'm still on the previous page. No error, no pdf
  file... nothing.

Send these three headers:
header('Content-type: application/pdf'); 
header(Content-Disposition: inline; filename=$file);
header(Content-Length: $length);

You need to send the length of the document, so use filesize() to get it.

Also, if you had an error in the script, close the browser window and then re-open it 
and browse to the page again.

Lastly, IE changes a POST request to a GET request on a pdf document, so you can't hit 
refresh on the POSTed to page.  If that's what you're going, you might want to 
consider changing the POST to a GET ...

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




RE: [PHP] help with installation

2002-09-09 Thread Matt Schroebel

 From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, September 09, 2002 10:32 AM
 Subject: [PHP] help with installation
 
 Sure I'm missing some thing silly here but its monday morning :)
 I have just installed php 4.2.3 with apache 1.3.26.
 I have all loadmodule/addmodule as well as AddType x-httpd-php .php

Isn't it:
Addtype application/x-httpd-php .php


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




RE: [PHP] PHP Source files

2002-09-09 Thread Matt Schroebel

 From: OrangeHairedBoy [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, September 09, 2002 12:41 PM
 Subject: [PHP] PHP Source files
 
 I'm wondering if anyone knows where I can find information 
 about how PHP
 parser processes commands like:
 
 $a=$b+$c;
 if ($b  $a) {}
 
 (Ones with operators)
 
 I've downloaded the source code, but I'm having much luck 
 narrowing down my
 search. Can anyone help me??

http://www.php.net/manual/en/language.operators.php

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




RE: [PHP] PHP_AUTH_USER

2002-08-30 Thread Matt Schroebel

 From: Hendråwan Rinäldi [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, August 30, 2002 5:44 AM
 Subject: [PHP] PHP_AUTH_USER
 
 anyone can help me what is the script for log out
 
 WWW-authenticate

You can't log out of http authentication.  Close the browser is it.  Not very secure, 
eh.  Use a session based login method if you need logout function.

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




RE: [PHP] PHP_AUTH_USER

2002-08-30 Thread Matt Schroebel

 From: Stas Maximov [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, August 30, 2002 8:02 AM
 To: Matt Schroebel
 Cc: PHP General
 Subject: Re: [PHP] PHP_AUTH_USER
 
 
  You can't log out of http authentication.  Close the 
 browser is it.  Not
 very secure, eh.  Use a session based login method  if you 
 need logout
 function.
 
 Why not? Sending this to the client should do the job:
 
 header('WWW-Authenticate: Basic realm=My Realm');
 header('HTTP/1.0 401 Unauthorized');
That doesn't work for me, at least in IE 6.  It pops up a new login window.  If you 
hit cancel, the browser still sends the prior authorization header to the server on 
the next request.  If you change the realm on one page, when you go back to the other 
page, the browser will still have the other realms authorization header.  Thinking as 
I type, perhaps you mean to store the realm, and change it to something else when they 
logout?  Such that one never sees the same realm twice. 

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




RE: [PHP] Stepping through an array more than once

2002-08-28 Thread Matt Schroebel

 From: Petre Agenbag [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, August 28, 2002 8:17 AM
 To: Petre Agenbag
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Stepping through an array more than once
 
 
 Actually, it's not accurate for me to say stepping through an array
 more than once, as I want to step through the database ( 
 $result) more
 than once, without having to make connections to the db again.
 Can this be done?

Yes, see mysql_data_seek()

http://www.php.net/manual/en/function.mysql-data-seek.php

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




[PHP] PDF POST, but refresh is GET

2002-08-28 Thread Matt Schroebel

I have a page the will print a telephone listing in pdf (using pdflib and inline pdf) 
by POSTing the requested orientation and papersize to a second page. I've found that I 
have to post to a second page because IE seems to cache a response, and if I post to 
the same page, I can never get the html to render again, as IE I suppose, is expecting 
PDF, and I was sending html.  

Anyway, this 2 page method works fine, but if I hit refresh on the window showing the 
PDF doc (like I do when change fonts and want to see the change), the document 
reformats to the default values I have for orientation and papersize.  

Now, IE pops up the window that says the data must be resent, so IE knows to post it, 
but in sniffing, I see that the request is now a GET, and there is no form data being 
sent.

Experimenting around, I added some foreach statements at the top and bottom of the 
page, submitted it from the first page, and when I do that (and my headers aren't 
sent), I can see the posted data, and the refresh stays as a POST.  But, it I take out 
the foreach, send the headers, and the pdf; refresh becomes a GET, and I loose the 
users requested orientation.

Any ideas?

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




RE: [PHP] PDF POST, but refresh is GET

2002-08-28 Thread Matt Schroebel

GET solved it.

 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, August 28, 2002 2:44 PM
 To: Matt Schroebel
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] PDF POST, but refresh is GET
 
 
 Sounds like an IE bug to me.  If it knows there is POST data 
 and it sends
 a GET, it is just plain wrong.  How about just using 
 GET-method vars in
 the URL to bounce this stuff along, or even a cookie-based session.
 
 -Rasmus
 
 On Wed, 28 Aug 2002, Matt Schroebel wrote:
 
  I have a page the will print a telephone listing in pdf 
 (using pdflib and inline pdf) by POSTing the requested 
 orientation and papersize to a second page. I've found that I 
 have to post to a second page because IE seems to cache a 
 response, and if I post to the same page, I can never get the 
 html to render again, as IE I suppose, is expecting PDF, and 
 I was sending html.
 
  Anyway, this 2 page method works fine, but if I hit refresh 
 on the window showing the PDF doc (like I do when change 
 fonts and want to see the change), the document reformats to 
 the default values I have for orientation and papersize.
 
  Now, IE pops up the window that says the data must be 
 resent, so IE knows to post it, but in sniffing, I see that 
 the request is now a GET, and there is no form data being sent.
 
  Experimenting around, I added some foreach statements at 
 the top and bottom of the page, submitted it from the first 
 page, and when I do that (and my headers aren't sent), I can 
 see the posted data, and the refresh stays as a POST.  But, 
 it I take out the foreach, send the headers, and the pdf; 
 refresh becomes a GET, and I loose the users requested orientation.
 
  Any ideas?
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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




RE: [PHP] Re: Tricky question - referrer from ousite, or from intern?

2002-08-27 Thread Matt Schroebel

  However.. you think it might be not sure that this workes 
 for every browser?
  PUh... thats bad. Do u have examples for that? It workes 
 with IE on PC.

Well, the HTTP 1.1 spec says it shouldn't be set when it's typed into the address 
line.  That happens often enough that it can't be relied on.

Try it:
HTML
BODY
?php
echo Referrer: {$_SERVER['HTTP_REFERER']}br;  //note misspeled HTTP_REFERER
?
p
a href=?php echo $_SERVER['PHP_SELF'] ?Link to this page/a
/p
/body
/html

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




RE: [PHP] flaking out on foreach

2002-08-27 Thread Matt Schroebel

 From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, August 27, 2002 11:08 AM
 Subject: [PHP] flaking out on foreach
 
 
 Why is this code:
 
 ?php
   
   $bob=array(1,2,3,5,6);
   
   foreach($bob as $foo);

^^^
Because of the empty statement caused by the mistaken semi-colon here

   {
   echo $fooBR;
   }
   ?
 
 Rendering only 6.  That's it.  Just 6.  What am I missing here?

 

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




RE: [PHP] check unread messages in a forum

2002-08-26 Thread Matt Schroebel

 From: Charlotte [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, August 26, 2002 8:04 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] check unread messages in a forum
 
 
 I have made a forum in PHP, and the users are logged in using 
 cookies. I
 want all new threads (and if there are new replies in an old 
 thread) to be
 highlight or something like that.
 
 How do I check if a user has read a message or not?

I'd say you'd need to keep a list of messages read by users somewhere.

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




RE: [PHP] strange error message when trying to start apache

2002-08-26 Thread Matt Schroebel

 From: Jesse Lawrence [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, August 26, 2002 9:36 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] strange error message when trying to start apache

 Everything appeared to go smoothly, except when
 I try to start up Apache, I get the following error
 message:
 
 Syntax error on line 205 of
 /usr/local/apache/conf/httpd.conf:
 API module structure `php4_module' in file
 /usr/local/apache/libexec/libphp4.so is garbled
 -perhaps this is not an Apache module DSO?
 /usr/local/apache/bin/apachectl start: httpd could not
 be started

Take a look here:
http://www.onlamp.com/pub/a/php/2001/03/15/php_admin.html


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




[PHP] Calendar logic question

2002-08-21 Thread Matt Schroebel

I have a calendar application that shows events in a month.  I want to add the ability 
to have re-occuring events.  I've been thinking about how to do that, but it's not 
seeming to be too easy.  

Say, I have a table of re-occuring events:
eventId int
eventName varchar
eventStartDate date
eventEndDate date
eventOccuranceType enum(weekly, monthly, daily)
eventInterval int
eventDOW int

Should I populate the actual events table with re-occuring events at 
insert/update/delete times, or should I code the event listing page to determine if 
there are events that would occur in the month shown? The first way would be costly at 
insert time, and may add lots of events that will never occur -- plus one can't go on 
forever, so at some point, it seems, it would have to do the second way anyway.   The 
second way, is costly at page view time.  With a small number of re-occurring events, 
that probably wouldn't be an issue, but as the calendar usage grows, I can see that 
becoming resource costly.  

Is there a better way?

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




RE: [PHP] Array query - finding the key for a value

2002-08-16 Thread Matt Schroebel

 From: Tim Fountain [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, August 16, 2002 7:51 AM
 Subject: [PHP] Array query - finding the key for a value
 
 This may be a silly question, but I'm used to being able to find PHP
 functions to do whatever I want, but I can't find one to do this!
 
 If I have an array like this:
 
 [0] - 'apple';
 [1] - 'pear';
 [2] - 'orange';
 [3] - 'apricot';
 
 I know I can use in_array() to check whether, say, 'orange' is in the
 array; but how do I then find out which index 'orange' is at?

http://www.php.net/manual/en/function.array-search.php

Note that it will return 0 if the value is in the first element of the array so use ( 
=== ) to determine if it's a key or really not found.

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




RE: [PHP] How to show data in one row from two rows from the database

2002-08-15 Thread Matt Schroebel

 From: Ing. Rajesh Kumar [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 15, 2002 9:36 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] How to show data in one row from two rows from 
 the database
 
 
 Hi everybody
 What I wrote in the subject may look complicated so I added a 
 html file. It
 explains what I have and what I want to show.
 
 Thanks in advance
Something like:

$sql = Select DISTINCT COUNTRY from tariffs;
$result=mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
  echo Rates for {$row['COUNTRY']}br\n;
  $sql = select DISTINCT GROUP from tariffs where COUNTRY='{$row['COUNTRY']}' order 
by GROUP;
  $result2=mysql_query($sql) or die(mysql_error();
  while ($row2 = mysql_fetch_array($result)) {
$sql = select TIME,TARIFF from tariffs where COUNTRY='{$row['COUNTRY']}' and 
GROUP='{$row2['GROUP']}' order by TIME DESC;
$result3=mysql_query($sql) or die(mysql_error();
$peak ='nbsp';
$offpeak = 'nbsp;';
while ($row3 = mysql_fetch_array($result3)) {
  switch (strtoupper($row3['TIME'])) {
 'PEAK': $peak = $row3['TARIFF'];
break;
 'OFFPEAK': $offpeak = $row3['TARIFF'];
   break;
  }
}
echo {$row2['GROUP']} {$row3['TIME']} {$row3['TARIFF']}br\n;
  }

}

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




RE: [PHP] include opens source, but it shouldn't

2002-08-15 Thread Matt Schroebel

 From: Jay Blanchard [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 15, 2002 1:19 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] include opens source, but it shouldn't
 
 
 [snip]
 Only on demand.
 I'd like to define the variable without showing the file
 
 
 $var=include();
 
 do something else
 
 echo $var;
 [/snip]

Harold, is this what you're looking for:

$var = readf('file.html');

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




RE: [PHP] Problem with Testing if the user has an account in my database

2002-08-15 Thread Matt Schroebel

 From: Sebastian Marcu [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 15, 2002 2:32 PM
 Subject: [PHP] Problem with Testing if the user has an 
 account in my database
 
 
 For some reason though it isn't working right and
 keeps telling me that the 'Email' address is already
 taken even though this entry is non-existant in the
 database.
 
 What am I doing wrong with my code below? Is there a
 better way to check if the email address is already
 contained in the database?
 
 ___
 
 require (config.inc.php);
 
 $db = mysql_connect($dbserver,$nutzer,$passwort);
 
 $myData = mysql_db_query($dbname,SELECT * FROM
 learningZoneCustomer WHERE Email='$rEmail');

Make sure you either addslashes or config magic_quotes_gpc and do 
some validation on this tainted user data field $rEmail.  

 
 if ($myData  0)

$myData will always be true as long as the sql is valid.  Use mysq_num_rows()
To see if there was a hit.

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




RE: [PHP] Can anyone help me out? I am really getting frustrated!

2002-08-15 Thread Matt Schroebel



 -Original Message-
 From: Mike [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 15, 2002 2:46 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Can anyone help me out? I am really getting frustrated!
 
 
 Hello all,
 I am very confused. This script that I have been working on 
 for a while
 is giving me a hard time...
 
 $string = Current song: 01. DJ Nightflight - The first 
 flight (original
 \
 mix) (D I G I T A L L Y - I M P O R T E D - European Trance, Techno,
 Hi-\
 NRG... we can't define it!);
 
 if(substr($string,0,1) = C){

You're assigning, not comparing here.
Should be:
  if(substr($string,0,1) == C){

If you write these like this:
  if(C = substr($string,0,1)) {

Php will give a parse error because you can't assign a value to a constant.

   print made it past substr!br\n;
   $TrackName = trim(substr($string,strpos($string,.)+1));
 }
 

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




RE: [PHP] addslashes() and stripslashes()

2002-08-14 Thread Matt Schroebel

 -Original Message-
 From: ed [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, August 14, 2002 1:48 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] addslashes() and stripslashes()
 
 
 Is it a good idea to always use addslashes() on a 
 value gathered from a text field or textarea?

Yes, always.

 If you use addslashes() to INSERT the stuff into a
 db, should you always use stripslashes() when you
 SELECT it from the database?

No, the slashes are there for so the SQL engine can separate the data from the sql 
statement.  What's inserted or updates is the pre-addslashes value. Generally, if you 
don't addslashes() the sql statement won't execute.

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




RE: [PHP] Creating a zip file using php

2002-08-13 Thread Matt Schroebel

 From: Rahul [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, August 13, 2002 8:41 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Creating a zip file using php
 
 
 Hi
 
 I want to create a zip file using php. Can this be done?
 
 If anybody has a code snippet, for this, or any guidelines, 
 please send it
 to me.

Try reading the manual about zip files, especially the user notes.

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




RE: [PHP] Can I assign to $_POST legitimately

2002-08-09 Thread Matt Schroebel

 From: Henry [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, August 09, 2002 6:00 AM
 Subject: [PHP] Can I assign to $_POST legitimately
 I can do it but is it legit?
 
 $_POST['name']='henry';
 
 within a php script?
 
 if $_POST['name'] is not set. The clearly $_POST['name'] was 
 not posted!!

Yes, you can do that.  But I wouldn't do it because it's 'tainting' php supplied 
variables.  Once you do that, you won't really be sure if a variable was posted or 
supplied by your script.  It's probably more important for the person who follows in 
your footsteps and modifies the scripts -- as they may assume it's posted from a form, 
and yet isn't.  Could cause a lot of confusion, not for you, but for, perhaps, me.  If 
you do it though, you might be nice to the next guy/gal and put a nice note at the top 
of the script saying you're doing it.

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




RE: [PHP] Linux PHP editor

2002-08-09 Thread Matt Schroebel

 Here's some Linux ones that satisfy this requirement:
 
 1.  Zend IDE:  Nice, but $$$ is the big inhibiting factor.
 
 There's a Zend Studio for-non-commercial use version available for 
 free.  It's based on version 2.0 of the product, fully functional.

I would have to say that Zend Studio is tops, and worth the money (if you got it).  
Lots of cool features that make coding easier like curly brace matching, f1 help to 
the manual, debugging, function parameters and types show as you type them (even user 
defined functions if the file is opened) etc.

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




RE: [PHP] Protect PHP coding

2002-08-02 Thread Matt Schroebel

 From: YC Nyon [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 01, 2002 12:59 PM
 Subject: [PHP] Protect PHP coding

There is the PHP Obfuscator/Obscurer: http://pobs.mywalhalla.net/

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




RE: [PHP] Readdir

2002-08-01 Thread Matt Schroebel

 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 01, 2002 2:54 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Readdir
 
 New To Php so please bear with me... :)
 
 I used the readdir function to read the files listed on a 
 Apache server. And
 it worked fine. Now I would like to be able to get the files 
 the php code
 returns, to be links. Where the user can click the file and 
 download it. Also
 for the files to sit within a table or at least look neat on the page.
 http://www.optimus7.com/findme.php is the result I get from 
 the php code
 below. Help!
 
 ?php
 if ($handle = opendir('/my/directory')) {
 echo Directory handle: $handle\n;
 echo Files:\n;
 
 
 
 while (false !== ($file = readdir($handle))) { 
 echo $file\n;
 }
 
   
 closedir($handle); 
 }
 ?

Change your echo stmt to something like:

echo a href=\$file\$file/abr\n;

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




RE: [PHP] Help Please

2002-07-29 Thread Matt Schroebel

 -Original Message-
 From: Varsha Agarwal [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 29, 2002 4:27 PM
 To: Dennis Moore; [EMAIL PROTECTED]
 Subject: Re: [PHP] Help Please
 
 
 Hi,
 I did not find any print or echo stetement in the
 sample example before hearder or setcookie function.
 Is there any way to find out what really is causing
 error or trace the program. Actually i am very new to
 this cookies and all stuff. Is there any way of
 tracing the program? I am using it on red hat 7.3.

Read the message php sent.  The answer is there (line 63):

|||
vvv

Warning: Cannot add header information - headers
already sent by (output started at
var/www/html/processing.php:5) in
/var/www/html/common.php on line 63

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




RE: [PHP] 'Previous' 1, 2, 3, 4, etc. 'Next'

2002-07-25 Thread Matt Schroebel

 -Original Message-
 From: ctan [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, July 25, 2002 11:24 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] 'Previous' 1, 2, 3, 4, etc. 'Next'
 
 
 I seem to have a problem getting the page to display beyond 
 the limit if a
 page, i.e. if the limit if 10 rows in a page I'll only get 
 the 1st ten rows
 and then a link to further rows but when I chick on them they give me
 nothing. Here's the code:
 
 
 $searchword = $_POST['searchword'];
 print Your word(s) is/are: b$searchword/bp\n\n;
 
 // Searching by keyword
 if (! empty($searchword )){ 
$max = 0;
$query = SELECT aml FROM arguments WHERE aml LIKE 
 '%$searchword%';
$result1 = mysql_query($query)
   or die (Query failed);
 
 // Determine the number of items containing the $searchword   
while ($line1 = mysql_fetch_array($result1)){
$max++;
}  


This could just be:
$max = mysql_num_rows($result1); 
---
 
 
 // The number of results to be displayed on screen
 $maxresult = 10; 
 
 $sql_text = SELECT aml FROM arguments WHERE aml LIKE 
 '%$searchword%';
 
 // When the current page is yet to be determined
 if (!$page) { 
$page = 1;
} 

^^^
Do you have register_globals on or should you be setting  
$page = $_GET['page'] here?


 
 $backpage = $page - 1;
 $nextpage = $page + 1;
 $result2 = mysql_query($sql_text);
 $start = ($maxresult * $page) - $maxresult; 
 $num_rows = mysql_num_rows($result2); 
 
 // When the query returns less or equal number of rows than 
 the limit set by
 $maxresult
 if ($num_rows = $maxresult) {
$num_pages = 1; 
} 
 
 // When the query returns the exact limit set by $maxresult
 else if (($num_rows % $maxresult) == 0) {
$num_pages = ($num_rows / $maxresult);

^
You could simplify this here with
$num_pages = ceil(($num_rows / $maxresult));
And get rid of the else below
--

} 
 
 // For any other cases...
 else {
$num_pages = ($num_rows / $maxresult) + 1;
} 
 
 // Declared as an integer
 $num_pages = (int) $num_pages;
 
 // The current page is greater than the total number of pages or 
 // the current page is less than 0
 if (($page  $num_pages) || ($page  0)) {
error(You have specified an invalid page number);
}
 
 // Set the limit per page   
 $sql_text = $sql_text .  LIMIT $start, $maxresult;
 $result2 = mysql_query($sql_text);
 
 // The navigation between pages
 // Ensure only display when total number of return results exceeds
 $maxresult
 // i.e. will not display if only 1 page
 if ($max$maxresult){
print center- ;
if ($backpage) { 
print a
 href=\$PHP_SELF?searchword=$searchwordpage=$backpage\Prev/a;
} 
 
 // If its the first page; have 'Prev' un-clickable
 else {
print Prev;
}
 
 for ($i = 1; $i = $num_pages; $i++) {
if ($i != $page) { 
   
   print  a 
 href=\$PHP_SELF?searchword=$searchwordpage=$i\$i/a ;
} 
else { 
   print  $i ; 
} 
 }
 
 if ($page != $num_pages) {
print a
 href=\$PHP_SELF?searchword=$searchwordpage=$nextpage\Next/a -;
} 
 else {
print Next -;
}
print /center;
 }
 
 print table border=\1\th BGCOLOR=\#ff\Results/th;
 while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) {
   print \ttr BGCOLOR=\#80\\n;
   // The different color, in this case 
 light blue will
 show that
   //the particular table belong to search by
 keywords
 foreach ($line as$col_value) {
   print 
 \t\ttd$col_value/td\n;
   }
   print \t/tr\n;
 }
 
 
 }
 

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




RE: [PHP] New way to make select boxes auto select

2002-07-25 Thread Matt Schroebel

 From: Nathan Cook [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, July 25, 2002 12:34 PM
 Subject: [PHP] New way to make select boxes auto select
 
 
 You may already be doing it like this, but I think I found a 
 new way to
 make select boxes auto-select (what data they put in) a lot 
 easier. All you
 have to do is put a variable in each select tag that is equal 
 to the value
 of the select option i.e.: option value=teacher $teacher -- 
 then all you
 have to do is base the variable on that select 
 name=interest $$interest =
 selected; quick and easy with out having to loop through an 
 if elseif
 statement.  Let me know if you like that method or have any 
 objections.

I use these functions which do something similar.  The first function accepts an array 
of names for the option, and returns a string of all of the options but not the 
select tags.  The ones to be selected have a value of 'selected'.  The second 
function accepts a code table, of say states or provinces, and a value that is to be 
selected, and returns the options.  Both are only for single selected values, but 
could be easily extended.  
Usage:

// 
---
// buildSelect -- return a Select box named $selectName based on key value array 
$selectArray
//select name=states
// ?php
// $arr = array('MD'='selected','DC'='','VA'='');
// echo buildSelect($arr);
// ?
// /select
// 
---
function buildSelect($selectArray) {
$str = '';
$count = count($selectArray);
for ($i=0;$i$count;++$i) {
list($key,$selected) = each($selectArray[$i]);
$selectValue = htmlspecialchars($key);
$str .= option value=\$selectValue\ $selected$key/option\n;
}
return($str);
}
// 
---
// setupSelect -- Read table $table from database $db, load all values of $field, and 
build 
//a select box from this list named $selName
// select name=states
// ?php
// echo setupSelect($db,'states','stateAbbr','stateName','MD');
// ?
// /select
// 
---
function setupSelect($db,$table,$field,$orderBy,$value) {
$sql = SELECT  . $field .  from  . $table;
if (empty($orderBy)) {
$orderBy = $field;
}
$sql .=  order by  . $orderBy;
$result = mysql_query($sql,$db) or 
die(log_mysql_error($sql,__FILE__,__LINE__));
while ($row = mysql_fetch_array($result)) {
$columnData = $row[$field];
if (!empty($columnData)) {
$selected = ($columnData == $value ? selected : );
$selArray[] = array($columnData = $selected);
}
}
if (count($selArray) != 0) {
return(buildSelect($selArray));
}
}
// -
// logs to syslog define the constant DISPLAY_MYSQL_ERRORS as 1 
// if you want to see errors in browser too
// usage: $result = mysql_query($sql,$db) 
//  or die(log_mysql_error($sql,__FILE__,__LINE__));
// -
function log_mysql_error($sql='',$file='',$line=0) {
$msg={$_SERVER['PHP_SELF']}: (FILE=$file) (LINE=$line)\n;
$msg .= MySQL Says:  . mysql_error() . \n;
if (!empty($sql)) {
$msg .= SQL Statement was: $sql;
  }
error_log($msg,0);
if (1 == DISPLAY_MYSQL_ERRORS) {
$msg=nl2br($msg);
echo br$msgbr\n;
}
exit;
}

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




RE: [PHP] New way to make select boxes auto select

2002-07-25 Thread Matt Schroebel

 From: Nathan Cook [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, July 25, 2002 2:52 PM
 Subject: Re: [PHP] New way to make select boxes auto select

 How are you able to quickly and painlessly determine which 
 key gets the
 selected value, from form submission data, when building the 
 initial array?

Via the selected name, say, $POST['location']. I usually use the db code table method 
and something like:
echo setupSelect($db,locations,LocName,LocName,$_POST['location']);

If you were using hard coded values like Active, Inactive,etc you can just do a:
$status = array('Active','Inactive');
$status[$_POST['status']] = 'selected;
echo buildSelect($status);

It doesn't handle multi selects and it's resulting arrays, but that should be too hard 
to do by checking if the selected value is an array  modify the comparison in that 
case.

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




RE: [PHP] Running ./configure multiple times

2002-07-24 Thread Matt Schroebel

 From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, July 24, 2002 2:53 PM
 Subject: Re: [PHP] Running ./configure multiple times
 
 Yes, it is pretty safe to run ./configure more than once.  
 The 1st time, it
 create the config.cache and so on.  The 2nd time, it use the 
 config.cache
 and other stuffs instead of starting from scratch.  To redo 
 everything from  scratch.  I believe one of those config.* files need to be 
 removed so you  can start again from scratch, not sure which files that need 
 to be delete.

I always 
rm config.cache 
before rebuilding with new options so the configure script will pick up the right 
libraries and new options.

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




RE: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0

2002-07-23 Thread Matt Schroebel

 From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, July 23, 2002 12:43 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: PHP Security Advisory: Vulnerability 
 in PHP versions 4.2.0
 
 
 I don't know how to appy patches to the PHP software.  I just finish
 upgrading the website to work with PHP 4.2.1 from PHP 4.0.6.  And now
 this  So, just patched it then configure openssl, 
 mycrypt, curl, modssl
 then do the usual stuff for PHP then apache, right??

Rebuilding from source:
1. download the new php source, extract it to whereever you do. 
2. cd to php-4.2.2 copy config.nice from your existing php compile dir (this has your 
previous complies config command).  
3. Run it:
./config.nice
4. make
5. apachectl stop
6. make install
7a. i. If php is a DSO:
ii. apachectl start (you're done)
7b. i. If php is compiled into apache:
ii. cd to apache compile dir
iii. make clean
iv. ./config.status
v.  make 
vi. make install
vii. apachectl start (you're done)

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




RE: [PHP] Newbie getting close, form submission

2002-07-22 Thread Matt Schroebel

 From: Dean Ouellette [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 9:43 AM
 Subject: [PHP] Newbie getting close, form submission
 I am a complete newbie, search the web for examples right now and use
 them.
  
 The host has php 3.0.  
  ^
That's really old, you really ought to be using 4.2.x

  
 Having problems with for submission
 Right now, no error messages, but does not actually send the email.
 Ideas?
  
 ?
 $MailToAddress = [EMAIL PROTECTED];
 $MailSubject = Get Involved List;
 if (!$MailFromAddress) 
 {
 $MailFromAddress = $email;
 }
 $Header = ;
 $Footer = ;
 ?
  
 ?
 if (!is_array($HTTP_POST_VARS))
 return;
 reset($HTTP_POST_VARS);
 while(list($key, $val) = each($HTTP_POST_VARS)) 
 {
 $GLOBALS[$key] = $val;
 $val=stripslashes($val);
 $Message .= $key = $val\n;
 }
 if ($Header) 
 {
 $Message = $Header.\n\n.$Message;
 }
 if ($Footer) 
 {
 $Message .= \n\n.$Footer;  // could put $Footer inside double quotes, vars 
expand then
 }
  
 mail( $MailToAddress, $MailSubject, $Message, From: // no need to quote these
 $MailFromAddress);
  
 ?

There's no need to be doing all of the array manipulation.  Just use the variables in 
the array. Also turn off magic_quotes_gpc in a .htaccess file so that you don't have 
to strip slashes.

?php
If ('GET' == $HTTP_SERVER_VARS['REQUEST_METHOD']) {
  $MailToAddress = '[EMAIL PROTECTED]';
  $MailSubject = 'Get Involved List';
?
form here
?php
  exit;
}
?

? 
If ('POST' == $HTTP_SERVER_VARS['REQUEST_METHOD']) {
  if (isset($HTTP_POST_VARS['email'])) {
$MailFromAddress = $HTTP_POST_VARS['email'];  // I'm assuming the vars were posted 
from a form
  } else {
$MailFromAddress = '[EMAIL PROTECTED]';  // vars don't expand in single quotes, but 
we don't have any here.
  }
  
  $Message = $HTTP_POST_VARS['Message']; // should single quote associative array 
indexes
  if (isset($HTTP_POST_VARS['Header'])) {
 $Message = {$HTTP_POST_VARS['Header']}\n\n$Message;  // need to wrap arrays in 
double quotes in {} to parse
  }
 
  if (isset($HTTP_POST_VARS['Footer'])) {
$Message .= \n\n{$HTTP_POST_VARS['Footer']}; 
  }
 
  mail($MailToAddress,$MailSubject,$Message,$MailFromAddress); // don't have to quote 
vars on parms
 }
?

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




RE: [PHP] Newbie getting close, form submission

2002-07-22 Thread Matt Schroebel

 From: Dean Ouellette [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 10:56 AM
 Subject: RE: [PHP] Newbie getting close, form submission
 
 $Message = $HTTP_POST_VARS['Message']; // should single quote
 associative array indexes
   if (isset($HTTP_POST_VARS['Header'])) {
 This is 78 $Message = 
 {$HTTP_POST_VARS['Header']}\n\n$Message;

Oops, PHP 3.0 may need:
$Message = $HTTP_POST_VARS['Header'] . \n\n$Message;
   }

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




RE: [PHP] dbf Help

2002-07-22 Thread Matt Schroebel

 From: Vinod Palan [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 1:41 PM
 Subject: [PHP] dbf Help 

 I have already php installed on linux running with mysql enabled.
 Now I wanted to read dbf files and I came to know that we 
 need to install
 php with
 
 **
 Installation
 In order to use these functions, you must compile PHP with
 the --enable-dbase option.
 **
 
 Does this means I have to uninstall my existing php and 
 reinstall as above ?
 
 Can I keep my existing setting and have dbf function install without
 reinstalling whole php?

Your previous compile options are in config.nice so you can simply:
./config.nice --enable-dbase-functions
make
stop apache
make install
start apache

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




RE: [PHP] stores / ecommerce

2002-07-22 Thread Matt Schroebel

 -Original Message-
 From: Chris Edwards [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 1:11 PM
 Subject: [PHP] stores / ecommerce

 What are some good e-commerce stores written out there for 
 PHP and mySQL??

http://marc.theaimsgroup.com/?l=php-generalm=101839857008918w=2

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




RE: [PHP] What does register_globals do?

2002-07-22 Thread Matt Schroebel

 From: Matt Babineau [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 3:59 PM
 Subject: [PHP] What does register_globals do?
 
 I have never had a clear understanding about what this does, 
 the php.ini
 has an explanation but being newer to PHP I don't understand it very
 well. Could someone prodive a human explanation about what
 register_globals does and why it is so important?

Register globals makes it *really* easy to code in php.  It's what takes the uri or 
posted form data, and turns them into global variables in your script.  

So if a url looked like:
http://www.fakename.com/index.php?target=help

and with register-globals on, php will create a variable, $target, which has the value 
'help' in it.  It's very useful and friendly but, if you don't initialize your 
variables then some non-so-nice person could initialize them for you by passing them 
on the uri/post/cookie/etc so that your code no longer works as expected.
 
You're safe with it on if you always initialize variables, and set error_reporting to 
E_ALL while testing so you catch any you might otherwise miss.

If you leave it off, you need to use the associative arrays $_POST, $_GET etc.  The 
above example would be $_GET['target'].

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




RE: [PHP] What does register_globals do?

2002-07-22 Thread Matt Schroebel

 From: Martin Clifford [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 4:21 PM
 Subject: Re: [PHP] What does register_globals do?
 My way of thinking about is:
 
 With register_globals ON, all variables defined are available 
 anywhere in the script (with the exception of functions and 
 classes, unless defined otherwise), whereas with 
 register_globals OFF, they are only available through the 
 superglobals for the respective variable types.

That's not quite right.  Php's variable scoping is different than most langauges.  
Variables inside a function are always local, even with register_globals on (this has 
something to do with Rasmus' life experiences at IBM). So you would need to use global 
on a variable inside a function (unless it's passed in) and except for the 'magic' 
global arrays, $_POST, $_GET, $_COOKIE, $_SERVER, etc

--- register_globals on --
http://localhost/index.php?target=help

?php

function echo_out() {
  global $target;
  echo $targetbr;
}

echo_out();
?

--- register_globals off --
http://localhost/index.php?target=help

?php

function echo_out() {
  echo {$_GET['target']}br;
}

echo_out();
?

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




RE: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?

2002-07-15 Thread Matt Schroebel

 From: gilles [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 15, 2002 1:19 PM
 Subject: [PHP] outputting a pdf file to IE browser? POST/GET 
 method bug or not?
 ?
 error_reporting(E_ALL);
 
 session_start();
 if (!isset($_SESSION['download'])) {
  @$_SESSION['download'] = $_POST['download'];
 }
 
 if(isset($_POST[download])){
   $file_name=$_SESSION['download'];
   header(Content-type:application/pdf);
   header(Content-Disposition: inline;filename=\mypdf.pdf\);
   header(Content-length:.(string)(filesize($file_name)));
   header(location: $file_name);
 exit;
 }
 ?
 form method=post
 INPUT TYPE=submit name=download value=mypdf.pdf
 /form

Your code runs fine on my freebsd box running php 4.2.1 and apache.  I'd try changing 
the header into an echo, and see what you're sending to the browser.  Are you meaning 
to only set the session var one time?  You only set it when it's not set, so if you 
change the value of $_POST['download', the session var will still hold the first name.

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




RE: [PHP] Final Year Computer Science Project involving PHP

2002-07-12 Thread Matt Schroebel

A couple projects that I have thought of doing at are quite large would be:
1. A network monitor, like Big Brother, but written in php.  Completely db driven, 
with an easy to use web interfaces for monitoring/adding systems and has uptime 
graphs, etc.  It can be quite complex if you try to add heirachies connections, so for 
instance, you'd only alert on the router, and not on all of the systems behind the 
router -- although you'd show them as down, it isn't reported that they're down.

2. A front end interface to jpgraph that lets you do data mining over any db, allowing 
you to choose the tables, x-axis, y-axis, labels, overlay another plot over existing 
ones, etc in an easy to use interface.

3. An access like front end to mysql.

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




RE: [PHP] HTTP authentication

2002-07-10 Thread Matt Schroebel

 From: Varsha Agarwal [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, July 10, 2002 4:30 PM

I thought it will ask some user name and
 password thing but it just displays me the string 
 text to send if user hits cancel.
 This is the code:
 
 ?php
 header(WWW-Authenticate: Basic realm=\My Realm\);

^^
Get rid of the above statement

 
   if (!isset($_SERVER['PHP_AUTH_USER'])) {
 header(WWW-Authenticate: Basic realm=\My
 Realm\);
 header(HTTP/1.0 401 Unauthorized);
 echo Text to send if user hits Cancel button\n;
 exit;
   } else {
 echo pHello {$_SERVER['PHP_AUTH_USER']}./p;
 echo pYou entered {$_SERVER['PHP_AUTH_PW']} as
 your password./p;
   }
 ?

?php
header(WWW-Authenticate: Basic realm=\My Realm\);
header(HTTP/1.0 401 Unauthorized);
?

The above two statements will cause the browser to pop up the login window and pass 
any input (including none) back to the page.  Any user input will be in the two 
$_SERVER vars.  Typically you'd validate this with a db or something, and allow access 
if the user id and password validate.  HTTP Auth in HTTP/1.0 isn't secure as the 
credentials are sent clear text to the server on every GET request, so on a page with 
images and such it's sent several times.  Also, there's no way to sign out other then 
closing all of the browser windows. It's better to design a session based solution, 
with a login page, and set a session variable(s) indicating the authorized so the user 
id/password are only sent once, and you can control session timeout to require 
re-logging in after some interval of inactivity.  You'd also have to consider session 
hijacking, which is covered in the archives.

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




RE: [PHP] Postal / Zip Code Proximity Search

2002-07-09 Thread Matt Schroebel

 -Original Message-
 From: Peter J. Schoenster [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, July 09, 2002 1:26 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Postal / Zip Code Proximity Search
 
 
 I don't know what you mean by straight line. AFAIK all of 
 this will be as the crow flies.
 
 The following came from Jann Linder of cgi-list fame and it 
 worked for me. Odd, I used it in PostgreSQL not knowing that 
 there was something homegrown. 
 
 SELECT /*+FIRST_ROWS */ 
o.zip, 
(3956 * (2 * ASIN(SQRT(
 POWER(SIN(((z.latitude-o.latitude)*0.017453293)/2),2) +
   COS(z.latitude*0.017453293) * 
   COS(o.latitude*0.017453293) * 
   POWER(SIN(((z.longitude-o.longitude)*0.017453293)/2),2)
   dist
 FROM zipcodes z,
  zipcodes o
 WHEREz.zip=94112
 AND  (3956 * (2 * ASIN(SQRT(
 POWER(SIN(((z.latitude-o.latitude)*0.017453293)/2),2) +
   COS(z.latitude*0.017453293) *
   COS(o.latitude*0.017453293) *
   POWER(SIN(((z.longitude-o.longitude)*0.017453293)/2),2)
    5 order by dist;
  
  
 CREATE TABLE zipcodes (
   recordid int(11) unsigned NOT NULL auto_increment,
   zip varchar(5) NOT NULL default '',
   state char(2) NOT NULL default '',
   city varchar(50) NOT NULL default '',
   longitude double NOT NULL default '0',
   latitude double NOT NULL default '0',
   sure tinyint(3) unsigned NOT NULL default '0',
   PRIMARY KEY (recordid),
   KEY idx_zip(zip),
   KEY idx_state(state),
   KEY idx_city(city),
   KEY idx_latitude(latitude),
   KEY idx_longitude(longitude),
   KEY idx_sure(sure)
 ) TYPE=MyISAM;
 
 
 
 More stuff about this here:
 
 http://mathforum.org/library/drmath/view/51711.html
 http://www.movable-type.co.uk/scripts/LatLong.html
 http://earth.uni-muenster.de/~eicksch/GMT-Help/msg00147.html

I found the points file here:
ftp://ftp.census.gov/pub/tiger/pts/geoex.zip

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




RE: [PHP] Working under Apache 1.3 but not Under IIS

2002-07-09 Thread Matt Schroebel

 From: Kondwani Spike Mkandawire [mailto:[EMAIL PROTECTED]] 
 Subject: [PHP] Working under Apache 1.3 but not Under IIS

 The function shown below only functions with my
 Apache on WinNT...  I have tried it on my local
 Server (thats the one running the Apache and
 it works perfectly)...  I am trying to step through
 a moderately large database (4MB)...  However when
 I tried the example on the Server for my Work
 Place it returned an error stating that the Script
 took longer than 30 seconds to execute hence
 failed...  When I search for a name at the top of
 the Database it immeadiately Spits out Found!...
 The server on which this fails is an IIS WebServer, I am
 not quite sure what version it is...  I am kind of
 at a loss whether its to do with the scripts efficiency
 or the Servers Settings...  Why is it possible to
 execute the Script easily on my local host...
 
 Here is the location...
 http://www.coop.mun.ca/verification.php

if (function_exists(odbc_fetch_array))
  return;

 function odbc_fetch_array($result, $rownumber=-1) {
  if (PHP_VERSION  4.1) {
if ($rownumber  0) {
  odbc_fetch_into($result, $rs);
} else {
  odbc_fetch_into($result, $rs, $rownumber);
}
  } else {
odbc_fetch_into($result, $rownumber, $rs);
  }
  foreach ($rs as $key = $value) {
$rs_assoc[odbc_field_name($result, $key+1)] = $value;
  }
  return $rs_assoc;
}

Try taking the pass by reference  off of the result set. The man page for 
odbc_fetch_into states: As of PHP 4.0.5 the result_array does not need to be passed by 
reference any longer. 

I've used the code below on 4.1 and 4.2.  If that doesn't work, you might say what php 
version is on each machine, and what line 82 is.

// ---
// THIS HAS TO BE AT THE END OF THE FILE 
// DON'T ADD ANY OTHER CODE AFTER THIS BECAUSE IT MAY NOT BE EXECUTED
// ---
if (function_exists('odbc_fetch_array'))
  return;

function odbc_fetch_array($result, $rownumber=-1) {
$rs_assoc = array();
  if (PHP_VERSION  4.1) {
if ($rownumber  0) {
  odbc_fetch_into($result, $rs);
} else {
  odbc_fetch_into($result, $rs, $rownumber);
}
  } else {
odbc_fetch_into($result, $rownumber, $rs);
  }
  foreach ($rs as $key = $value) {
$rs_assoc[odbc_field_name($result, $key+1)] = $value;
  }
  return $rs_assoc;
}
// DON'T ADD ANY CODE HERE -- IT MIGHT NOT GET EXECUTED
// 

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




RE: [PHP] Postal / Zip Code Proximity Search

2002-07-09 Thread Matt Schroebel

 I found the points file here:
 ftp://ftp.census.gov/pub/tiger/pts/geoex.zip

Sorry, I was wrong here.  Those aren't the right files, and it's hard to find the 
correct ones.  Should I ever do that, I'll post a correct link.

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




RE: [PHP] $name = My $row['name'] not longer possible?

2002-07-02 Thread Matt Schroebel

 Parse error: parse error, unexpected 
 T_ENCAPSED_AND_WHITESPACE, expecting
 T_STRING or T_VARIABLE or T_NUM_STRING in ...
 
 when doing sth like:
 $name = My $row['name'];

You have to wrap array references in curly braces within double quoted strings. Proper 
form is:
$name = My {$row['name']};

See: 
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

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




RE: [PHP] .htpasswd

2002-07-02 Thread Matt Schroebel

%htpasswd --help
Usage:
htpasswd [-cmdps] passwordfile username
htpasswd -b[cmdps] passwordfile username password

htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
 -c  Create a new file.
 -n  Don't update file; display results on stdout.
 -m  Force MD5 encryption of the password.
 -d  Force CRYPT encryption of the password (default).
 -p  Do not encrypt the password (plaintext).
 -s  Force SHA encryption of the password.
 -b  Use the password from the command line rather than promp
On Windows, TPF and NetWare systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.

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




RE: [PHP] $name = My $row['name'] not longer possible?

2002-07-02 Thread Matt Schroebel

 -Original Message-
 From: Hugo Wetterberg [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, July 02, 2002 1:12 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] $name = My $row['name'] not longer possible?
 It is possible to use arrays within strings, just skip ''.
 Write
 $name=My $name[name];
 instead

Yes, but the manual says that's a feature that may not exist in future versions of 
php.  See this link for details:
http://www.php.net/manual/en/language.types.array.php#language.types.array.foo-bar

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




RE: [PHP] checking

2002-06-28 Thread Matt Schroebel

 if ($lastname=) {
 $insert=no
 }

Even though you should use either empty() or isset(), you'd have a parse error if you 
wrote that as:
if (=$lastname) {
   $insert=no
}

It takes a little time to learn to write the test 'backwards' but if you do the php 
parser will help and catch your single = typo when you really wanted a compare ==.  I 
call that defensive programming.  

Another thing I do in my defensive programming tool kit is to use fuzzy compares to 
trap errors. For instance, say you're writing an application to maintain a price list 
for products, and are validating that the price.  You could write the validation to 
check for == 0, and output an error in that case.  But it's more defensive to check 
for = 0, that way if data gets corrupted somehow, you'll find out about it sooner 
rather than later.  

I also write my applications to validate the data on retrieval from the database, as 
well as when the user to requesting update.  If you do that, any corruption of the 
data will be seen by the user even when inquiring on items. So again problems are 
found sooner rather than later.

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




RE: [PHP] POST v. GET

2002-06-20 Thread Matt Schroebel

 after you read this web page (take you no more than 15 minutes), you 
 should consider browsing the actual HTTP spec, though it's pretty 
 technical and is very long.

I've html'd the RFC2616 for easier reading and you can find it at 
http://www.php-faq.com/httpintro.php

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




RE: [PHP] Using PHP and Apache's .htaccess files.

2002-06-20 Thread Matt Schroebel

 -Original Message-
 From: Todd Fernandes [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, June 20, 2002 3:07 PM

 The way I have it working now is that I check to see if 
 $PHP_AUTH_USER is
 set, and if it is, I send them to the page that is a 
 directory down behind
 the .htaccess file. Working that way, if they are an invalid 
 user, they are
 prompted again, if they hit cancel, they get the 401 page. I 
 want to give
 them a custom error message instead of the generic 401 page.

Might be easier to crypt() the password and stuff it in a mysql db.  Then check the 
crypted user input against the db value to authorize.

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




RE: [PHP] copy protection

2002-05-07 Thread Matt Schroebel

Look at the Zend Encoder.  It's not free, but there is a free trial available.
http://www.zend.com/store/products/zend-encoder.php

 -Original Message-
 From: Udo Giacomozzi [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, May 07, 2002 9:36 AM
 Subject: [PHP] copy protection

 Has somebody thought of adding some sort of copy protection to a PHP 
 project? I guess it would be difficult to accomplish.

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




RE: [PHP] Help on dealing with arrays of HTTP_POST vars

2002-04-15 Thread Matt Schroebel

 -Original Message-
 From: Carlos Fernando Scheidecker Antunes 
 [mailto:[EMAIL PROTECTED]] 

 
 function SearchOrders() {
 global $Orders;
 global $HTTP_POST_VARS;
 
  $index = count($HTTP_POST_VARS);
 
  for($i=1; $i = $index; $i++) {
The trouble is here .  You should be test for the max
Number of possible checkboxes, and not the number checked.  If 3,4,5 are checked, then 
$index is 3, bu thte varaiables will have names like 
PED$3, PED$4, PEF$5 and your code will stop at 3.

  if (isset($HTTP_POST_VARS[PED$i]))
  $Orders[] = $HTTP_POST_VARS[PED$i];
  }
  $index = count($Orders);
  return $index;
Why not name the checkboxes as arrays like:
input type=checkbox name=PED[] value=18191 
input type=checkbox name=PED[] value=18192 

Then in php, PED[0] is the first *checked* value (so it could be the 5th checkbox).  
Test with is_array to see if anything is check at all.

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




RE: [PHP] AS/400 data access

2002-04-09 Thread Matt Schroebel

I just did this on a Linux box running Red Hat 7.2 last Friday.  I used several 
sources on the web and wrote up my exact steps and posted them at 
http://www.php-faq.com/as400.html The other sources are quoted in that document.  

Keep in mind, it's not the final version of the document, and I'd appreciate any 
feedback.  After I get my app running, I'm going to move it to a FreeBSD box and 
document that setup.  I was close to getting it to work on FreeBSD last week, but 
decided to get it working with Redhat since that's what the original docs describe.

I have written a couple of simple scripts that query the db on the AS/400 and display 
the results.  The performance seems fine. I did find that I had to explictly state the 
library name the table is in as part of the sql.  For instance:
$sql = select field1, field2 from library.table where key=$id;

If you create a collection with the same name as the user php is connecting with then 
you don't need to specify the library.  I need to read up a lot because there is a way 
to set the path to multiple
libraries such that I saw in one of the IBM SQL books which is
$query = SET path library1, library2;
But it wouldn't work for me. If either of you find the solution in the maze of IBM 
docs, let me know and I'll add it to the instructions.

Also, you can't single quote numerics like you can in MySQL.

As I said, I just got it working, and will update the document as I learn more about 
the pecularities of the AS/400.

Oh, make sure to grab the replacement odbc_fetch_array code in the user notes at 
http://www.php.net/manual/en/function.odbc-fetch-array.php

 -Original Message-
 From: Collins, Robert [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, April 09, 2002 2:13 PM
 To: 'Rance Hall'; [EMAIL PROTECTED]
 Subject: RE: [PHP] AS/400 data access
 
 
 I am also trying to access data on an AS/400 have you gotten 
 it to work, if
 so can you send an example? Thanks in advance.

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




RE: [PHP] checkbox doesn't pass?

2002-04-04 Thread Matt Schroebel

You should use $HTTP_POST_VARS (or $_POST) all of the time.  There's security risks in 
using register_globals. It's not risky in all cases. But register_globals will allow 
arbitrary variables to be added to into the name space of your script by simply 
putting them on the uri.  Code not expecting such input, and expecting variables not 
to exist unless the script set them may behave unexpectedly.

The reason the variable is not set is that the checkbox isn't checked.  You can test 
the variable with isset(), or empty() before you use it so you don't get the warning.

To learn what your script it seeing when you submit the page, do a:
foreach ($HTTP_POST_VARS as $key = $value) {
echo Key: $key Value: $valuebr\n;
}
at the top of your action handler script, and watch the variables come in when you 
check or not check the checkboxes.  Once you understand that, then write the code to 
handle the situation.

 -Original Message-
 From: savaidis [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, April 04, 2002 10:17 AM
 Thank you both for help and info! You were both very fast :)
 I didn't know I could  not to use $HTTP_POST_VARS . Now it 
 works all right.
 But IF I still want  to use $HTTP_POST_VARS, what then? What about the
 warning when checkbox is not checked?

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




RE: [PHP] Query from POST_VARS

2002-04-03 Thread Matt Schroebel

In my opinion, you should always single quote everything, including numerics.  Why?  
Say you have a:
$sql = Delete from table where id=$id;

where id is expected to be numeric.

What if the variable id ends up containing:
7 or id0

So the sql would end up as
$sql = Delete from table where id=7 or id0;

If the code was:
$sql = Delete from table where id='$id';
It would expand to:
$sql = Delete from table where id='7 or id0';
And wouldn't match any row of the table.

Of course, someone would need to know your table structure to feed that extra data, 
but that information leaks out. It's common to use form field names the same as column 
names, or to echo failed sql statements to the world. If you single quote and validate 
input for expected types, you'll prevent that attack.

 -Original Message-
 From: chris allen [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, April 03, 2002 3:01 PM
 Do I need the single quotes for data being put into table? 
 Ex:
 
 $insert_query =('data' , 'data2', 'data3') etc

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




RE: [PHP] using a counter in a foreach loop

2002-03-26 Thread Matt Schroebel

$i = 1;
foreach ($months) {
   // do some things
   $i++;
}
 -Original Message-
 From: Erik Price [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, March 26, 2002 9:49 AM

 
 I have a foreach loop, where I execute some commands for each 
 element in 
 a certain array.  One thing I would like to add to this loop is a 
 counter, so that on each iteration of the loop I have a next higher 
 number.  The following does not work:
 
 foreach ($months) {
$i = 1;
// do some things
$i++;
 }
 

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




RE: [PHP] FAQ

2002-03-22 Thread Matt Schroebel

I've been working on that at http://www.php-faq.com/ Want to help?

 -Original Message-
 From: James Taylor [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, March 22, 2002 2:30 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] FAQ
 
 Has anyone given any thought to possibly maintaining a FAQ 
 containing the answers to the most commonly asked PHP questions on this 
 list? I notice 
 duplicates roll through every couple of days, and it would 
 probably be a 
 really nice PHP resource.
 
 Or, does one already exist? Ha.

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




RE: [PHP] combining headers with includes

2002-03-19 Thread Matt Schroebel

Ob_end_clean is clearing the buffer and not sending any data to the browser.  Use 
ob_flush or ob_end_flush(). Output buffereing will take care of ordering the headers 
so they'll still work even though the include may still be sending some output.

 -Original Message-
 From: Ian Wayne [mailto:[EMAIL PROTECTED]] 
 Subject: [PHP] combining headers with includes

 The PHP manual says to use buffering as the way around this: ob_start(); 
 and ob_end_clean();
 Should these buffer commands go around the include statement? 
 When I do that
 the page doesn't load at all, so I'm guessing that there must 
 be another
 way, but what that way is I have no idea. Does anyone???

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




RE: [PHP] Website STATISTICS

2002-03-18 Thread Matt Schroebel

I use webalizer.  www.mrunix.net

 -Original Message-
 From: karthikeyan [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, March 18, 2002 2:31 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Website STATISTICS
 
 
 Hi,
 
   Anybody knows any good open source website statistics tool 
 with graph and pie diagrams.  
 
   I did go to sourceforge.net and saw few but wanted to know 
 if any of you have found really good one.
 
   Basically I am looking for tool which apart from basic 
 stuff like referrer, ip, browser name, no of sec/min/hrs, and 
 document name, 
 should also be able to show what KEYWORD used in the search 
 engine to access this website.
 
   Looking forward for your response.
 
   Regards,
 
 karthikeyan.
   
 

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




RE: [PHP] header(Location:) problem with Netscape

2002-03-14 Thread Matt Schroebel

It's not $PHP_SELF that's the issue here -- well it was probably blank because either 
register_globals is off or you were in a function and didn't global it.  The real 
trouble is that. IE  v6.0 is forgiving and if the action= is blank sends the 
request to the current page. So you feel comfy and think all is well, when in fact you 
have an empty action on your form.  Incidentally, Microsoft changed this and I.E. 6.0 
behaves just like Netscape 4.7.

 -Original Message-
 From: Steven Walker [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, March 14, 2002 1:52 PM
 To: Jeff Bearer
 
 I just had this problem!
 
 Using $PHP_SELF did not work with Netscape 4.7 for some reason. I was 
 using it in form submissions and kept getting the error 'Method Not 
 Allowed'. My fix was simple, I just hard coded the action url since.
 
 

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




RE: [PHP] reset auto_increment field mysql

2002-03-12 Thread Matt Schroebel

How about:
ALTER table auto_increment=0

 -Original Message-
 From: Claudiu [mailto:[EMAIL PROTECTED]] 
 I wish it was that simple...
 No.. It doesn't work this way...
 
 On Tue, 12 Mar 2002, Rick Emery wrote:
 
  your query is:   DELETE FROM mytable;
 
  -Original Message-
  From: Claudiu [mailto:[EMAIL PROTECTED]]

  My problem is that the auto_increment field won't reset to 0 after
  deleting all of tha data, but continue incrementing from 
 where it left.

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




RE: [PHP] Form Based Authentication

2002-03-12 Thread Matt Schroebel

First, change the names of your include files to something.inc.php so that no-one can 
download the files and get thte source, should their names become known.
 
Second, you either must use session_register or $_SESSION['variablename'] and not mix 
their use.
So instead of:
$authenticated_user = 71722334;
session_register(authenticated_user);
 
Use:
 $_SESSION['authenticated_user'] = 71722334;
 
Note that session_register will always start sessions, while using the associated 
array $_SESSION won't, so make sure you continue to use session_start() at the top of 
every page just as you did here.
 
Look for tutorials here:
http://www.rci.rutgers.edu/~jfulton/php1/index.html 
http://www.rci.rutgers.edu/~jfulton/php1/index.html  
http://www.newbienetwork.net/ http://www.newbienetwork.net/  
http://www.thickbook.com/ http://www.thickbook.com/  
http://www.phpdeveloper.org/ http://www.phpdeveloper.org/  
http://www.devshed.com/ http://www.devshed.com/  
http://www.webmonkey.com/ http://www.webmonkey.com/  
http://www.irc-html.com/ http://www.irc-html.com/  
http://www.phpbuilder.com/ http://www.phpbuilder.com/  
http://www.zend.com/ http://www.zend.com/  
 
 -Original Message-
From: Anson Smith [mailto:[EMAIL PROTECTED]] 
 
   Could Someone Explain why I have to submit my first form twice in order to be 
 considered authenticated.
 



Re: [PHP] newbie: the superglobal $_SESSION

2002-03-10 Thread Matt Schroebel

 ?php
add a session_start() here
 
 if (!isset($_SESSION['count'])) {
 $_SESSION['count'] = 0;
 }
 else {
 $_SESSION['count']++;
 }
 echo $count;
 ?
 


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




Re: [PHP] MySQL and apostrophes, interesting problem. 42082

2002-03-10 Thread Matt Schroebel

Read the manual about magic_quotes_gpc and addslashes()
I prefer to add slashes myself, that way I can verify input lengths but it
has the risk that I might miss a field. The trouble with magic_quotes_gpc is
that if you have to re-display a variable you have to stripslashes() first.

- Original Message -
From: Nick Patsaros [EMAIL PROTECTED]
Subject: [PHP] MySQL and apostrophes, interesting problem. 42082


 I'm working with a simple form which submits field
 data to a MySQL database.  This is for the purpose of
 generating a dynamic news page for my site.
 Interestingly enough I've found that any time I try to
 submit data that contains an apostrophe ' it gives
 me an error and will not send the data (any of it) to
 the database.



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




  1   2   >