Re: [PHP] Accented character 'echo'ed randomly

2005-04-05 Thread Marek Kilimajer
John Coppens wrote:
Hi people.
I submitted the issue below to the bug site, but the people there
suggested I present it here. I've tried some more, but until now, I
couldn't find any cause for the problem. 

Any suggestion would be appreciated!
John

Description:

I have a very simple web-page script with mainly 'echo' commands.
Randomly the accented characters are replaced
by question-marks. If or not the question mark appears
seems to be depending on the page contents, though at least
in one of the cases, the only thing that changes in the
page is a GIF image. 

All this happens in the same html-session, using the same
script.
I've seen other -similar- reports, though none about 'echo'.
I can't be sure if this is an apache problem or php-related.
Sorry if was already solved... Please indicate.
Reproduce code:
---
echo Página Índice;
Expected result:

Página Índice
Actual result:
--
Randomly 
Página Índice
P?gina ?ndice

Is the character set indicated on the page?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why do I have to declare __set if I declare __get for read-only properties?

2005-04-05 Thread Marek Kilimajer
C Drozdowski wrote:
Howdy,
I'd like to access some of the private members of my classes as 
read-only properties without resorting to function calls to access them. 
(e.g. $testClass-privateMember instead of $testClass-privateMember(), 
etc)

Based on my research and testing, using the __get and __set overloading 
methods appears to be the only way to do so. It also, based on testing, 
appears that these private members must be in an array.

What I do not understand is that if I declare a __get method I MUST also 
declare a do nothing __set method to prevent the read-only properties 
from being modified in code that uses the class.

For example, the code below allows me to have read-only properties. 
However, if I remove the do nothing __set method completely, then the 
properties are no longer read-only.

I'm curious as to why I HAVE to implement the __set method?
Example:
?php
class testClass
{
   private $varArray = array('one'='ONE', 'two'='TWO');
   public function __get($name)
   {
   if (array_key_exists($name, $this-varArray)) {
   return $this-varArray[$name];
   }
   }
   public function __set($name, $value)
   {
   }
}
$test = new testClass();
$test-one = 'TWO';   // doesn't work
echo $test-one;  // echo s 'ONE'
?
If __set function is not created, line $test-one = 'TWO'; creates a new 
public variable with name 'one' and this one is echoed on the next line, 
not the one retrieved from __get.

__get is called only for class variables that do not exist.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ImageMagick Versus GD

2005-04-05 Thread emre
which one is better ImageMagick or GD?
infact I am much more curious about their image processing speed and server 
load. especially resizing large imagefiles.

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


[PHP] Re: Accented character 'echo'ed randomly

2005-04-05 Thread Satyam
Do you have a :

meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

in the head section?

Sometimes the browser tries to figure out the charset, just as it figures to 
assume an /p when it finds a new p and if figures out so many things, 
sometimes it simply fails.  Otherwise, use htmlentities() to escape 
characters not plain USASCII

Satyam


John Coppens [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hi people.

I submitted the issue below to the bug site, but the people there
suggested I present it here. I've tried some more, but until now, I
couldn't find any cause for the problem.

Any suggestion would be appreciated!

John


Description:

I have a very simple web-page script with mainly 'echo' commands.
Randomly the accented characters are replaced
by question-marks. If or not the question mark appears
seems to be depending on the page contents, though at least
in one of the cases, the only thing that changes in the
page is a GIF image.

All this happens in the same html-session, using the same
script.

I've seen other -similar- reports, though none about 'echo'.
I can't be sure if this is an apache problem or php-related.

Sorry if was already solved... Please indicate.

Reproduce code:
---
echo Página Índice;

Expected result:

Página Índice

Actual result:
--
Randomly
Página Índice
P?gina ?ndice 

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



Re: [PHP] Creating INSERT INTO statement from dbf file

2005-04-05 Thread Satyam
You can either put a flag indicating your first time around the field loop 
and add the comma before each field, when it is not the first time around, 
or build the fieldname and fieldvalue list on a string and then trim out the 
last character once the loop is finished.


Rahul S. Johari [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Ave,

I¹ve written a code that is able to extract the Column names and Records
from a simple dbf (foxpro) file and create an INSERT INTO sql statement
which can be used to insert all those records with their corresponding field
names in an existing mySQL table. (A CREATE TABLE code I wrote is able to
create the table from the dbf file information).

Following is the code I wrote for creating the INSERT INTO sql:

?php
$db_path = $DATABASEFILE;
$dbh = dbase_open($db_path, 0) or die(Error! Could not open
dbase database file '$db_path'.);
if ($dbh) {

#Get the Information
$column_info = dbase_get_header_info($dbh);
$record_numbers = dbase_numrecords($dbh);

#Run the loop for all the records in the Table
for ($i = 1; $i = $record_numbers; $i++) {
$row = dbase_get_record_with_names($dbh, $i);

echo INSERT INTO .substr($DATABASEFILE_name,0,-4). (;

#Run the loop for all the fields in the Table
foreach ($column_info as $v1) {echo $v1[name],;}

echo ) VALUES (;

#Run the loop for all the values corresponding to fields in the
Table
foreach ($column_info as $v1) {echo
'.trim($row[$v1[name]]).',;}

echo '); br;

}
}
dbase_close($dbh);
?

It works fine, except for one problem. It¹s able to create the INSERT INTO
sql statement, with all the fields and corresponding values, but as I¹m
running a loop for both the fields names, and the values corresponding to
fields names, it leaves a comma after the records are over.

So instead of having this : INSERT INTO tblname (c1,c2,c3) VALUES
(Ov1¹,¹v2¹,¹v3¹);
I achieve this : INSERT INTO tblname (c1,c2,c3,) VALUES (Ov1¹,¹v2¹,¹v3¹,¹);

Notice an additional Comma after column names, and an additional ,¹ after
the values. I¹m not quite sure what to do to get rid of those. I¹ve tried
some different combinations using different kind of logic with the echo
statements, but it¹s not working out. Would love some help.

Thanks,

Rahul S. Johari
Coordinator, Internet  Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



[PHP] Little Help Needed

2005-04-05 Thread Jason
Could someone tell me what I did wrong with this script.   It should read 
the page 
http://www.mto.gov.on.ca/english/traveller/conditions/rdclosure.htm  and 
only read between the 2 words in the script. And email any new stuff to the 
email address in the script.  What did I do wrong that is causing this 
script to fail?


?
# 
--
# Configuration
# Directory on the remote server.  Be sure to include leading and trailing 
slashes!
$remotedir = /english/traveller/conditions/;

# File on the remote server.  No slashes!
$remotefile = rdclosure.htm;
# Keyword to check for in response.
$keyword = Closed;
# Remote server address.
$remoteserver = www.mto.gov.on.ca;
# E-mail recipient(s).  Separate each address with a comma and a space.
$emailrecip = [EMAIL PROTECTED];
# E-mail subject line.
$emailsubject = MTO - TEST .  date(' (G:i:s)');
# E-mail From name.
$emailfromname = WxServer Roads;
# E-mail From address.
$emailfromaddr = [EMAIL PROTECTED];
# End Configuration
# 
--
# Format the page for easy viewing.
Header( Content-type: text/html);
# Setup the request.
$header .= GET  . $remotedir . $remotefile .  HTTP/1.0\r\n;
$header .= Host:  . $remoteserver . \r\n;
$header .= User-Agent: Downloader\r\n\r\n;
$fp = fsockopen ($remoteserver, 80, $errno, $errstr, 30);

# Do the request.
fputs ($fp, $header . $req) or die(Can't access the site!);
while (!feof($fp)) {
$res .= fgets ($fp, 128);
}
# Strip off the header info.
$res = preg_replace(/[^]+/, , $res);
$res = preg_replace(/Last Updated\:\s+?\d\d\d\d-\d\d-\d\d\s+?\d\d\:\d\d/, 
, $res);
$res = preg_replace(/nbsp;/, , $res);
$headerend = strpos($res,\r\n\r\n);

if (is_bool($res)) {
$result = $res;
}
else {
$result = substr($res,$headerend+4,strlen($res) - ($headerend+4));
}
fclose ($fp);
# Start and end tags
$startstr = Highways;
$endstr = This;
# Find start and end positions
$startpos = strpos($result, $startstr) + strlen($startstr);
$endpos = strpos($result, $endstr, $startpos);
# Get string between 2 tags
$result = substr($result, $startpos, $endpos-$startpos);
echo ($new_res);
# Check for keyword.
if (!stristr($result, $keyword)) die(ERROR Code Word Not Found);
# Read the file containing the last response.
$filename = $remotefile . '.txt';
$fp = fopen($filename, r);
$contents = fread($fp, filesize($filename));
fclose($fp);

# Check for changes.
if ($contents == $new_res) {
# There has not been a change.
echo (No Updates\r\n);
} else {
# There has been a change.
echo (**UPDATES DETECTED**\r\n);
# Write the new file.
$filename = $remotefile . '.txt';
$fp = fopen($filename, w);
$write = fputs($fp, $result);
fclose($fp);
# Send the e-mail.
$recipient = $emailrecip;
$subject = $emailsubject;
$body_of_email = $result;
$header = 'From: ' . $emailfromname . ' ' . $emailfromaddr . '';
mail ($recipient, $subject, $body_of_email, $header);
echo (E-mail sent.);
}
? 

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


Re: [PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx- Narrowed it down!

2005-04-05 Thread Satyam
What you see as round numbers in base 10, are not so in binary.  Numbers 
such as .5, .25, .125, .0625 and so on, multiples of one half, are round 
numbers in binary, though they don't look so in decimal.

Others which look pretty simple in decimal are not, for example, 0.1 gives 
you an infinite series 0.11001100110011... in binary.  All this numbers give 
you rounding errors.

That is why many languages have introduced 'currency' or 'money' data types, 
they are either integer data types scaled back to a fixed number of decimal 
places, or they are floats rounded of the least significant digits.

You can do either by yourself, that is, have all currency internally 
represented as cents and scale it to full units when showing it, or round 
off at two cents after each calculation.

Satyam



Anthony Tippett [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 btw, thanks for your response.

 I'm not sure as if I understand why.  It's not like I'm using a very
 precise number when dealing with the hundreths place.

 Even without the multiplication the number gets messed up.

 eg.

 $a = 17.00;
 $a+= 1.10;
 $a+= 0.32;
 $a+= 0.07;


 print $a.br; // 18.49

 var_dump($a);  // float(18.49)
 var_dump($a-18.49); // float(3.5527136788005E-15)

 I'm just trying to add money amounts?  Can I not rely on floats to do 
 this?



 Richard Lynch wrote:
 Floats are NEVER going to be coming out even reliably.

 You'll have to check if the difference is less than X for whatever number
 X you like.

 Or you can look at something like BC_MATH where precision can be carried
 out as far as you like...

 But what you are seeing is to be expected.

 That's just the way computers work, basically.

 On Mon, April 4, 2005 5:07 pm, Anthony Tippett said:

Ok i've narrowed it down a little bit but still can't figure it out..

Here's the code and what I get for the output.  Does anyone know what's
going on?  Can someone else run it on their computer and see if they get
the same results?
?php

$a = 17.00 * 1;
$a+= 1.10 * 1;
$a+= 0.32 * 1;
$a+= 0.07 * 1;

print $a.br; // 18.49

var_dump($a);  // float(18.49)
var_dump($a-18.49); // float(3.5527136788005E-15)
?


Anthony Tippett wrote:

I'm having trouble figuring out why subtraction of two floats are giving
me a very small number.  I'm thinking it has something to do with the
internals of type casting, but i'm not sure.  If anyone has seen this or
can give me some suggestions, please.

I have 2 variables that go through a while loop and are
added/subtracted/ multipled. InvAmt and InvPay are shown as
floats but when they are subtracted, they give me a really small
number

// code
var_dump($InvAmt);
var_dump($InvPay);
var_dump($InvAmt-$InvPay);

// output
float(18.49)
float(18.49)
float(2.1316282072803E-14)


--
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] Little Help Needed

2005-04-05 Thread Frank Arensmeier
You should describe more specific what is going wrong with your script.  
What does the script output? Maybe you should post a vardump as well.

/frank
2005-04-05 kl. 11.07 skrev Jason:
Could someone tell me what I did wrong with this script.   It should  
read the page  
http://www.mto.gov.on.ca/english/traveller/conditions/rdclosure.htm   
and only read between the 2 words in the script. And email any new  
stuff to the email address in the script.  What did I do wrong that is  
causing this script to fail?


?
#  
--- 
---
# Configuration

# Directory on the remote server.  Be sure to include leading and  
trailing slashes!
$remotedir = /english/traveller/conditions/;

# File on the remote server.  No slashes!
$remotefile = rdclosure.htm;
# Keyword to check for in response.
$keyword = Closed;
# Remote server address.
$remoteserver = www.mto.gov.on.ca;
# E-mail recipient(s).  Separate each address with a comma and a space.
$emailrecip = [EMAIL PROTECTED];
# E-mail subject line.
$emailsubject = MTO - TEST .  date(' (G:i:s)');
# E-mail From name.
$emailfromname = WxServer Roads;
# E-mail From address.
$emailfromaddr = [EMAIL PROTECTED];
# End Configuration
#  
--- 
---

# Format the page for easy viewing.
Header( Content-type: text/html);
# Setup the request.
$header .= GET  . $remotedir . $remotefile .  HTTP/1.0\r\n;
$header .= Host:  . $remoteserver . \r\n;
$header .= User-Agent: Downloader\r\n\r\n;
$fp = fsockopen ($remoteserver, 80, $errno, $errstr, 30);

# Do the request.
fputs ($fp, $header . $req) or die(Can't access the site!);
while (!feof($fp)) {
$res .= fgets ($fp, 128);
}
# Strip off the header info.
$res = preg_replace(/[^]+/, , $res);
$res = preg_replace(/Last  
Updated\:\s+?\d\d\d\d-\d\d-\d\d\s+?\d\d\:\d\d/, , $res);
$res = preg_replace(/nbsp;/, , $res);
$headerend = strpos($res,\r\n\r\n);

if (is_bool($res)) {
$result = $res;
}
else {
$result = substr($res,$headerend+4,strlen($res) - ($headerend+4));
}
fclose ($fp);
# Start and end tags
$startstr = Highways;
$endstr = This;
# Find start and end positions
$startpos = strpos($result, $startstr) + strlen($startstr);
$endpos = strpos($result, $endstr, $startpos);
# Get string between 2 tags
$result = substr($result, $startpos, $endpos-$startpos);
echo ($new_res);
# Check for keyword.
if (!stristr($result, $keyword)) die(ERROR Code Word Not Found);
# Read the file containing the last response.
$filename = $remotefile . '.txt';
$fp = fopen($filename, r);
$contents = fread($fp, filesize($filename));
fclose($fp);

# Check for changes.
if ($contents == $new_res) {
# There has not been a change.
echo (No Updates\r\n);
} else {
# There has been a change.
echo (**UPDATES DETECTED**\r\n);
# Write the new file.
$filename = $remotefile . '.txt';
$fp = fopen($filename, w);
$write = fputs($fp, $result);
fclose($fp);
# Send the e-mail.
$recipient = $emailrecip;
$subject = $emailsubject;
$body_of_email = $result;
$header = 'From: ' . $emailfromname . ' ' . $emailfromaddr . '';
mail ($recipient, $subject, $body_of_email, $header);
echo (E-mail sent.);
}
?
--
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] SSL XML File Download Problem

2005-04-05 Thread Shaun
Hi Chris,

I have turned off friendly messages, but I get the same message...


Chris W. Parker [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Shaun mailto:[EMAIL PROTECTED]
on Friday, April 01, 2005 11:20 AM said:

 This was working fine until i added an SSL certificate to my site,
 now I get the following error message:

 Internet Explorer cannot download ..._download.php?id=4723 from
 www... .com

 Internet Explorer was not able to open this Internet site. The
 requested site is either unavailable or cannot be found...

 Any ideas?

IIRC you've got friendly error messages turned on. Turn it off to see
what's really happening.


Chris. 

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



Re: [PHP] ImageMagick Versus GD

2005-04-05 Thread C.J. Walsh
Personally, I prefer IM. As far as load issues are concerned, I am not
sure which one is quicker. I have used both in large scale image web
apps (i.e. photo galerries). I have experienced a long loading time for
images in IM, that are at or above 2MB in size.

C.J.

 which one is better ImageMagick or GD?
 
 infact I am much more curious about their image processing speed and
server 
 load. especially resizing large imagefiles.
 
 thx in adv.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
CJ Walsh
http://odewebdesigns.com

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



[PHP] Javascript Calendar and PHP

2005-04-05 Thread Jerry Swanson
What Javascript calendar works good with PHP?
Thanks

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



RE: [PHP] PHP Tool to answer emails

2005-04-05 Thread Jeff McKeon
www.eforcer.com

It's a fairly cheap but very good ticket system that can auto inject
emails into it or retrieve them from a pop account.

Jeffrey S. McKeon
Manager of Information Technology
Telaurus Communications LLC
[EMAIL PROTECTED]
+1 (973) 889-8990 ex 209


 -Original Message-
 From: Daniel Baughman [mailto:[EMAIL PROTECTED] 
 Sent: Monday, April 04, 2005 7:57 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP Tool to answer emails
 
 
 Hi all,
 
  
 
 I am looking for a php tool that will provide email tracking 
 and a web interface to an email box.  Pretty much, we get 
 lots of emails directed to an administrative email account 
 (most of the valid emails) that need response. To the point 
 that one person is getting over whelmed.
 
  
 
 It would be nice if someone had a tool already made that 
 would check the box, download the email, mark the receipt 
 time, then present them to be answered on a web site for 
 employees, document the answer, etc. etc.. 
 
  
 
 Anyone know of anything?
 
  
 
  
 
 Dan Baughman
 
 IT Technician
 
 Professional Bull Riders, Inc.
 
 719-471-3008 x 3161
 
  
 
 

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



Re: [PHP] pass variable from vbscript to php

2005-04-05 Thread David Bevan
Another way you can get around passing info to the
server is to use hidden fields and make the entire
page into a form with each link in turn submitting the
form to the target script.  You avoid putting
sensitive info into the address bar and you can take
advantage of header encryption if you need it.

Regards,
David

--- Ashley [EMAIL PROTECTED] wrote:
 I have a unique problem that may be able to be
 solved another way, but I 
 don't know how.
 
 What I need to do is pass a variable from a vbscript
 into php for use.
 
 I am using vbscript to access an activeX control on
 the computer that 
 grabs the currently logged in user.  This works
 fine, but I cannot 
 determine how I can get that value into php so that
 I can use it.
 
 This is for an Intranet app.  Basically I want to
 use the currently 
 logged in user so that they don't have to log into
 the Intranet app.
 
 I am running this on a Netware 6.5 server running
 Apache 2.5.
 
 This may not be the best way to go about this, but
 it is the only thing 
 that I have been able to find so I am open to
 suggestions.
 
 Thanks in advance,
 Ashley
 
 -- 
 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] What's the going rate for making websites ?

2005-04-05 Thread David Bevan
Hi Rene,

I am becoming a little bit concerned about some of the
advice you have been getting about setting a rate for
your work.  Don't get me wrong, there is nothing wrong
with charging by the hour, but a lot of times one of
two things happen, either you begin to resent your
customer or they begin to resent you.
I have another method for you to consider about
pricing/costing your work.  Try basing your fee on
value. If someone wants a one page site then you look
at how long it will take and ask them a few questions
about what they want to get out the page.  If the
client believes that the single page would be the most
inportant part of their interaction with their
audience (I'm being intentionally extreme here) then
would you feel right about only charging 50$ for it? 
Personally I would be looking at charging 500$ or even
more.

Another thing to think about where figuring out your
rate is what your time is actually worth. A trimmined
down version of how I have determined my rate in the
past is as follows:

My desired salary: 60,000$

Hours to work per year: 2000h

Now start subtrating from hours to determine billable
hours.

Minus:
Vacation time(3 weeks @ 40h/week): 120h
Overhead time(accounting and such 4h/month): 48h
Networking/Marketing time (figure about 1/3 of your
time): 600h
Sick Days(everyone gets sick eventually): 40h

You also have expenses:
Overhead (space to rent, cd or dvds, computers,
hosting, etc): 20,000$
Advertising(brochures, cards, etc): 3000$

Determine sales needed for the year:
Salary + expenses: 83,000$/year

Determine billable hours
(Total hours - Vac time, sick time, etc):
2000h - 120-48-600-40 = 1192h (actual time you can
spend doing what you do)

Rate to charge:
Needed sales/billable hours
83,000$/1192h = 70$/h

Use that number as a base, initially add 20% more time
 to your time estimates and find out what the client
is willing to pay and charge them that or a little
more, they will pay you more.

HTH,
David
--- -{ Rene Brehmer }- [EMAIL PROTECTED]
wrote:
 Hi gang
 
 Sorry for asking this question here, but I don't
 know where else to ask. 
 And Goole'ing didn't help me much.
 
 My father-in-law has a friend in Alaska (and I'm in
 Canada) that needs a 
 website done. Not sure what kinda site he wants done
 yet, or how much he 
 needs me to do for him (like webspace, domain
 hosting, domain registration, 
 and such) but for now I've been asked what it'd cost
 to get it done.
 
 I'm assuming it's something pretty simple, since
 it's just for a motorcycle 
 club, but he wants a price first ...
 
 What do y'all charge when you do sites for people
 ??? ... In the past I've 
 only done pro-bono work (because they usually don't
 require much work, so 
 it's not a problem getting it done while working on
 other projects), but 
 I've never actually done paid work before... It's
 more that I just recently 
 moved to Canada (from Denmark) so I have no feeling
 with what the prices 
 and rates are overhere ...
 
 
 TIA
 
 Rene 
 
 -- 
 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



[PHP] read from comport: windows vs. linux

2005-04-05 Thread Kim Madsen
Hi there

I´ve got a problem porting from windows to Linux, when I wanna read and write 
to the serial port. This works like a charm in windows:

if (!$fp = fopen(COM1, 'w+b')) {
echo \nError! Could not open COMport - Got a terminal open?\n;
exit;
}

The program continues, but breaks in linux:

if (!$fp = fopen(/dev/ttyS0, 'w+b')) {
echo \nError! Could not open COMport - Got a terminal open?\n;
exit;
}

I´ve checked and made sure that there´s a device on /dev/ttyS0 with minicom, 
where I´ve got no problem accessing the device. But I keep getting this error: 

Warning:  fopen(/dev/ttyS0): failed to open stream: Permission denied in 
/var/www/html/s.php on line 85

Line 85 is the fopen line. 

Permissions are:
crw-rw-rw-  1 root uucp 4, 64 Apr  5 13:38 /dev/ttyS0

having apache be the groupowner doesn´t change anything

Now, what have I missed?

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

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



[PHP] RAD tool

2005-04-05 Thread marc serra
Hi,
I'm designing intranet softwares with PHP. I want to know if it exists 
good RAD software to speed up developpement with a database. Like 
creating forms in relation with database in WYSIWYG mode.

thanks for your answer,
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] read from comport: windows vs. linux

2005-04-05 Thread Jay Blanchard
[snip]
I´ve got a problem porting from windows to Linux, when I wanna read and write 
to the serial port. This works like a charm in windows:

if (!$fp = fopen(COM1, 'w+b')) {
echo \nError! Could not open COMport - Got a terminal open?\n;
exit;
}

The program continues, but breaks in linux:

if (!$fp = fopen(/dev/ttyS0, 'w+b')) {
echo \nError! Could not open COMport - Got a terminal open?\n;
exit;
}

I´ve checked and made sure that there´s a device on /dev/ttyS0 with minicom, 
where I´ve got no problem accessing the device. But I keep getting this error: 

Warning:  fopen(/dev/ttyS0): failed to open stream: Permission denied in 
/var/www/html/s.php on line 85

Line 85 is the fopen line. 

Permissions are:
crw-rw-rw-  1 root uucp 4, 64 Apr  5 13:38 /dev/ttyS0

having apache be the groupowner doesn´t change anything
[/snip]

You may also need to change the user/owner, depending on what Apache is running 
as. 

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



Re: [PHP] RAD tool

2005-04-05 Thread C.J. Walsh
Try using pear packages

see:

http://pear.php.net/package/DB_DataObject_FormBuilder

 
 Hi,
 
 I'm designing intranet softwares with PHP. I want to know if it exists 
 good RAD software to speed up developpement with a database. Like 
 creating forms in relation with database in WYSIWYG mode.
 
 thanks for your answer,
 
 Marc
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
CJ Walsh
http://odewebdesigns.com

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



[PHP] shopping cart classes

2005-04-05 Thread madhuri sawant
Hi,
   I have to code shopping cart in php and I wanted to use shopping cart 
classes if available. I m confused using php classes ,I got from net after 
searching google as I want to use it for 2 3 carts. It would be very helpful to 
me, if anybody suggests me for ready available shopping cart php class and 
their links.

regards,
Madhuri



  
 

[PHP] Maybe Newbie: PHP-scripts in sub-directories

2005-04-05 Thread Oliver Ekeis
Hi NG,

I'm very sorry to bother you, but I've wasted a week solving my problem
and didn't find any solution in the net.

On my dedicated server preinstalled with Linux Suse 9.0, Apache 2.0.48,
PHP 4.3.3 in want to use php in subdirectories. In the main document root
of apache my test.php (consisting of the simple phpinfo()-function)
works fine. But if I copy the file in any subdirectory I get a error message
like 'Premature end of script headers...'.

Please tell me, what might be the reason for that?

Must there be a right configurated '.htaccess'-file? What must be inserted?
Has it to do with rights (I gave the subdir 777-rights recursively to be
sure)?

Thanks for your reply.

Oliver.

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



[PHP] Re: Javascript Calendar and PHP

2005-04-05 Thread chris
I do not know of a specific calendar, but communication between JavaScript 
and php is most commonly handled via a form post. Think of it along these 
lines.

1 - client downloads your page with JS calendar script.
2 - client clicks on a calendar day.
3 - onclick event submits the day via post variable to a php script.
4 - php processes the variable and returns a response.

CJ

Jerry Swanson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 What Javascript calendar works good with PHP?
 Thanks 

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



[PHP] Sending mail directly to php

2005-04-05 Thread ÞilvinasÐaltys
Hello,

I have to create a script that could parse attachments that come from another
server by mail. I could use crontab  pear pop to do the job. But maybe
someone knows if it is possible to configure my server in such way that it
could send mail attachments directly to my php script.

It's a little offtopic so i hope you'll forgive me.

Thanks
Bye

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



Re: [PHP] Sending mail directly to php

2005-04-05 Thread Michael von Minden
Hi!

You could create a shell php script that listens on port 25 and does
what eg sendmail does... imho this would not be a good solution.

A better solution would be to use procmail to feed the mail to your
script after it was accepted by the mailserver.

cheers

ÞilvinasÐaltys wrote:
 I have to create a script that could parse attachments that come from another
 server by mail. I could use crontab  pear pop to do the job. But maybe
 someone knows if it is possible to configure my server in such way that it
 could send mail attachments directly to my php script.

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



Re: [PHP] pass variable from vbscript to php

2005-04-05 Thread David Bevan
Please address replies to the list
--- Rory Browne [EMAIL PROTECTED] wrote:
 I'm not sure how you'd go about this from a security
 point of view,
 but perhaps for an Intranet, you could, check their
 IP address from
 $_SERVER['REMOTE_ADDR'], and check your login server
 to see who is
 logged in from that IP.
 
 Perhaps considering that you seem to have a way of
 providing such
 information to the Browser, you could use cookies.
 For your clientside
 code you could do something like the following:
 
 Bare in mind that I don't really know vbs, and the
 usual disclaimers apply.
 script type=text/vbscript
for each tree in NWSess1.ConnectedTrees
anyTree=tree.FullName
anyUser=NWSess1.LoginName(anyTree)
document.cookie=userid= + anyUser +
 ; + document.cookie
next
 /script
 
 You can then get the information then in PHP using
 $_COOKIE['userid'].
 I wouldn't normally advocate such a solution, you're
 relying on the
 user to tell you their name, and to tell you it
 accurately. You are
 assuming that they can't change document.cookie to
 userid=somebody_elses_name. That assumption only
 holds true if the
 person in question doesn't know how to use a
 browser.
 
 The situation you're describing suggests a strong
 lack of security. 
 
 On Apr 5, 2005 1:28 PM, David Bevan
 [EMAIL PROTECTED] wrote:
  Another way you can get around passing info to the
  server is to use hidden fields and make the entire
  page into a form with each link in turn submitting
 the
  form to the target script.  You avoid putting
  sensitive info into the address bar and you can
 take
  advantage of header encryption if you need it.
  
  Regards,
  David
  
  --- Ashley [EMAIL PROTECTED] wrote:
   I have a unique problem that may be able to be
   solved another way, but I
   don't know how.
  
   What I need to do is pass a variable from a
 vbscript
   into php for use.
  
   I am using vbscript to access an activeX control
 on
   the computer that
   grabs the currently logged in user.  This works
   fine, but I cannot
   determine how I can get that value into php so
 that
   I can use it.
  
   This is for an Intranet app.  Basically I want
 to
   use the currently
   logged in user so that they don't have to log
 into
   the Intranet app.
  
   I am running this on a Netware 6.5 server
 running
   Apache 2.5.
  
   This may not be the best way to go about this,
 but
   it is the only thing
   that I have been able to find so I am open to
   suggestions.
  
   Thanks in advance,
   Ashley
  
   --
   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
  
 
 

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



[PHP] Solution for all your design requiremetnts

2005-04-05 Thread freshersworld .com

Visit www.lifenit.com for more details.. 

First Job. Dream Job...  Freshersworld.com



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

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



Re: [PHP] Accented character 'echo'ed randomly

2005-04-05 Thread John Coppens
On Tue, 05 Apr 2005 09:44:35 +0200
Marek Kilimajer [EMAIL PROTECTED] wrote:

 John Coppens wrote:
  Hi people.
  
  I submitted the issue below to the bug site, but the people there
  suggested I present it here. I've tried some more, but until now, I
  couldn't find any cause for the problem. 
  
  Any suggestion would be appreciated!
  
  John
  
  
  Description:
  
  I have a very simple web-page script with mainly 'echo' commands.
  Randomly the accented characters are replaced
  by question-marks. If or not the question mark appears
  seems to be depending on the page contents, though at least
  in one of the cases, the only thing that changes in the
  page is a GIF image. 
  
  All this happens in the same html-session, using the same
  script.
  
  I've seen other -similar- reports, though none about 'echo'.
  I can't be sure if this is an apache problem or php-related.
  
  Sorry if was already solved... Please indicate.
  
  Reproduce code:
  ---
  echo Página Índice;
  
  Expected result:
  
  Página Índice
  
  Actual result:
  --
  Randomly 
  Página Índice
  P?gina ?ndice
  
 
 Is the character set indicated on the page?

Thanks for the reply, Marek.

The page is started with html lang=es, according to rfc3066.

John

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



[PHP] Header issues

2005-04-05 Thread Mahmoud Badreddine
I have a web-page divided into two frames : margin and main.
Inside the margin frame area, I have a pull-down menu that lists all the 
tables in my database.
Upon choosing the appropriate table from the pull-down menu I click a button 
to display the table.
I use the Header( ) function.
This works, except that my tables are displayed in the margin area. How 
can I force it to send to the main area , using the header function.

Note: I am using pull-down menus, because I tried using collapsible menus 
and I didn't get anywhere with it.
I have a large number of tables and I must hide them.

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


Re: [PHP] Header issues

2005-04-05 Thread John Nichel
Mahmoud Badreddine wrote:
I have a web-page divided into two frames : margin and main.
Inside the margin frame area, I have a pull-down menu that lists all 
the tables in my database.
Upon choosing the appropriate table from the pull-down menu I click a 
button to display the table.
I use the Header( ) function.
This works, except that my tables are displayed in the margin area. 
How can I force it to send to the main area , using the header function.
You can't.  Not using header() at least.  header() happens on the 
server, targeting a frame happens in the client.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Header issues

2005-04-05 Thread Martin . C . Austin
Perhaps you can do some juggling to make this work, passing the query to 
the server, then using a client side language to transmit those results to 
the appropriate frame.  Sounds like a big headache to me though.

Martin Austin





John Nichel [EMAIL PROTECTED]
04/05/2005 11:17 AM
 
To: php-general@lists.php.net
cc: 
Subject:Re: [PHP] Header issues


Mahmoud Badreddine wrote:
 I have a web-page divided into two frames : margin and main.
 Inside the margin frame area, I have a pull-down menu that lists all 
 the tables in my database.
 Upon choosing the appropriate table from the pull-down menu I click a 
 button to display the table.
 I use the Header( ) function.
 This works, except that my tables are displayed in the margin area. 
 How can I force it to send to the main area , using the header function.

You can't.  Not using header() at least.  header() happens on the 
server, targeting a frame happens in the client.


-- 
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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




RE: [PHP] Header issues

2005-04-05 Thread Jay Blanchard
[snip]
I have a web-page divided into two frames : margin and main.
Inside the margin frame area, I have a pull-down menu that lists all
the 
tables in my database.
Upon choosing the appropriate table from the pull-down menu I click a
button 
to display the table.
I use the Header( ) function.
This works, except that my tables are displayed in the margin area.
How 
can I force it to send to the main area , using the header function.

Note: I am using pull-down menus, because I tried using collapsible
menus 
and I didn't get anywhere with it.
I have a large number of tables and I must hide them.
[/snip]

You cannot with header(). In the HTML href tage you can specify the
target, like a href=thepage.php target=mainFrame

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



Re: [PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx

2005-04-05 Thread Rasmus Lerdorf
Anthony Tippett wrote:
I'm having trouble figuring out why subtraction of two floats are giving
me a very small number.  I'm thinking it has something to do with the
internals of type casting, but i'm not sure.  If anyone has seen this or
can give me some suggestions, please.
I have 2 variables that go through a while loop and are
added/subtracted/ multipled. InvAmt and InvPay are shown as
floats but when they are subtracted, they give me a really small
number
// code
var_dump($InvAmt);
var_dump($InvPay);
var_dump($InvAmt-$InvPay);
// output
float(18.49)
float(18.49)
float(2.1316282072803E-14)
Computers are not able to represent floating point numbers precisely. 
If you are doing financial stuff I would suggest using integer math and 
working completely in pennies.

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


Re: [PHP] Accented character 'echo'ed randomly

2005-04-05 Thread Satyam
John Coppens [EMAIL PROTECTED] wrote in message
The page is started with html lang=es, according to rfc3066.

John

I am not sure this applies to your problem.  The language is not the same as 
the character set.  There are several character sets which can represent 
many European languages, and most European languages share the same 
character set.  Frontpage puts a language meta tag which is just for the 
purpose of the spellchecker.  In a browser it might help a speech 
synthetizer to use the proper pronuntiation rules.

One think I can tell you for sure because I just checked is that Microsoft 
does not list 'lang' as an atribute for the html tag, so I wouldn't expect 
Internet Explorer to care about it:

http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/html.asp?frame=true

I think that what you are looking for is to define the character set, as I 
mentioned in a previous reply.

Satyam

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



Re: [PHP] PHP 5.0.4 not generating /usr/local/bin/pear ?

2005-04-05 Thread Rick Fletcher
Chances are it's not your fault.
The initial release of 5.0.4 was missing the RunTest.php file.  The end 
result of which is that pear isn't installed.  It was noticed a day 
after the initial release, and I believe the 5.0.4 that's on php.net now 
has been fixed.

--Rick
mbneto wrote:
Hi,
I've downloaded the 5.0.4 targz and installed on a new server using
the same ./configure settings I use in a nother server that runs php
5.0.3.
I did a make/make install and everything runs fine excepth the fact
that I can no longer pear install  because there is no pear in
/usr/local/bin.
'./configure' '--with-kerberos' '--with-gd' '--with-apxs2'
'--with-xml' '--with-ftp' '--enable-session' '--enable-trans-sid'
'--with-zlib' '--enable-inline-optimization'
'--with-mcrypt=/usr/local' '--enable-sigchild' '--with-gettext'
'--with-freetype' '--with-ttf' '--with-ftp' '--enable-ftp'
'--with-jpeg-dir=/usr' '--with-mysql=/usr/include/mysql'
'--enable-soap' '--with-pear'
Any ideas?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP config issues when moving from Fedora to SuSe

2005-04-05 Thread Whil Hentzen
Hi folks,
I've done a bit of work with PHP/MySQL on a Fedora Core server over the 
past few months and just about the time I got comfortable, it was time 
to change the server to SuSE. What a delight! Installed Apache 2, PHP 
and MySQL and I was processing pages within minutes.

So now I switched my development box to SuSE, then, later, installed 
Apache 2 and PHP via YaST, and it's burping on me. Apache processes 
static pages fine, but the PHP function calls aren't being processed. 
I'm guessing that there are missing directives somewhere in the Apache 
innards.

I'm confused about Apache's multiple config files. FC just had one big 
ol' config file and I was comfortable adding the PHP lines, setting up 
multiple virtual hosts, and all that. But this SuSE thing is more 
complicated.

There's /etc/apache2/httpd.conf that basically just has a bunch of 
includes. Don't wanna touch that. There's 
/etc/apache2/default-server.conf that looks like it's where the action 
is. And there's a /etc/apache2/conf.d/php4.conf file that has specific 
php commands, such as

IfModule sapi_apache2.c
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php .php4
   DirectoryIndex index.php
   DirectoryIndex index.php4
/IfModule
But I can't find where any of the Apache config files point to the php4 
config file. Do I need to add an include in default-server.conf? 
(Shouldn't the install have done that? Silly install!)

Where else might I look?
Thanks,
Whil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL empty row

2005-04-05 Thread GamblerZG
DB Error: constraint violation
What DB do you use?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Browser problem

2005-04-05 Thread ja ko
Hi,
I have a little problem:  
The following link works well on Explorer, Mozilla and Firefox:  
pag.php?var=1#print  
But on Opera, the same link change to this:  
pag.php?var=1%EF%BF%BDprint  
causing an error.
How I can solve it?
Thanks for the answers

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



Re: [PHP] Accented character 'echo'ed randomly

2005-04-05 Thread John Coppens
On Tue, 5 Apr 2005 19:14:17 +0200
[EMAIL PROTECTED] (Satyam) wrote:

 One think I can tell you for sure because I just checked is that
 Microsoft does not list 'lang' as an atribute for the html tag, so I
 wouldn't expect Internet Explorer to care about it:
 
 http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/html.asp?frame=true

Ok. MS ignores many standards and norms. I took the information from:

http://www.w3.org/International/articles/language-tags/

 I think that what you are looking for is to define the character set,
 as I mentioned in a previous reply.

Apparently this is a specific problem with Mozilla. I tried with Firefox,
Opera and Dillo, and didn't have any problem. I've traced the HTTP
exchange over the 'net, and the HTML code is served correctly. It's the
browser that gets confused.

I've filed a bug report on bugzilla...

Thanks for the replies, and sorry for blaming PHP (not really ;-).

John

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



[PHP] cancelling

2005-04-05 Thread newbie c

Hi,

I would appreciate help on the following.

I have been looking up ways to implement a cancel button with php. Basically, I 
have a mypictures.php file.  There are select statements, grep statements, and 
a call to executables.  I don't understand why there isn't that much around 
about this cancel topic? Have I been looking in the right places?

The cancel button can be used if the user does not want to wait a long time for 
a big request and wait for the pictures to render. Also, I have had problems 
with the executables tying up the server.

They can use the big stop button at the top of the Internet Explorer I think 
but I would like to make it user friendly and have the option to cancel in the 
php application itself. I want the cancel button to also direct the user to a 
page ready for a new search.

Can I use posix_get pid and then posix_kill to kill the current instance of 
mypictures.php.

Will this work? I'm not sure how to kill the executables started by this 
particular mypictures.php.

Other people can open another session and I don't want to kill their 
mypictures.php or executables that they started.

What is the difference between posix_getpid() and getmypid()? Are they the same 
thing?  For the cancel button I was thinking of using a popup window or just 
use the mypictures.php that the top header part of the mypictures.php that is 
rendering and use an XML HTTP Request object to be able to cancel without 
sending another request.  Are these ideas practical and possible?

thanks!









-
Post your free ad now! Yahoo! Canada Personals


[PHP] Re: Browser problem

2005-04-05 Thread Satyam
I think the #, if meant as a bookmark, should go before the ?:

pag.php#print?var=1

If it is not meant as a bookmark, then it should be urlencoded

Satyam


Ja Ko [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,
 I have a little problem:
 The following link works well on Explorer, Mozilla and Firefox:
 pag.php?var=1#print
 But on Opera, the same link change to this:
 pag.php?var=1%EF%BF%BDprint
 causing an error.
 How I can solve it?
 Thanks for the answers 

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



[PHP] PHP inside .htacess protected file

2005-04-05 Thread james tu
I have this dilemma...I know this is more of an apache question than 
a PHP questions, but I thought that it's partially related.

We have a webserver that we want to turn on/off access.
We were thinking of using simple HTTP authentication to protect the 
main webserver directory.

We have Flash movies that talk to PHP scripts inside the webserver directory.
When we have our .htaccess file inside the main webserver directory, 
Flash can't comunicate with the PHP scripts.

So ideally this is what we want...prevent access to the directory but 
allow our Flash movies to talk to the PHP scripts in the directory.

How would I go about doing this?
Can I create a subfolder to put the PHP scripts in and put another 
.htaccess in that folder to override the protection?

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


Re: [PHP] Accented character 'echo'ed randomly

2005-04-05 Thread Satyam

John Coppens [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Tue, 5 Apr 2005 19:14:17 +0200
 [EMAIL PROTECTED] (Satyam) wrote:

 One think I can tell you for sure because I just checked is that
 Microsoft does not list 'lang' as an atribute for the html tag, so I
 wouldn't expect Internet Explorer to care about it:

 http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/html.asp?frame=true

 Ok. MS ignores many standards and norms. I took the information from:

 http://www.w3.org/International/articles/language-tags/

 I think that what you are looking for is to define the character set,
 as I mentioned in a previous reply.

 Apparently this is a specific problem with Mozilla. I tried with Firefox,
 Opera and Dillo, and didn't have any problem. I've traced the HTTP
 exchange over the 'net, and the HTML code is served correctly. It's the
 browser that gets confused.


I like it, you complain about Microsoft ignoring standards, but your problem 
is with Mozilla, and you still have not told us whether you have tried the 
most obvious, which is indicating the character set has worked for you.  How 
about just trying?  And, by the way, my native language does use many 
characters with diacritical marks so you might as well take some little 
advice from someone who has done it before you.


 I've filed a bug report on bugzilla...

 Thanks for the replies, and sorry for blaming PHP (not really ;-).

 John 

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



Re: [PHP] Re: Browser problem

2005-04-05 Thread [EMAIL PROTECTED]
take out the  sign. just:
pag.php?var=1#print
-afan
Satyam wrote:
I think the #, if meant as a bookmark, should go before the ?:
pag.php#print?var=1
If it is not meant as a bookmark, then it should be urlencoded
Satyam
Ja Ko [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 

Hi,
I have a little problem:
The following link works well on Explorer, Mozilla and Firefox:
pag.php?var=1#print
But on Opera, the same link change to this:
pag.php?var=1%EF%BF%BDprint
causing an error.
How I can solve it?
Thanks for the answers 
   

 

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


RE: [PHP] cancelling

2005-04-05 Thread Chris W. Parker
newbie c mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 11:03 AM said:

 Are these ideas practical and possible?

Practically speaking? It seems like a waste of time. What are these
executables doing? The stop button on the browser or clicking a link to
a new page should suffice.

As for possibility, that I don't know. I don't think you'll find the
answer you want since HTTP is stateless. It seems that you'd have to
send another request to the server to tell it to interrupt the current
process.

Your cancel button should probably just go to the new search page.
Won't it cancel the process on it's own by abandoning the request?



Chris.

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



[PHP] help on Array to string conversion warning when use mail()

2005-04-05 Thread cchereTieShou
I am using the mail() function to send a quite simple email but always
get warning message as Notice: Array to string conversion at this
line if(mail($MailTo, $MailSubj, $MailCon,
$MailH,[EMAIL PROTECTED])){ in the following php code.

I don't see where is the Array at all. Appreciated for helps

?php
error_reporting(E_ALL);

$FromName=tieshou;
$MailFrom=[EMAIL PROTECTED];
$MailTo=[EMAIL PROTECTED];
$MailSubj=This is just a test for sending out email purpose;
$MailCon=This is a somehting to test out;

$MailH = MIME-Version: 1.0\r\n;
$MailH .= From: $FromName $MailFrom\r\n;
$MailH .= Reply-to: $FromName $MailFrom\r\n;
$MailH .= X-Priority: 3\r\n;
$MailH .= X-Mailer: PHP mailer\r\n;
if(mail($MailTo, $MailSubj, $MailCon, $MailH, [EMAIL PROTECTED])){
   echo sending out succeessfully;
}else{
   echo Can't send out for some reason.;
}
?

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



[PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread GamblerZG
Why include_once() is doing some fancy logic, which nobody needs?
Why array_shift() re-indexes arrays?
Why 2 simple string comparisons are slower than one preg_match()?
Why microtime(TRUE) returns only fraction of real time that is smaller 
than 1?
Why microtime() does not return float in the first place?
Why user-defined session-handling functions receive serialized session 
data that is already serialized?
Why parser reads multi-line comment slower than it reads heredoc or 
single-quoted string?

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


Re: [PHP] cancelling

2005-04-05 Thread Philip Hallstrom
You might find this section in the manual helpful...  never done it myself 
though...

http://us2.php.net/manual/en/features.connection-handling.php
On Tue, 5 Apr 2005, newbie c wrote:
Hi,
I would appreciate help on the following.
I have been looking up ways to implement a cancel button with php. Basically, I 
have a mypictures.php file.  There are select statements, grep statements, and 
a call to executables.  I don't understand why there isn't that much around 
about this cancel topic? Have I been looking in the right places?
The cancel button can be used if the user does not want to wait a long time for 
a big request and wait for the pictures to render. Also, I have had problems 
with the executables tying up the server.
They can use the big stop button at the top of the Internet Explorer I think 
but I would like to make it user friendly and have the option to cancel in the 
php application itself. I want the cancel button to also direct the user to a 
page ready for a new search.
Can I use posix_get pid and then posix_kill to kill the current instance of 
mypictures.php.
Will this work? I'm not sure how to kill the executables started by this 
particular mypictures.php.
Other people can open another session and I don't want to kill their 
mypictures.php or executables that they started.
What is the difference between posix_getpid() and getmypid()? Are they the same 
thing?  For the cancel button I was thinking of using a popup window or just 
use the mypictures.php that the top header part of the mypictures.php that is 
rendering and use an XML HTTP Request object to be able to cancel without 
sending another request.  Are these ideas practical and possible?
thanks!




-
Post your free ad now! Yahoo! Canada Personals
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Slightly 0T - database (adodb)

2005-04-05 Thread Ryan A
Hey all,
After my old thread of SQL-Injection I have been checking out the PEAR db
classes and ADODB as a database wrapper.

PEAR is quite large and has a LOT of stuff which I prolly will never use
(but very useful stuff if you know how to use it) so I thought i'll go with
adodb.

After reading the docs I copied this simple program to see if it works on my
setup:
?php
$hostt = localhost;  $userr = root;  $passs = ;  $database = test1;
include('adodb/adodb.inc.php');
$db = ADONewConnection($database);
$db-debug = true;
$db-Connect($hostt, $userr, $passs, $database);
$rs = $db-Execute('select * from categories');
print pre;
print_r($rs-GetRows());
print /pre;
?

but its giving me this error:

Missing file: c:\phpdev\www\project
jappz\site\adodb/drivers/adodb-blocket.inc.php

ADONewConnection: Unable to load database driver ''

Fatal error: Call to undefined function: connect() in c:\phpdev\www\project
jappz\site\testdb.php on line 15

can anybody tell me why?
This is on my setup test server with this configuration
win2k pro, php 4.3x,mysql 3.27.x


Thanks,
Ryan
P.S am also searching google as I am asking this, if i find the answer will
post back



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 4/1/2005

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



Re: [PHP] Slightly 0T - database (adodb) SOLVED

2005-04-05 Thread Ryan A
Hey,
Solved it, they wrote $database in the docs as I was supposed to change it
to the database i am using (mysql) while I mistook it for the database where
the tables are stored (test1)

Hope that helps anyone else if they have this problemso for the adodb
looks pretty good!

Cheers,
Ryan

On 4/5/2005 9:13:27 PM, Ryan A ([EMAIL PROTECTED]) wrote:
 Hey all,

 After my old thread of SQL-Injection I have been checking out the PEAR
 db

 classes and ADODB as a database wrapper.



 PEAR is quite large and has a LOT of stuff which I prolly will never use

 (but very useful stuff if you know how to use it) so I thought
 i'll go with
 adodb.

 After reading the docs I copied this simple program to see if it works on
my
 setup:
 ?php
 $hostt = localhost;  $userr = root;  $passs = ;  $database =
test1;
 include('adodb/adodb.
 inc.
 php');
 $db = ADONewConnection($database);
 $db-debug = true;
 $db-Connect($hostt, $userr, $passs, $database);
 $rs = $db-Execute('select
 * from
 categories');
 print pre;
 print_r($rs-GetRows());
 print /pre;
 ?

 but its giving me this error:

 Missing file: c:\phpdev\www\project
 jappz\site\adodb/drivers/adodb-blocket.inc.php

 ADONewConnection: Unable to load database driver ''

 Fatal error: Call to undefined function: connect() in
c:\phpdev\www\project
 jappz\site\testdb.php on line 15

 can anybody tell me why?
 This is on my setup test server with



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 4/1/2005

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



RE: [PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread Jay Blanchard
[snip]
Why include_once() is doing some fancy logic, which nobody needs?
Why array_shift() re-indexes arrays?
Why 2 simple string comparisons are slower than one preg_match()?
Why microtime(TRUE) returns only fraction of real time that is smaller 
than 1?
Why microtime() does not return float in the first place?
Why user-defined session-handling functions receive serialized session 
data that is already serialized?
Why parser reads multi-line comment slower than it reads heredoc or 
single-quoted string?
[/snip]

Why don't you RTFM?

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



RE: [PHP] cancelling

2005-04-05 Thread newbie c
The executables are taking the user's input and going to the database
to grab and cut out the pictures that are corresponding to the user's search 
term.
 
I understand the stop button may solve some problems and I am going to test 
this some more.  But there is still the need to stop a user from making some
huge request then going away for a couple of days.  
I don't want to restrict the requests of a user however how can I stop them 
from monopolizing the server?
 
thanks!

Chris W. Parker [EMAIL PROTECTED] wrote:
newbie c 
on Tuesday, April 05, 2005 11:03 AM said:

 Are these ideas practical and possible?

Practically speaking? It seems like a waste of time. What are these
executables doing? The stop button on the browser or clicking a link to
a new page should suffice.

As for possibility, that I don't know. I don't think you'll find the
answer you want since HTTP is stateless. It seems that you'd have to
send another request to the server to tell it to interrupt the current
process.

Your cancel button should probably just go to the new search page.
Won't it cancel the process on it's own by abandoning the request?



Chris.



-
Post your free ad now! Yahoo! Canada Personals


RE: [PHP] cancelling

2005-04-05 Thread Chris W. Parker
newbie c mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 12:23 PM said:

 The executables are taking the user's input and going to the database
 to grab and cut out the pictures that are corresponding to the user's
 search term.

I can only guess then that these executables could not be replaced by a
regular PHP script?

 I understand the stop button may solve some problems and I am going
 to test this some more.  But there is still the need to stop a user
 from making some huge request then going away for a couple of days. I
 don't want to restrict the requests of a user however how can I stop
 them from monopolizing the server?

I see. In that case a cancel button isn't going to help you (at least,
it won't be a solution). What if the user starts the process, doesn't
press your cancel button, and goes away for a couple of days? You've got
a cancel button but it didn't get pressed.

Since we don't have any details of these executables wouldn't the
executable return control back to whatever it was that called it after
it was done processing? I mean, if I put in some search terms in google
and walk away for a few days, google has no idea I've left. Nor do they
even care.

In the same way, your executables shouldn't run continuously without
user intervention. They should know when they are done and should stop.
At that point, monopolizing the server becomes a non-issue.



Chris.

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



[PHP] Re: PHP config issues when moving from Fedora to SuSe

2005-04-05 Thread Jason Motes
Whil Hentzen wrote:
Hi folks,
I've done a bit of work with PHP/MySQL on a Fedora Core server over the 
past few months and just about the time I got comfortable, it was time 
to change the server to SuSE. What a delight! Installed Apache 2, PHP 
and MySQL and I was processing pages within minutes.

So now I switched my development box to SuSE, then, later, installed 
Apache 2 and PHP via YaST, and it's burping on me. Apache processes 
static pages fine, but the PHP function calls aren't being processed. 
I'm guessing that there are missing directives somewhere in the Apache 
innards.

I'm confused about Apache's multiple config files. FC just had one big 
ol' config file and I was comfortable adding the PHP lines, setting up 
multiple virtual hosts, and all that. But this SuSE thing is more 
complicated.

There's /etc/apache2/httpd.conf that basically just has a bunch of 
includes. Don't wanna touch that. There's 
/etc/apache2/default-server.conf that looks like it's where the action 
is. And there's a /etc/apache2/conf.d/php4.conf file that has specific 
php commands, such as

IfModule sapi_apache2.c
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php .php4
   DirectoryIndex index.php
   DirectoryIndex index.php4
/IfModule
But I can't find where any of the Apache config files point to the php4 
config file. Do I need to add an include in default-server.conf? 
(Shouldn't the install have done that? Silly install!)

Where else might I look?
Thanks,
Whil
in my /etc/apache2/default-server.conf their is a directive to load all 
conf files.

Include /etc/apache2/conf.d/*.conf
mod_php4.conf is located in the conf.d directory
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread GamblerZG
Why don't you RTFM?
There is nothing in manual that answers any of those questions.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: PHP config issues when moving from Fedora to SuSe

2005-04-05 Thread Whil Hentzen

There's /etc/apache2/httpd.conf that basically just has a bunch of 
includes. Don't wanna touch that. There's 
/etc/apache2/default-server.conf that looks like it's where the 
action is. And there's a /etc/apache2/conf.d/php4.conf file that has 
specific php commands, such as

IfModule sapi_apache2.c
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php .php4
   DirectoryIndex index.php
   DirectoryIndex index.php4
/IfModule
But I can't find where any of the Apache config files point to the 
php4 config file. Do I need to add an include in default-server.conf? 
(Shouldn't the install have done that? Silly install!)

Where else might I look?
Thanks,
Whil

in my /etc/apache2/default-server.conf their is a directive to load 
all conf files.

Include /etc/apache2/conf.d/*.conf
Yup, already got this directive in default-server.conf (and it's NOT 
commented out!)

mod_php4.conf is located in the conf.d directory
I don't have mod_php4.conf, just php4.conf. I thought that the 
mod_php4.conf was for backward compatibility. My server (which is 
processing php fine) doesn't have the mod_php4.conf file.

I did a double-check and it sure looks to me like the conf files on both 
my server and my dev box are the same.

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


RE: [PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread Jay Blanchard
[snip]
Why include_once() is doing some fancy logic, which nobody needs?
Why array_shift() re-indexes arrays?
Why 2 simple string comparisons are slower than one preg_match()?
Why microtime(TRUE) returns only fraction of real time that is smaller 
than 1?
Why microtime() does not return float in the first place?
Why user-defined session-handling functions receive serialized session 
data that is already serialized?
Why parser reads multi-line comment slower than it reads heredoc or 
single-quoted string?


Why don't you RTFM?

There is nothing in manual that answers any of those questions.
[/snip]

I'll get you started(picked at random)

Why microtime() does not return float in the first place?

from http://www.php.net/microtime
***
microtime
(PHP 3, PHP 4 , PHP 5)

microtime --  Return current Unix timestamp with microseconds 
Description
mixed microtime ( [bool get_as_float] )


microtime() returns the current Unix timestamp with microseconds. This
function is only available on operating systems that support the
gettimeofday() system call. 

When called without the optional argument, this function returns the
string msec sec where sec is the current time measured in the number
of seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and msec
is the microseconds part. Both portions of the string are returned in
units of seconds. 
*

And another

Why include_once() is doing some fancy logic, which nobody needs?

What fancy logic? And why does no one need it?

From http://www.php.net/include_once
*
include_once()
The include_once() statement includes and evaluates the specified file
during the execution of the script. This is a behavior similar to the
include() statement, with the only difference being that if the code
from a file has already been included, it will not be included again. As
the name suggests, it will be included just once. 

include_once() should be used in cases where the same file might be
included and evaluated more than once during a particular execution of a
script, and you want to be sure that it is included exactly once to
avoid problems with function redefinitions, variable value
reassignments, etc. 
*

Now surely you can RTFM and find more answers. If you disagree with the
way that some things work you have a couple of options;

a. Contact the PHP development group and explain what you would like to
happen.
2. Write an extension yourself that 'fixes' the items you have questions
about.

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



Re: [PHP] Cannot connect to database when using Zend studio debugger

2005-04-05 Thread Supersky
Thanks, Burhan.

Supersky
Burhan Khalid [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Supersky wrote:
 Dear Richard,

 Thanks.

 After I swaped to PHP4 option in the preference of Zend Studio, I can 
 connect to the database. However, other problems arised. The problem 
 might be that my PHP version installed is 5.0.3 indeed.

 You should post this stuff at the My Zend center at zend.com -- they are 
 really good with supporting such things.  I've had a few issues with Zend 
 studio that they showed me how to fix.

 Although I'm still a bit annoyed that they don't support subversion, 
 studio is still a great product. 


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



[PHP] To session or not to session

2005-04-05 Thread mailings
Hi all

I have been doing all my design by using POST to transfer user data and GET 
for user changeable variables.

I would like to know what you guys think of using SESSION in production sites.  

Right now I am giving a trust factor of 80% to POST and 0% on GET.  What trust 
factor should I apply to SESSION

Should I implement a SESSIONless feature in case SESSION is not available?

I know the way to php.net for documentation but I'd like advice/opnions of 
real people.

Thanks

Andy Pieters

-- 
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and 
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--

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



[PHP] dynamic image will not print properly

2005-04-05 Thread DuSTiN KRySaK
Hi there - I had my first crack at creating a dynamic image. The thing 
is - the image is displayed fine in the browser, but when you go to 
print it, the image is either missing, or part of it is missing. Is 
there something special needed to print a dynamic image?

Here is a code snippet used to create the image
header(Content-type: image/jpg);
$image = imagecreatefromjpeg(template_cpn.jpg);
$red = imagecolorallocate( $image, 255,0,0 );
imagestring($image, 2, 306, 200, $couponcode, $red);
imagestring($image, 2, 306, 235, $exp, $red);
imagestring($image, 2, 175, 338, $myname, $red);
imagestring($image, 2, 175, 360, $myemail, $red);
imagejpeg($image);
imagedestroy($image);
Now the way I have it set up, is that there is a PHP file that 
generates the image (the above code). Then I have a parent PHP page 
that calls that page like so:

$theurl = cstl.php?dk=soemthinghere
echo img src=\$theurl\;
See any issues in my code or setup?
Any ideas?
d
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 11:44 am, GamblerZG said:
 Why include_once() is doing some fancy logic, which nobody needs?

Obviously somebody needed it, or they wouldn't have written it!

If you don't need it, you can roll your own in about 10 seconds, or you
could simply *NOT* use include_once and structure your code well enough
that you're never silly enough to include the same file twice.

 Why array_shift() re-indexes arrays?

Because that's what a POP function should do?

Though if you don't want this behaviour, use text indices, and it won't.

So there.

 Why 2 simple string comparisons are slower than one preg_match()?

Because preg_match is fast.

Also depends on the preg_match() expression.

Try it with something non-trivial.

 Why microtime(TRUE) returns only fraction of real time that is smaller
 than 1?
 Why microtime() does not return float in the first place?

You mean microtime(FALSE), and it returns a string that way because that's
the way the operating system does it.

PHP allows you to use TRUE to get the float you want.  This was added
because users like you went to the source and fixed it.

 Why user-defined session-handling functions receive serialized session
 data that is already serialized?

Because you are almost for sure going to have to serialize it to store it
anyway, and PHP can do it faster in C than you can?

 Why parser reads multi-line comment slower than it reads heredoc or
 single-quoted string?

If you can make it faster, submit a patch.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread Jason Barnett
Jay Blanchard wrote:
 [snip]
 Why include_once() is doing some fancy logic, which nobody needs?

I need it.  If you don't need it, don't use it.

 Why array_shift() re-indexes arrays?

Because most people *expect* it to behave that way.

 Why 2 simple string comparisons are slower than one preg_match()?

Not sure.

 Why microtime(TRUE) returns only fraction of real time that is smaller
 than 1?

Because that's the way it was designed.  It's an optional (read:
different) way to get the microtime.

 Why microtime() does not return float in the first place?

Not sure.

 Why user-defined session-handling functions receive serialized session
 data that is already serialized?

Design choice.  Those functions are for storing / retrieving / etc.
session data and (in case you didn't know) when session data gets
written to disk (default handler) it is serialized.

You don't like the default serialize()?  Then unserialize() first and
write your own.  Even better: write a C extension as Jay suggested.

 Why parser reads multi-line comment slower than it reads heredoc or
 single-quoted string?


Not sure.

All of your performance questions require a thorough understanding of C
coding.  So you can either invest time in understanding C (so that you
can view / modify PHP's source code) or you can simply accept that it is
the way that it is.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] PHP 4.3/MySQL phpinfo()

2005-04-05 Thread Todd Cary
I have installed FC 3 with Apache and MySQL.  When I run phpinfo(), I do 
not see MySQL listed as a database nor can I connect via php.

Does something have to be specially done with the FC 3 install?
Todd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dynamic image will not print properly

2005-04-05 Thread Andy Pieters
To test, 

cstl.php?dk=somethinghere

and try to print that?


Maybe your browser is configured to NOT print images (or bakckground) ?
Maybe your printer is textonly (just kidding)

Tada


Andy

On Tuesday 05 April 2005 23:26, DuSTiN KRySaK wrote:
 Hi there - I had my first crack at creating a dynamic image. The thing
 is - the image is displayed fine in the browser, but when you go to
 print it, the image is either missing, or part of it is missing. Is
 there something special needed to print a dynamic image?

 Here is a code snippet used to create the image

 header(Content-type: image/jpg);
 $image = imagecreatefromjpeg(template_cpn.jpg);
 $red = imagecolorallocate( $image, 255,0,0 );
 imagestring($image, 2, 306, 200, $couponcode, $red);
 imagestring($image, 2, 306, 235, $exp, $red);
 imagestring($image, 2, 175, 338, $myname, $red);
 imagestring($image, 2, 175, 360, $myemail, $red);
 imagejpeg($image);
 imagedestroy($image);

 Now the way I have it set up, is that there is a PHP file that
 generates the image (the above code). Then I have a parent PHP page
 that calls that page like so:

 $theurl = cstl.php?dk=soemthinghere
 echo img src=\$theurl\;

 See any issues in my code or setup?

 Any ideas?

 d

-- 
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and 
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--

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



Re: [PHP] PHP inside .htacess protected file

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 11:24 am, james tu said:
 We have a webserver that we want to turn on/off access.
 We were thinking of using simple HTTP authentication to protect the
 main webserver directory.

 We have Flash movies that talk to PHP scripts inside the webserver
 directory.

 When we have our .htaccess file inside the main webserver directory,
 Flash can't comunicate with the PHP scripts.

 So ideally this is what we want...prevent access to the directory but
 allow our Flash movies to talk to the PHP scripts in the directory.

 How would I go about doing this?
 Can I create a subfolder to put the PHP scripts in and put another
 .htaccess in that folder to override the protection?

Should work.

But then anybody who can figure out what's going on can get to the same
scripts Flash can get to.

You could also change the URLs in your Flash movie to include the
username/password as part of the URL:
http://username:[EMAIL PROTECTED]/secret.php
This works for HTTP Basic Authentication only, as far as I know.

Downside there is that somebody can probably un-compile the Flash movie
and dig out the password if they REALLY want to.  So use a password that's
not used for anything else.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP config issues when moving from Fedora to SuSe

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 10:49 am, Whil Hentzen said:
 So now I switched my development box to SuSE, then, later, installed
 Apache 2 and PHP via YaST, and it's burping on me. Apache processes
 static pages fine, but the PHP function calls aren't being processed.
 I'm guessing that there are missing directives somewhere in the Apache
 innards.

For the immediate short term keep it running without exposing PHP source
code, COPY the httpd.conf and then edit it by hand the same way as you
always did.

That should at least get you moving forward on other fronts while you work
on this some more.

 I'm confused about Apache's multiple config files. FC just had one big
 ol' config file and I was comfortable adding the PHP lines, setting up
 multiple virtual hosts, and all that. But this SuSE thing is more
 complicated.

 There's /etc/apache2/httpd.conf that basically just has a bunch of
 includes. Don't wanna touch that. There's
 /etc/apache2/default-server.conf that looks like it's where the action
 is. And there's a /etc/apache2/conf.d/php4.conf file that has specific
 php commands, such as

 IfModule sapi_apache2.c
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php .php4
 DirectoryIndex index.php
 DirectoryIndex index.php4
 /IfModule

 But I can't find where any of the Apache config files point to the php4
 config file. Do I need to add an include in default-server.conf?
 (Shouldn't the install have done that? Silly install!)

Sounds to me like there should be an include in there.

The install may avoid doing that if you've ever altered anything at all in
your .conf files, on the assumption that if you edited them by hand, you
don't want them mucked with.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] registering session with user and password

2005-04-05 Thread Tomás Rodriguez Orta
Hi, people.
I want to register all session of my web sitie, by the way in my index web I
register all user with your username and password
session_start();
$_SESSION['username']=$username;
session_register('username');

and the other page if the user don't enter your name and password I was
redirect to the page index.php, ok?, then in these page I ask if the user
was register.
?php
session_start();
if (session_is_registered('username'))
 {
?
html
.
.
.
.
/html
?php } else header(Location: http://webadmin/index.php;); ?

but I have a big problem, the session_register('username'); is'nt work,
because all the page web rediret to  http://webadmin/index.php
somebody can help me?.

best regards TOMAS


-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

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



[PHP] Fwd: dynamic image will not print properly

2005-04-05 Thread DuSTiN KRySaK
One thing to add. the issue is only on windows/IE. If it is say 
windows/Firefox - everything works as it should.

d

Begin forwarded message:
From: DuSTiN KRySaK [EMAIL PROTECTED]
Date: April 5, 2005 2:26:14 PM PDT
To: PHP php-general@lists.php.net
Subject: dynamic image will not print properly
Hi there - I had my first crack at creating a dynamic image. The thing 
is - the image is displayed fine in the browser, but when you go to 
print it, the image is either missing, or part of it is missing. Is 
there something special needed to print a dynamic image?

Here is a code snippet used to create the image
header(Content-type: image/jpg);
$image = imagecreatefromjpeg(template_cpn.jpg);
$red = imagecolorallocate( $image, 255,0,0 );
imagestring($image, 2, 306, 200, $couponcode, $red);
imagestring($image, 2, 306, 235, $exp, $red);
imagestring($image, 2, 175, 338, $myname, $red);
imagestring($image, 2, 175, 360, $myemail, $red);
imagejpeg($image);
imagedestroy($image);
Now the way I have it set up, is that there is a PHP file that 
generates the image (the above code). Then I have a parent PHP page 
that calls that page like so:

$theurl = cstl.php?dk=soemthinghere
echo img src=\$theurl\;
See any issues in my code or setup?
Any ideas?
d


Re: [PHP] PHP 4.3/MySQL phpinfo()

2005-04-05 Thread Andy Pieters
On Tuesday 05 April 2005 23:35, Todd Cary wrote:
 Does something have to be specially done with the FC 3 install?

I kindly redirect you to google for LAMP which is short for Linux Apache MySQL 
PHP

I have also learned to setup this kind of system on Fedora Core 3. 

While you CAN rely on the rpms, you're better of compiling each yourself 
(exluding Linux).  For example, the precompiled rpms from Fedora (read Red 
Hat) do not include GD on php.

Required items:

An internet connection
A good deal of time
Much more patience
Much commitment.
Some reading glasses


Andy
-- 
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and 
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--

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



[PHP] plug-in forum

2005-04-05 Thread Ryan A
Hi,
a client wants me to add a forum to his existing site...which is not a
problem, the problem is he wants it to work off his existing site

eg:
once someone logs in to the main site they dont have to relogin or create
new accounts in the forum section
a one login gets you total site access kind of deal.

The second thing is, as clients go, these ar'nt too bright :-) a rea
simple forum/forum admin is needed, I was looking at phpbb but after running
a test install on my system i think it would be a little too complicated for
them plus it has to sit into the existing design...
recommendations please.


Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 4/1/2005

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



[PHP] Re: To session or not to session

2005-04-05 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
 Hi all

 I have been doing all my design by using POST to transfer user data and GET
 for user changeable variables.

 I would like to know what you guys think of using SESSION in production sites.

SESSION is A Good Thing.


 Right now I am giving a trust factor of 80% to POST and 0% on GET.  What trust
 factor should I apply to SESSION

Why?  Because it's more convenient (easier) to forge GET requests than
it is to forge POST requests?  Either route can get malicious code sent
your way if you aren't careful, but given that most people are lazy then
yes POST is less likely to be malformed.

How much would I trust SESSION data?  Probably about the same as POST.
It's not as likely as GET to be abused, but it's still likely to happen.


 Should I implement a SESSIONless feature in case SESSION is not available?

First of all, SESSION availability mostly depends on php.ini settings
(it is enabled by default with PHP core).  So for example if you are
requiring COOKIES instead of allowing GET then you will run into some
users that just don't accept cookies.  And, you won't be able to use
SESSION with those users.

If your SESSION infrastructure is a required part of using your site
(e.g. it holds customer information) then you should require all users
to start SESSIONs.  But if the SESSION is storing non-essential
information (e.g. tracking web traffic through your site) then you might
just allow the user to browse without starting a session.

In any case, if you really want I suppose that you could propagate a
SESSION id with hidden POST inputs instead of using COOKIE / GET.


 I know the way to php.net for documentation but I'd like advice/opnions of
 real people.

 Thanks

 Andy Pieters



--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: registering session with user and password

2005-04-05 Thread Jason Barnett
Tomás Rodriguez Orta wrote:
 Hi, people.
 I want to register all session of my web sitie, by the way in my index web I
 register all user with your username and password
 session_start();
 $_SESSION['username']=$username;
 session_register('username');
 

You should use $_SESSION *or* session_register() and (in your php.ini)
register_globals = true.  In my opinion I would just use
$_SESSION['username'] to store the data.

Then you should be able to do the following:

?php

if $_SESSION['username'] {
  /* Do stuff */
} else {
  header(Location: http://webadmin/index.php;););
}

?

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins



signature.asc
Description: OpenPGP digital signature


RE: [PHP] To session or not to session

2005-04-05 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 2:25 PM said:

 Right now I am giving a trust factor of 80% to POST and 0% on GET. 
 What trust factor should I apply to SESSION

What do you mean trust? If by trust you mean I trust the data to be
80% h4x0r-free if I'm receiving it through POST then I'd say you should
move that 80% to 0%. On the other hand if you have a different
definition, please share it.

 Should I implement a SESSIONless feature in case SESSION is not
 available?

Session's are available by default (IIRC) because PHP appends the
PHPSESSID to the URL automatically when cookies are not available. In
any case, I guess it depends exactly on the site's functional
requirements for you to determine whether or not some kind of session
tracking is necessary. As far as I'm concerned, if a person wants any
sort of personalized data (custom settings, user account, ability to
create a cart and checkout [whatever the case may be]) then they should
have no problem having a cookie set on their system.



HTH,
Chris.

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



RE: [PHP] PHP 4.3/MySQL phpinfo()

2005-04-05 Thread Chris W. Parker
Todd Cary mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 2:35 PM said:

 I have installed FC 3 with Apache and MySQL.  When I run phpinfo(), I
 do not see MySQL listed as a database nor can I connect via php.
 
 Does something have to be specially done with the FC 3 install?

Other than choosing the correct packages at install time, no. I
installed FC3 about two weeks ago, carefully selecting all my pakages,
and everything works fine.

If you've got time, I suggest you just reinstall update all the RPM's
via up2date (or yum or whatever). I think I finally got the install
right on the 3rd try.



Chris.

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



Re: [PHP] Re: registering session with user and password

2005-04-05 Thread Tomás Rodriguez Orta
ok thanks I test an solution an working
in the page  login.php i do the following

$user=$username;
   session_register(user);
and the all pages I do this.

if (isset($_SESSION['user'])) {
.

}
else
header(Location:http://webadmin/index.php;)


and that all ok, before I asked by the
if (!session_is_registered('user')) and isn't working, why?
what is the differnece between isset($_session['use']) and
session_is_registered('user')  ?

somebody can Help me?

thanks regards TOMAS

- Original Message -
From: Jason Barnett [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, April 05, 2005 2:58 PM
Subject: [PHP] Re: registering session with user and password




-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

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



Re: [PHP] Sending mail directly to php

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 7:43 am, ÞilvinasÐaltys said:
 I have to create a script that could parse attachments that come from
 another
 server by mail. I could use crontab  pear pop to do the job. But maybe
 someone knows if it is possible to configure my server in such way that it
 could send mail attachments directly to my php script.

You can use smrsh (man smrsh) and write a PHP script as the target of a
re-direct in your sendmail.cf (?) file.

I've done it, so it can't be *THAT* tricky :-)

You could also use IMAP instead of POP, which might make the parsing bits
a bit easier.  I've done that too (ignoring attachments) so that also
can't be *THAT* tricky.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Maybe Newbie: PHP-scripts in sub-directories

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 5:43 am, Oliver Ekeis said:
 I'm very sorry to bother you, but I've wasted a week solving my problem
 and didn't find any solution in the net.

 On my dedicated server preinstalled with Linux Suse 9.0, Apache 2.0.48,
 PHP 4.3.3 in want to use php in subdirectories. In the main document root
 of apache my test.php (consisting of the simple phpinfo()-function)
 works fine. But if I copy the file in any subdirectory I get a error
 message
 like 'Premature end of script headers...'.

 Please tell me, what might be the reason for that?

Somehow, you've managed to crash PHP and/or Apache, I think...

Perhaps you've simply chosen a bad directory name which is already used by
httpd.conf for something special?

Try reading the http://bugs.php.net/ page for info garnering useful info
form core dumps.

It's also possible some sort of mod_rewrite rule in httpd.conf is kicking
in for sub-directories but not the main directory.

 Must there be a right configurated '.htaccess'-file? What must be
 inserted?
 Has it to do with rights (I gave the subdir 777-rights recursively to be
 sure)?

You shouldn't have had to do anything like that.

It should just work

Change the 777 back to something reasonable ASAP.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] plug-in forum

2005-04-05 Thread Chris W. Parker
Ryan A mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 3:07 PM said:

 a client wants me to add a forum to his existing site...which is not a
 problem, the problem is he wants it to work off his existing site
 
 eg:
 once someone logs in to the main site they dont have to relogin or
 create new accounts in the forum section
 a one login gets you total site access kind of deal.

I don't personally know of something that meets all these requirements,
and you might be hard pressed to find one (applications aren't generally
built with accomodating an unknown authentication system in mind).

One thing you could do is, when a new account is created on the main
site execute a script to add the same username/password to the forum's
db. Then within the forum software change it so that the authentication
page looks to session data for it's authentication info (i.e.
username/password) instead of from a form. In this way the user will be
seamlessly authenticated to the forum.

This means of course that you'll have to store the password of the user
in the session data which may or may not be a good idea.

 The second thing is, as clients go, these ar'nt too bright :-) a
 rea simple forum/forum admin is needed, I was looking at phpbb
 but after running a test install on my system i think it would be a
 little too complicated for them plus it has to sit into the existing
 design... recommendations please.

I don't know about this one. Maybe you could cull the admin section to
include only the necessary option and hide everything else from the
admin as to not overwhelm their puny brain.


HTH,
Chris.

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



Re: [PHP] Critical Thinking, or Several Why Questions

2005-04-05 Thread GamblerZG
 What fancy logic? And why does no one need it?
I'm referring to this:
http://archives.devshed.com/a/ng/557-22943/
 Now surely you can RTFM and find more answers. If you disagree with the
 way that some things work you have a couple of options;

 a. Contact the PHP development group and explain what you would like to
 happen.
 2. Write an extension yourself that 'fixes' the items you have questions
 about.
But the named issues are pretty obvious, so I assume that there are some 
reasons why things work as described. Maybe I use functions in the way 
they were not meant to be used. Maybe there are engine limitations... 
Manual (and believe me, I read it occasionaly) describes only what 
function does, not how it works inside, or why it works in this 
particular way.

PS: As I see from the manual on php.net, developers actually fixed 
microtime() in php 5. I either missed that example, or my manual is 
slightly outdated. Sorry. However, the rest of the questions still stand.

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


Re: [PHP] plug-in forum

2005-04-05 Thread Andre Dubuc
On Tuesday 05 April 2005 06:50 pm, Chris W. Parker wrote:
 Ryan A mailto:[EMAIL PROTECTED]

 on Tuesday, April 05, 2005 3:07 PM said:
  a client wants me to add a forum to his existing site...which is not a
  problem, the problem is he wants it to work off his existing site
 
  eg:
  once someone logs in to the main site they dont have to relogin or
  create new accounts in the forum section
  a one login gets you total site access kind of deal.

 I don't personally know of something that meets all these requirements,
 and you might be hard pressed to find one (applications aren't generally
 built with accomodating an unknown authentication system in mind).

 One thing you could do is, when a new account is created on the main
 site execute a script to add the same username/password to the forum's
 db. Then within the forum software change it so that the authentication
 page looks to session data for it's authentication info (i.e.
 username/password) instead of from a form. In this way the user will be
 seamlessly authenticated to the forum.

 This means of course that you'll have to store the password of the user
 in the session data which may or may not be a good idea.

  The second thing is, as clients go, these ar'nt too bright :-) a
  rea simple forum/forum admin is needed, I was looking at phpbb
  but after running a test install on my system i think it would be a
  little too complicated for them plus it has to sit into the existing
  design... recommendations please.

 I don't know about this one. Maybe you could cull the admin section to
 include only the necessary option and hide everything else from the
 admin as to not overwhelm their puny brain.


 HTH,
 Chris.


Might want to look at:

http://fudforum.org

hth,
Andre

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



RE: [PHP] plug-in forum

2005-04-05 Thread Chris W. Parker
Andre Dubuc mailto:[EMAIL PROTECTED]
on Tuesday, April 05, 2005 4:04 PM said:

 Might want to look at:
 
 http://fudforum.org
 
 hth,
 Andre

Andre,

Who are you responding to? Myself or to the op?



Chris.

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



Re: [PHP] plug-in forum

2005-04-05 Thread Andre Dubuc
On Tuesday 05 April 2005 07:16 pm, Chris W. Parker wrote:
 Andre Dubuc mailto:[EMAIL PROTECTED]

 on Tuesday, April 05, 2005 4:04 PM said:
  Might want to look at:
 
  http://fudforum.org
 
  hth,
  Andre

 Andre,

 Who are you responding to? Myself or to the op?



 Chris.


sigh - I guess both since I screwed it up again. Enjoy :

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



[PHP] Re: To session or not to session

2005-04-05 Thread Skrol 29
Hi,
SESSION feature connot be compared to POST and GET.
POST and GET are methods to transfer data from the client to the server.
SESSION is a method to keep the server in touch with the client, like 
COOKIES.
A SESSION works with an ID saved in a cookie, or recalled in the URL. The 
value of the session's ID has no sense for a hacker who read it. That's why 
SESSIONS are more secure than COOKIES for authentication.

I perfer POST to GET to have a better user interface. I think long or 
understandable URL are ugly.
But I use the GET syntax for pages that should be called simply by direct 
links (from another site from example).
The problem with POST is when the user click on Reload, but they are 
walkarounds.

I also prefer COOKIES to SESSIONS for common applications, this is just a 
habit and it enables users to not authenticate each time they come to the 
site. But I use SESSIONS when the application has to be more seriously 
secured.

I hope this helped,
---
Skrol 29
www.tinybutstrong.com
---
[EMAIL PROTECTED] a écrit dans le message de news: 
[EMAIL PROTECTED]
Hi all
I have been doing all my design by using POST to transfer user data and 
GET
for user changeable variables.

I would like to know what you guys think of using SESSION in production 
sites.

Right now I am giving a trust factor of 80% to POST and 0% on GET.  What 
trust
factor should I apply to SESSION

Should I implement a SESSIONless feature in case SESSION is not available?
I know the way to php.net for documentation but I'd like advice/opnions of
real people.
Thanks
Andy Pieters
--
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] plug-in forum

2005-04-05 Thread Ryan A
Hey,
Thanks, will look into it.

I did like this part the best though:
Maybe you could cull the admin section to
include only the necessary option and hide everything else from the
admin as to not overwhelm their puny brain.

hehe If only our clients knew how we speak about them or their computer
skills

Cheers,
-Ryan




On 4/6/2005 12:50:31 AM, Chris W. Parker ([EMAIL PROTECTED]) wrote:
 Ryan A mailto:[EMAIL PROTECTED]

 on Tuesday, April 05, 2005 3:07 PM said:



  a client wants me to add a forum to his existing site...which is not a

  problem, the problem is he wants it to work off his existing site

 

  eg:

  once someone logs in to the main site they dont have to relogin or

  create new accounts in the forum section

  a one login gets you total site access kind of deal.



 I
 don't personally know of something that meets all these requirements,
 and you might be hard pressed to find one (applications aren't
 generally

 built with accomodating an unknown authentication system in mind).



 One thing you could do is, when a new account is created on the main

 site execute a script to add the same username/password to the
 forum's
 db. Then within the forum software change it so that the authentication
 page looks to session data for it's
 authentication info (i.e.

 username/password) instead of from a form. In this way the user will be

 seamlessly authenticated to the forum.







-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 4/1/2005

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



[PHP] Re:Re: [PHP] dynamic image will not print properly

2005-04-05 Thread DuSTiN KRySaK
I wondered that myself, but all the other (not dynamic) images print 
fine!

d
On 5-Apr-05, at 4:51 PM, [EMAIL PROTECTED] wrote:
From: Andy Pieters [EMAIL PROTECTED]
Date: April 5, 2005 2:35:22 PM PDT
To: php-general@lists.php.net
Subject: Re: [PHP] dynamic image will not print properly
To test,
cstl.php?dk=somethinghere
and try to print that?
Maybe your browser is configured to NOT print images (or bakckground) ?
Maybe your printer is textonly (just kidding)
Tada
Andy

Re: [PHP] dynamic image will not print properly

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 2:26 pm, DuSTiN KRySaK said:
 Hi there - I had my first crack at creating a dynamic image. The thing
 is - the image is displayed fine in the browser, but when you go to
 print it, the image is either missing, or part of it is missing. Is
 there something special needed to print a dynamic image?

What you did, *should* work just fine.

But we're talking *MICROSOFT* here!

These people do *NOT* follow standards.  Period.

 Here is a code snippet used to create the image

 header(Content-type: image/jpg);
 $image = imagecreatefromjpeg(template_cpn.jpg);
 $red = imagecolorallocate( $image, 255,0,0 );
 imagestring($image, 2, 306, 200, $couponcode, $red);
 imagestring($image, 2, 306, 235, $exp, $red);
 imagestring($image, 2, 175, 338, $myname, $red);
 imagestring($image, 2, 175, 360, $myemail, $red);
 imagejpeg($image);
 imagedestroy($image);

 Now the way I have it set up, is that there is a PHP file that
 generates the image (the above code). Then I have a parent PHP page
 that calls that page like so:

 $theurl = cstl.php?dk=soemthinghere
 echo img src=\$theurl\;

 See any issues in my code or setup?

 Any ideas?

Here's what you do:  You make it *IMPOSSIBLE* for Microsoft to screw up.

This means you make your URL look JUST LIKE any other JPEG URL.

$theurl = cstl/dk=somethinghere/whatever.jpg;

Step 1:
Add/Create an .htaccess file with this:
Files cstl
  ForceType application/x-httpd-php
/Files
This forces Apache to treat the file named 'cstl' as a PHP script.

Step 2:
Rename cstl.php to just 'cstl' (see Step 1)

Step 3:
Instead of using $_GET['dk'] do this:
$pathinfo = $_SERVER['PATH_INFO'];
$pathinfo = explode('/', $pathinfo);
//Key-Value pairs:
$_PATH = array();
//Path information buried in URL for source image sub-directories:
$PATH = array();
while (list(, $keyval) = each($pathinfo)){
  $parts = explode('=', $keyval);
  switch(count($parts)){
case 0: break; //do nothing with bogus extra '/' in URL
case 1: $PATH[] = $keyval;
default:
  $key = $parts[0];
  unset($parts[0]);
  $_PATH[$key] = implode('=', $parts);
break;
  }
}

Now you can use $_PATH['dk'] instead of $_GET['dk'] to get your dk value
from the URL.  You'll only change $_GET to $_PATH in cstl (formerly
cstl.php) and you're all set.

Now, there is *NO* *WAY* Microsoft can manage to screw up your URL and
decide that it must not be a JPEG because it has GET data, or ends in .php
or whatever.

This same technique must be applied to PDF, FDF, SWF/Ming files if you
want to avoid a zillion MS IE bugs related to multi-media.

So you might as well put the code for $_PATH/$PATH in an include file.  I
guarantee you'll need it again and again as you use more and more
multi-media in your web-site.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] To session or not to session

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 2:24 pm, [EMAIL PROTECTED] said:
 I have been doing all my design by using POST to transfer user data and
 GET
 for user changeable variables.

 I would like to know what you guys think of using SESSION in production
 sites.

GET, POST, SESSION, Whatever it takes.

 Right now I am giving a trust factor of 80% to POST and 0% on GET.

No!

POST is *NOT* *NOT* *NOT* more secure than GET!

Okay, maybe a total goof can figure out how to munge GET, but can't figure
out how to Save As... and edit the HTML to POST whatever they want.

So you can put POST at 1% trust factor, if GET is 0%.  Whoopie.

 What
 trust
 factor should I apply to SESSION

Are you on a DEDICATED or SHARE server?

In either case, somebody out on the Internet has to break into your server
to get to your SESSION data.

BUT!

If you are on a SHARED server, then *all* other users with a login can,
without *too* much effort, write a PHP script to read your SESSION data.

You really can't prevent this, in practical [*] terms.

Think about it.  If *your* PHP script can read the SESSION data, then
*their* PHP script, which runs as the same user on the OS, with the same
permissions can *also* read the SESSION data.

* Impractical nitpik:
You could set up a separate pool of Apache processes for each host/domain,
with a different User setting in each httpd.conf for each
host/domain/httpd, but that's going to make your shared server pretty
impractical for *MOST* uses where you want a shared server in the first
place.

 Should I implement a SESSIONless feature in case SESSION is not available?

If SESSIONs are completely unavailable, from both Cookies and trans_sid
being turned *OFF* in php.ini, and/or no trans_sid and the user denying
Cookies...

I wouldn't recommend trying to roll your own.  Just require some kind of
session support, or call it quits.

Do test with Cookies *OFF*, however to be sure it works right with
non-Cookie browsers, and the Session ID should be passed in the URL.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] ImageMagick Versus GD

2005-04-05 Thread Richard Lynch
On Tue, April 5, 2005 1:05 am, [EMAIL PROTECTED] said:
 which one is better ImageMagick or GD?

 infact I am much more curious about their image processing speed and
 server
 load. especially resizing large imagefiles.

It probably depends more on your Machine's typical load/usage/processes
than anything else.

Benchmark for yourself in realistic conditions.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] strtotime() bug?

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 3:14 pm, Al said:
 Suddenly my strtotime() are goofy, anyone have any ideas?

 echo date('Y/m/d/H', time()). br; //2005/04/04/18
 echo date('Y/m/d/H', strtotime(-1 day)). br;
 //2005/04/03/18
 echo date('Y/m/d/H', strtotime(last Sunday)). br;   
 //2005/04/02/23

 Sunday shows as Saturday.

If the BIOS thinks you don't use Daylight Savings, but the OS thinks you
*DO* use Daylight Savings, but Locale thinks you don't use Daylight
Savings, but...

Or any variation on that theme.

This is just theory of what could be going wrong, without my delving too
deeply into what you typed...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] [Q] mail() security

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 2:00 pm, Eric Gorr said:
 I wanted to setup a good 'contact me' page on my website. I do not want
 to reveal my e-mail address, so I was going to use a form.

 The PHP script with the actual mail() function would define the To and
 Subject parameters, so these could not be faked.

 I also plan to use a captcha.

A what?

 The only concern I had was how to process the body text. Any
 recommendations?

 One useful function would appear to be strip_tags, so no one could embed
 annoying or destructive HTML, etc. which I may accidentally cause my
 e-mail application to render.

It's possible, though extremely unlikely, that somebody could construct a
malicious email that passes through strip_tags and/or htmlentities and
still does something *bad* for your particular email application.

htmlentities is going to be safe, but will convert HTML enhanced (cough,
cough) email into a bunch of junk you can't even read.   Which might be a
morally correct thing to do with HTML email anyway, but probably not all
that useful to even send it at that point.

Since you anticipate such a low volume, and seem concerned that you will
lose valuable info from an HTML-enhanced email, perhaps you should log the
original and provide a link to view it in the email you send to yourself.

So if you REALLY need that enhanced email, you can surf to it.

Of course, then your web-server/browser might be attacked by their code
you are viewing/executing (JavaScript).

You may also want to consider using a throttle on the form based on
$_SERVER['REMOTE_ADDR'] and if more than X emails are sent in Y hours from
the same IP, refuse to send it and send them to an error page.

I do this on sites where I forward blind emails to others, so they can't
get (easily) attacked with a DOS attack on their email by a script kiddie.

Certainly, it can be defeated by somebody who knows how to change their
IP, but it's a small hurdle to weed out some of the more clueless folks
who want to try to abuse your form.

You could also send them a Cookie, again easily defeated by the clueful,
as well as checking their IP to add another hurdle.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Creating INSERT INTO statement from dbf file

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 1:33 pm, Rahul S. Johari said:
 It works fine, except for one problem. It¹s able to create the INSERT INTO
 sql statement, with all the fields and corresponding values, but as I¹m
 running a loop for both the fields names, and the values corresponding to
 fields names, it leaves a comma after the records are over.

If having a flag to determine when to add the , or ' feels too kludgy, you
could also do something like:

$values = array();
while ($value...){
  $values[] = $value;
}
$values_sql = implode(, , $values);

It's a bit more memory-intensive than just chopping up a string, but I
find it more understandable, personally.  Others will differ, of course.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Adding Fonts to JpGraph

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 12:39 pm, Stephen Johnson said:
 I am using JPGraph for a project that I am working on right now and I have
 hit a small snag -

 My client wants to have the user be able to select from a list of about 20
 ­30 standard fonts.  JPGraph only has about six built into it and the
 support in the docs is not very helpful since it wants you to register it
 to
 get font support.  I am willing to do that, BUT, their website says they
 are
 no longer accepting support clients.

 So ‹ anyone out there have any advice our a tutorial that I can look at
 for
 some assistance ?

WILD GUESS

JPGraph just uses GD, right?

So the fonts available to GD are the fonts available to JPGraph, no?

See if you can find the six font files on your hard drive, and if that's
all there are in that directory, it could boil down to something as simple
as adding a bunch more font files in that directory.

'Course, the JPGraph guys may have hacked up something custom in the
source to limit you to six fonts...  You're on your own for that, but it's
Open Source, right?

Google for JPGraph and fonts and see who else has already solved this
problem and how.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Exchanging Data among processes

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 5:30 am, Matheus Degiovani said:
 How can I exchange data among processes (i.e. two or more users
 accessing a php webpage)? The two usual ways would be using either a
 database or file, so I was wondering if there is another, more fast
 (with reduced latency) for different pages being processed to exchange
 information.

Shared Memory.

http://php.net/shmop

Not for the faint of heart. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] create word files

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 2:07 am, Roman Duriancik said:
 I have problem with creating word file in PHP script. I create table in
 word document but sometimes php send me error message : *Warning*:
 (null)(): Invoke() failed: Exception occurred. *Source*: Microsoft Word
 *Description*: There is insufficient memory and then php script
 generate only word document without table.
 What can I do ?

WILD GUESSES!

Buy more RAM?

Put fewer entries in the table?

Use less text?

Try to make some other kind of document such as RTF that is less
memory-intensive than MS Word?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php - set interval

2005-04-05 Thread Richard Lynch
On Sun, April 3, 2005 7:10 pm, Andrew said:
 i've been searching for a 'setInterval' function in php and haven't had
 much luck.

http://php.net/sleep is kinda sort not like what you want.

A cron job might be what you want, depending on if you classify cron as
complicated server stuff or not.  I sure don't, but I've written a
zillion cron jobs over the years.

 so is this possible with PHP by using functions? anything involving
 complicated server stuff means i may as well setup flash to call the
 interval instead of PHP

As noted, you really *SHOULD* just queue up the emails for a GOOD mail
program to send out later, and not try to micro-manage this in PHP, unless
you're just doing this to learn PHP and try to understand how mail works.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] help with GD

2005-04-05 Thread Richard Lynch
On Sun, April 3, 2005 12:31 am, [EMAIL PROTECTED] said:
 is there any way to edit and resize animated gifs in PHP?
 with imagegif() i only get a static image

Not as far as I know...

Though I do recall seeing something about this on the GD page, so maybe
you want to look at adding that support to PHP...



-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] fpassthru(); corrupts files on win 5.0.4 ??

2005-04-05 Thread Richard Lynch
On Sun, April 3, 2005 12:11 am, Andras Kende said:

The only thing wrong I see is:

 $path = \\\server\ftpserver\\$company\\ . $file;

\\ is \
\s is, errr, I dunno.  You tell me.  What's \s
\f is, errr, I dunno.


Crank up your error_reporting, use wget (or whatever on Windows) to find
out what's actually getting sent, log what you think should be sent.

There's not enough code here for TOO much to go wrong.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Broken connection

2005-04-05 Thread Richard Lynch

Your script is dying at some point.

You're not seeing any error messages in your browser or your logs.

So you need to crank up the error_reporting, check all return codes, and
*DO* something useful when you encounter invalid data and error codes.

Nobody can tell you much more than that without a bit more info about
what's broken, since all you've told us is what you fixed.

On Sat, April 2, 2005 2:49 pm, Andy Pieters said:
 Hi everybody

 I am new on this list.

 I want you to know that I would like to use this list to get help and to
 provide assistance to others as well.

 I picked up php in octobre last and have become quite good with it.
 Didn't
 touch php 5 yet though.

 So to start with a problem of mine.

 I made a cms as per client request. And designed it with PHP 4.3+ in mind.
 The cms works perfectly only my client has run in some servers that are
 running PHP 4.1 and do not (can not, won't) upgrade.

 So I am working on a backport for PHP 4.1

 I am almost there and most of the system's already running.  I added sha1
 calculation from a script I found about because sha1 is not yet
 implemented
 in php 4.1.  I also let go of using stream_set_timeout as it is not
 essential.

 I got stuck and banged my head quite some time on this.  When I try to
 open a
 page, I get broken connection error in konquerour.  (Firefox just shows
 me
 a null page)

 I have tried many things already to get some usable debugging info on this
 but
 it seems that shutdown functions aren't executed either.

 Strangly enough googling to know what the 'broken connection' error's
 about in
 this context proved unsuccessfull


 I thank you for your time and bid you good day


 With kind regards



 Andy Pieters
 Straight-A-Software

 A young idealistic programmer

 --
 Registered Linux User Number 379093
 --
 Feel free to check out these few
 php utilities that I released under the GPL2 and
 that are meant for use with a php cli binary:
 http://www.vlaamse-kern.com/sas/
 --

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Printing

2005-04-05 Thread Richard Lynch
On Sat, April 2, 2005 9:03 am, Niels Riis Kristensen said:
 I am using a Unix machine (Mac) but can't find ways to print to my
 local printer. Plenty of information about printing from a PC, but none
 from a mac. Can that be, that you can't print from php to mac?

First, get printing to work AT ALL on the machine.  If your text editor or
browser can't print, PHP ain't gonna be able to either, most likely.

Next, see if you can figure out what command line is being used to make
things print...  Sometimes you can force an error (turn off the printer as
you print) and get something to puke out on the screen or into
/var/log/messages or...

Finally, whatever that command line is, use http://php.net/exec to make it
happen in PHP.  You'll also need to be aware of the PHP User and what
their permissions are -- Try to 'su' to that user in a terminal window and
do the command to print from the command line.

Oh yeah:  Start with a dirt simple text file:
 test.txt --
Hello World


If you can't get that to print, it's unlikely you'll get fancy stuff like
PostScript to work...  Though sometimes it goes the other way, and PS
prints fine, but text refuses.  Go figure.

In all OSes, I find printer setup the most painful experience for
something that virtually every normal user is supposed to be able to do
this...  WHY?!

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] filtering uploaded files

2005-04-05 Thread Richard Lynch




On Sat, April 2, 2005 6:35 am, Marek Kilimajer said:
 Angelo Zanetti wrote:
 hi Richard this sounds like quite a serious subject but is there no
 other way to check the validity of the file and type without using the
 unix command?

 IE using PHP and not depending on system commands? thanks for your
 insight so far, very important.

 The equivalent of `file` command is mime_content_type() php function (if
 enabled). Other alternatives are to use fgetcsv() to check if the file
 is a csv file, imagesize() to check for image files, and similar.

 But you can never be 100% sure the file is completely valid without
 checking the whole file. For example mime_content_type() and imagesize()
 check only first few bytes, but the rest of the file might be junk.

Calling imagecreatefromXYZ on it would check that at least it SEEMS like a
valid XYZ file for images -- Of course, I'm sure somebody can craft an
image that will not return an error code for those functions and do
something malicious under certain circumstances.

It's also possible, though unlikely, that calling imagecreatefromXYZ (or
even getimagesize) will trigger the malicious code in and of itself.

Can you afford the time to call createimagefromXYZ?  I dunno.

Only you can evaluate the risk/benefit and time/resources trade-offs to
decide what's secure enough

Security is a gradient, not an on/off switch.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Retrieve URL of website

2005-04-05 Thread Richard Lynch
var_dump($_SERVER);

should provide you with sufficient info to piece together what you need.



On Fri, April 1, 2005 9:36 pm, HarryG said:
 Thanks guys.

 HarryG [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Hi,

 I want to retrieve the complete url in my php script. How can I do this?

 eg. www.mysite.com/mydirectory/mypage.php

 Result should either be www.mysite.com/mydirectory/mypage.php or
 /mydirectory/mypage.php

 Thanks in advance
 HarryG

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Recommendation for a MySql wrapper class

2005-04-05 Thread Richard Lynch
On Sat, April 2, 2005 5:41 am, Ryan A said:
 so although this is new to me, I know there are a lot of PHP gurus on the
 list and i'm sure this is not new to themI was hopeing someone could
 recommend a class they are using as I am starting a new project on monday
 and dont have the time to test each class before picking one (honest guys,
 there are a lot, you gotto browse them to belive it)
 I dont need anything fancy just something that gets the job donesafely
 and effectivly.

Here's the thing:

Depending on your DATA that *YOU* expect, you'll need different scrubbing
functions.

For example, if your script expects and ID (auto_increment) and a big ol'
blob of text for a bulletin board posting, you're going to scrub those two
COMPLETELY differently.

?php
  $id = abs( (int) $_REQUEST['id'] );
  $text = mysql_escape_string($_REQUEST['text']);
?

You could maybe find some kind of class/package that has some pre-defined
types of data and scrubbers to go through them, and you'd do something
like:

?php
  $id = scrubber($id, 'int+'); //'int+' == postive integer
  $text = scrubber($text, 'mysql'); //'mysql' == MySQL data
?

That ain't really gonna save you much, is it?

And keeping track of all those different kinds of possible data types to
scrub for is gonna be a real PAIN.

Plus, invariably, you'll have some kind of data where a good scrubbing is
not going to be covered by the available types in the scrubber function.

So, basically, you're probably best off really thinking about what you
*EXPECT* and *ALLOW* for each and every variable independently and just
coding that.

You can also do something like this:

?php
  //This should be scrubbed, but not sure how much:
  $text = $_REQUEST['text'];
  //So, for now, let's see what FAILS my current test, but not actually
implement the scrubbing until we've tried it for awhile:
  if (preg_match('/[^a-zA-Z0-9]/', $text)){
error_log($text would have failed  . __FILE__ .   . __LINE__);
  }
  $text = mysql_escape_string($text);
?

Do some testing first with users you know and trust NOT to intentionally
sabotage you, then try to find some nasty things that you SHOULD be
catching, and play with the characters you *ACCEPT* until you're happy.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



  1   2   >