OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
[suspicious - maybe spam] php-general Digest 31 Aug 2005 20:15:30 -0000 Issue 3656

php-general-digest-helplists.php.net
Date: Wed Aug 31 2005 - 15:15:30 CDT


php-general Digest 31 Aug 2005 20:15:30 -0000 Issue 3656

Topics (messages 221634 through 221664):

Re: security while building online store
        221634 by: dino.php.co.ba
        221635 by: Shafiq Rehman

Re: (Yet another) I'm blind ... post
        221636 by: Mark Rees
        221637 by: Murray . PlanetThoughtful
        221646 by: John Nichel

Mktime strange
        221638 by: Hal 9001 Consulting
        221639 by: Robin Vickery

stupid (HTML) question
        221640 by: William Stokes
        221641 by: Jay Blanchard
        221642 by: François-Xavier LACROIX
        221647 by: Jesper Gran
        221651 by: Raz

String format problem
        221643 by: Ahmed Abdel-Aliem
        221645 by: Robin Vickery
        221653 by: Philip Hallstrom
        221654 by: tg-php.gryffyndevelopment.com
        221657 by: Satyam
        221663 by: Jim Moseby

time zone problem
        221644 by: Sergey
        221660 by: Satyam

Re: SPL Countable count() not being called
        221648 by: Justin Francis
        221649 by: Jay Blanchard

[suspicious - maybe spam] RE: [suspicious - maybe spam] PHP/MySQL/XmlHTTPRequest
        221650 by: Miguel Guirao

Writing to a text file
        221652 by: JesterXL

running process in the background
        221655 by: Georgi Ivanov
        221659 by: Jordan Miller

Re: upload file - clients path to file?
        221656 by: cron.odi.com.br

weird results from imagettfbbox()
        221658 by: Aaron Todd
        221662 by: Philip Hallstrom

Making Text [not the background] transparent
        221661 by: Graham Anderson

Nested IFs Problem
        221664 by: Albert Padley

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

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

attached mail follows:


afanafan.net wrote:
> kat

Dzesi momak ;)

I think you know PHP enough to make your code secure.
Just take care (as Christian wrote)about sql-injections and
register_globals.

The biggest problem could be Linux/Apache/MySQL server security threat...

---
avast! Antivirus: Outbound message clean.

attached mail follows:


You must read the articles by shiflet
http://www.phpgurru.com/index.php?acion=paging&chid=www.shiflett.org&offset=10

On 8/31/05, dinophp.co.ba <dinophp.co.ba> wrote:
>
> afanafan.net wrote:
> > kat
>
> Dzesi momak ;)
>
> I think you know PHP enough to make your code secure.
> Just take care (as Christian wrote)about sql-injections and
> register_globals.
>
> The biggest problem could be Linux/Apache/MySQL server security threat...
>
>
> ---
> avast! Antivirus: Outbound message clean.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
*** phpgurru.com <http://phpgurru.com> [A php resource provider] ***

\\\|///
\\ - - //
( ) PHP is too logical for my brain
+---oOOo-(_)-oOOo------------------------------------------+
| Mian Shafiq ur Rehman
| phpgurru.com <http://phpgurru.com> [A php resource provider]
| 107 B, New Town, Multan Road
| Lahore Pakistan
|
| Mobile: 0300 423 9385
|
| ooo0 http://www.phpgurru.com
| ( ) 0ooo E-Mail: rehmanmsgmail.com
+---\ (----( )------------------------------------------+
\_) ) /
(_/

attached mail follows:


"Martin S" <shieldfiregmail.com> wrote in message
news:9A.B5.15098.BE654134pb1.pair.com...
> In this code, I'm not getting the value of $list passed to the Mailman
page.
> I've checked this umpteen times by now, but fail to see the error. I've

$list is not to be found in this code sample. $lista is though.

> beaten myself suitably with a steel ruler -- but it didn't help. Nor does
> the cold I'm coming down with I suppose.
>
> Anyone see the error, and feel like pointing it out to me?
>
> Martin S
>
> <?php
> print "<H2><B>Join the lists</b></H2>";
> print "<FORM Method=POST
> ACTION='http://www.bollmora.org/mailman/subscribe/' . $lista . '><br>'";
> print "Your E-mail address: <INPUT type=\"Text\" name=\"email\"
size=\"30\"
> value=\"\"><br>";
> print "Your Name (optional): <INPUT type=\"Text\" name=\"fullname\"
> size=\"30\" value=\"\"><br><br>";
> print "Lista: <select name=\"lista\" />";
> print "<option value=\"tvl_bollmora.org\">Tävling</option>";
> print "<option value=\"jpg_bollmora.org\">JGP</option>";
> print "<option value=\"styrelse_bollmora.org\">Styrelse</option>";
> print "</select><br>";
> print "You may enter a privacy password below. This provides only mild
> security, but should<br>
> prevent others from messing with your subscription. <b>Do not use a
> valuable password</b> as it<br>
> will occasionally be emailed back to you in cleartext.<br><br>
> If you choose not to enter a password, one will be automatically
generated
> for you, and it will<br>
> be sent to you once you've confirmed your subscription. You can always
> request a mail-back<br>
> of your password when you edit your personal options.<br><br>";
> print "Would you like to receive list mail batched in a daily digest?
(You
> may choose NoMail after you join.)<BR><br>";
> print "<input type=radio name=\"digest\" value=\"0\" CHECKED> No <input
> type=radio name=\"digest\" value=\"1\"> Yes<br><br>";
> print "<INPUT type=\"Submit\" name=\"email-button\"
value=\"Subscribe\">";
> print "</FORM>";
> ?>

attached mail follows:


> In this code, I'm not getting the value of $list passed to the Mailman
> page.
> I've checked this umpteen times by now, but fail to see the error. I've
> beaten myself suitably with a steel ruler -- but it didn't help. Nor does
> the cold I'm coming down with I suppose.
>
> Anyone see the error, and feel like pointing it out to me?
>
> Martin S

Hi Martin,

Try checking for the value in $_POST['lista'] on your subscribe page.
Failing that, try the following:

print_r($_POST);

This should give you all the variables and values being sent by the form to
the page being used to process that form.

Hope this helps.

Much warmth,

Murray
---
"Lost in thought..."
http://www.planetthoughtful.org

attached mail follows:


Martin S wrote:
> In this code, I'm not getting the value of $list passed to the Mailman page.
> I've checked this umpteen times by now, but fail to see the error. I've
> beaten myself suitably with a steel ruler -- but it didn't help. Nor does
> the cold I'm coming down with I suppose.
>
> Anyone see the error, and feel like pointing it out to me?
>
> Martin S
>
> <?php
> print "<H2><B>Join the lists</b></H2>";
> print "<FORM Method=POST
> ACTION='http://www.bollmora.org/mailman/subscribe/' . $lista . '><br>'";
<snip>

$list or $lista?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Hello,

I've got a problem with mktime. It's a very strange behaviour, I don't know
if is a bug:

echo date ("M-d-Y", mktime (0,0,0,07,07,2005)); -> Jul-07-2005 (right)
echo date ("M-d-Y", mktime (0,0,0,08,07,2005)); -> Dec-07-2004 (?????????)

Can anyone help me to solve this question? Is it a bug?

Regards

attached mail follows:


On 8/31/05, Hal 9001 Consulting <infohal9001.it> wrote:
> Hello,
>
> I've got a problem with mktime. It's a very strange behaviour, I don't know
> if is a bug:
>
>
> echo date ("M-d-Y", mktime (0,0,0,07,07,2005)); -> Jul-07-2005 (right)
> echo date ("M-d-Y", mktime (0,0,0,08,07,2005)); -> Dec-07-2004 (?????????)
>
> Can anyone help me to solve this question? Is it a bug?

Numbers with leading zeros are octal. 08 is not a valid octal number,
and is interpreted as 0.

The solution is to not use leading zeros...

echo date ("M-d-Y", mktime (0,0,0,8,7,2005)); -> Aug-07-2005

-robin

attached mail follows:


Embarrassed to ask but how to vertically align a table to a middle of a
page?

Forgot... ...didn't even find it with even Dreamweaver...

:-0

-Will

attached mail follows:


[snip]
Embarrassed to ask but how to vertically align a table to a middle of a
page?
[/snip]

Use CSS.

attached mail follows:


I don't think you can do a vertical centering.
but you can specify a margin-top value to your table...
fx

>Embarrassed to ask but how to vertically align a table to a middle of a
>page?
>
>Forgot... ...didn't even find it with even Dreamweaver...
>
>:-0
>
>-Will
>
>
>

--
François-Xavier LACROIX http://www.clever-age.com
Clever Age - conseil en architecture technique
GSM: +33 6 11 03 23 77 - Tél: +33 1 53 34 66 10

Clever Age vous invite à ses petits-déjeuners du Jeudi
http://www.clever-age.com/actualites/petits-dejeuners/

attached mail follows:


An easy way to center a table, is to put it in another table:

<table border="1" width="100%" height="100%">
    <tr>
        <td align="center" valign="middle">
            <table border="1"><tr><td>Hello</td><td>world</td></tr></table>
        </td>
    </tr>
</table>

/Jesper

attached mail follows:


Will

As suggested by Monsieur Jay, a bit of CSS...

....
<style type="text/css">
.centerTable {
        text-align: center;
}
.centerTable table {
        position: absolute;
        top: 50%;
        left: 50%;
        width: tableWidth;
        height: tableHeight;
        margin-left: -(tableWidth/2)px;
        margin-top: -(tableHeight/2)px;
}

</style>

.....

<div class="centerTable">
<table border="1">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
</div>

HTH

Raz

attached mail follows:


hi
i have a problem when i am formating a string
the problem is it converts the \n in the string to a new line
here is the code

<?
$Text = "D:\AppServ\www\intranet\admin\store\nodirectory\sub";
$Replace = "D:\AppServ\www\intranet\admin\store";
$with = "http://localhost/bank/admin/store";

//$doc = str_replace ($Replace, $with, $Text);
$doc = str_replace( '\\', '/', str_replace( $Replace, $with, $Text ) );

echo $doc;

//i need $Doc to look like this
http://localhost/bank/admin/store/nodirectory/sub
//but it outputs http://localhost/bank/admin/store odirectory/sub

?>
can any one help me with that plz
thanks in advance

--
Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789

attached mail follows:


On 8/31/05, Ahmed Abdel-Aliem <me2reshgmail.com> wrote:
> hi
> i have a problem when i am formating a string
> the problem is it converts the \n in the string to a new line
> here is the code
>
> <?
> $Text = "D:\AppServ\www\intranet\admin\store\nodirectory\sub";
> $Replace = "D:\AppServ\www\intranet\admin\store";
> $with = "http://localhost/bank/admin/store";

Don't use double quotes if you don't want escape sequences to be expanded.

$Text = 'D:\AppServ\www\intranet\admin\store\nodirectory\sub';
$Replace = 'D:\AppServ\www\intranet\admin\store';
$with = 'http://localhost/bank/admin/store';

  -robin

attached mail follows:


> hi
> i have a problem when i am formating a string
> the problem is it converts the \n in the string to a new line
> here is the code
>
> <?
> $Text = "D:\AppServ\www\intranet\admin\store\nodirectory\sub";
> $Replace = "D:\AppServ\www\intranet\admin\store";
> $with = "http://localhost/bank/admin/store";
>
> //$doc = str_replace ($Replace, $with, $Text);
> $doc = str_replace( '\\', '/', str_replace( $Replace, $with, $Text ) );
>
> echo $doc;
>
> //i need $Doc to look like this
> http://localhost/bank/admin/store/nodirectory/sub
> //but it outputs http://localhost/bank/admin/store odirectory/sub

Replace your double quotes with single quotes... that is:

$Text = 'D:\AppServ\www\intranet\admin\store\nodirectory\sub';
$Replace = 'D:\AppServ\www\intranet\admin\store';
$with = 'http://localhost/bank/admin/store';

attached mail follows:


To elaborate on Philip's response (which is correct)...

Anything in double quotes (" ") will be interpreted by PHP before figuring out what the actual value is. Items like \n, \t, etc are therefore converted to a newline (\n) or a tab (\t) before assigning to the variable. Variables within the double quotes are also evaluated before assigning. So..

$firstname = "Bob";
$lastname = "Smith";
$varname = "$firstname $lastname told me to find the file in folder C:\newtext\";
echo $varname;

Will yield:

Bob Smith told me to find the file in folder C:
ewtext";

Actually it'll give you an error because the double quotes aren't properly terminated.. \" is also interpreted.

Whereas..
$varname = '$firstname $lastname told me to find the file in folder C:\newtext\';
echo $varname;

Yields..

$firstname $lastname told me to find the file in folder C:\newtext\

In this case, you have two options to get what you want:

$varname = "$firstname $lastname told me to find the file in folder C:\\newtext\\";

..or..

$varname = $firstname . ' ' . $lastname told me to find the file in folder C:\newtext\';

I've read "never use double quotes unless you have to" because it could potentially speed up PHP a little because it won't be trying to interpret every string. I'm not sure exactly how much savings this is going to give you so I drop this in the "whatever your style dictates" category. I prefer double quotes because I think it visually delineates the code better and I think "$firstname $lastname" looks tidier than $firstname . ' ' . $lastname even though I do consider it slightly looser coding practices. One's better for the human, one's better for the machine (imo) and since I'm a human..... I think. :)

-TG

= = = Original message = = =

> hi
> i have a problem when i am formating a string
> the problem is it converts the \n in the string to a new line
> here is the code
>
> <?
> $Text = "D:\AppServ\www\intranet\admin\store\nodirectory\sub";
> $Replace = "D:\AppServ\www\intranet\admin\store";
> $with = "http://localhost/bank/admin/store";
>
> //$doc = str_replace ($Replace, $with, $Text);
> $doc = str_replace( '\\', '/', str_replace( $Replace, $with, $Text ) );
>
> echo $doc;
>
> //i need $Doc to look like this
> http://localhost/bank/admin/store/nodirectory/sub
> //but it outputs http://localhost/bank/admin/store odirectory/sub

Replace your double quotes with single quotes... that is:

$Text = 'D:\AppServ\www\intranet\admin\store\nodirectory\sub';
$Replace = 'D:\AppServ\www\intranet\admin\store';
$with = 'http://localhost/bank/admin/store';

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

attached mail follows:


<tg-phpgryffyndevelopment.com> wrote in message
news:E1EAUy8-0006ZH-PFwww11.dixiesys.com...
> To elaborate on Philip's response (which is correct)...
[....]
>
>
> I've read "never use double quotes unless you have to" because it could
> potentially speed up PHP a little because it won't be trying to interpret
> every string.

I once did some trials with thousand repetitions of segments of code with
different alternatives, so let me go through all of them since I have the
numbers anyway. The original was in Spanish so I'll just give the results.

The question started with using echo or print and, as the manual says, echo
is, indeed, faster:

echo "uno $f tres ": 3.04
print "uno $f tres ": 3.70

The numbers after the colons are the execution times of one against the
other for a lot of repetitions, anyhow, they should be read as relative to
one another.

Next, most people don't know that echo accepts multiple arguments separated
by commas. Separating the arguments with commas is faster.

echo 'uno ' . ' dos ' . ' tres ': 1.32
echo 'uno ' , ' dos ' , ' tres ': 0.94

In fact, this is a poor example since the difference gets larger with longer
string and more arguments. When you use dots, the interpreter has to
actually concatenate the string, looking for memory to do so and freeing it
up afterwards. This takes time. With commas, each argument is sent to the
output stream as soon as it is found, no further processing is needed in
between.

Then the single vs. double quotes:

echo 'uno ' , ' dos ' , ' tres ': 0.94
echo "uno " , " dos " , " tres ": 6.76

Once again, these are relative times but it means using double quotes is 7
times slower than single quotes

Several different alternatives with variables involved:

echo 'uno ' . $f . ' tres ': 7.38
echo 'uno ' , $f , ' tres ': 0.80
echo "uno $f tres ": 3.04
echo <<<EOT
    uno $f tres
EOT: 3.29

Notice that when variables are involved, the difference in between echoing
with arguments separated with commas and separated with dots is more than 9
times faster for the commas. Using double quotes with variable expansion
is almost 4 times slower than the commas, but is still faster than
concatenating them externaly with dots. Using heredoc-style strings is not
so bad compared to double quotes.

So, if you are sending out the rule would be:
Use echo, not print. Separate arguments with commas.

Now, if you are not using echo, for example, concatenating to a variable,
the best is to use variable expansion inside double quoted or heredoc
strings. Concatenating with dots is more than twice as slow.

Satyam

attached mail follows:


> hi
> i have a problem when i am formating a string
> the problem is it converts the \n in the string to a new line
> here is the code
>
> <?
> $Text = "D:\AppServ\www\intranet\admin\store\nodirectory\sub";
> $Replace = "D:\AppServ\www\intranet\admin\store";
> $with = "http://localhost/bank/admin/store";

Use single quotes instead of double quotes:

$Text = 'D:\AppServ\www\intranet\admin\store\nodirectory\sub';
$Replace = 'D:\AppServ\www\intranet\admin\store';
$with = 'http://localhost/bank/admin/store';

JM

attached mail follows:


Hi!
I some problem:
I have visitor's IP, country and city. I need to define his GMT offset.
Have you such database GMT's offsets.
I found many such list in Google but many countries has different GMT's
(Russia - 7!).
Any idea?

attached mail follows:


Go to:

http://www.timeanddate.com/worldclock/custom.html?cities=51,31,1038,224,179

The numbers at the end are my personal selection of cities I care about, but
you can change it and the cities database is a long one. It is updated for
daylight savings when applicable.

Satyam

""Sergey"" <vangoggmail.com> wrote in message
news:94.1E.15098.280B5134pb1.pair.com...
> Hi!
> I some problem:
> I have visitor's IP, country and city. I need to define his GMT offset.
> Have you such database GMT's offsets.
> I found many such list in Google but many countries has different GMT's
> (Russia - 7!).
> Any idea?

attached mail follows:


Justin Francis wrote:

> I have not been able to get count() to be called when I pass my
> Countable class to the count function. I am using PHP 5.1 Release
> Candidate 1. I am not sure if it is a bug, so I am posting here to see
> if anyone can help.
> --------------------------
> class Collection implements Countable
> {
> public function count()
> {
> return 200;
> } }
>
> $c = new Collection();
> echo(count($c));
> ----------------------------
> This code prints 1 out with no errors, when it should print out 200.
>
> Any ideas?
>
In case anyone was wondering, I downloaded the latest cvs snapshot, and
this bug has been fixed.

Justin

attached mail follows:


[snip]
> ----------------------------
> This code prints 1 out with no errors, when it should print out 200.
>
> Any ideas?
>
In case anyone was wondering, I downloaded the latest cvs snapshot, and
this bug has been fixed.
[/snip]

Bug? There is no bug. You counted 1 (one) item, not 200.

attached mail follows:


there is a book coming out in October I guess, do a search on amazon under
AJAX.

Also, at www.phparch.com the August issue deals with AJAX between other
things. You can buy a digital copy (PDF) for only 3.45 dlls.

Regards,
Chicolinux

-----Original Message-----
From: Death Gauge [mailto:clay_hghotmail.com]
Sent: Martes, 30 de Agosto de 2005 02:51 p.m.
To: php-generallists.php.net
Subject: [suspicious - maybe spam] PHP/MySQL/XmlHTTPRequest

Where do I go learn about XmlHTTPRequest? I've done googles and all I've
found was stuff about toolkits no tutorials or documents telling how to use
it.
--Death Gauge
"How do you gauge your death?!"

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever.

attached mail follows:


I have 2 servers; one running *nix w/ PHP4, and one running Windows 2k w/
PHP5; neither of which give me read permissions to write/create text files.
Apparently, the *nix server has PHP in "Power Mode", but I'm still getting
no love from fopen, and chmod via PHP doesn't work.

Any adivce?

Code skrait from the docs:

// Let's make sure the file exists and is writable first.
  if(is_writable($filename))
  {
   // In our example we're opening $filename in append mode.
   // The file pointer is at the bottom of the file hence
   // that's where $somecontent will go when we fwrite() it.
   if (!$handle = fopen($filename, 'w'))
   {
    echo("Cannot open file ($filename)<br />");
    exit;
   }

   $somecontent = " ";
   // Write $somecontent to our opened file.
   if(fwrite($handle, $somecontent) === FALSE)
   {
    echo("Cannot write to file ($filename)<br />");
    exit;
   }

   echo("Success, wrote ($somecontent) to file ($filename)<br />");

   fclose($handle);
  }
  else
  {
   echo "The file $filename is not writable<br />";
   if (!chmod($filename, 0666))
   {
    echo "Cannot change the mode of file ($filename)<br />";
    exit;
   }
  }

attached mail follows:


Hi,
I'm experiencing strange behavior when trying to run background process in
PHP.
Code :
//Run_check.php
foreach ($_POST as $kid){
        `php run.php param1 param2 > /dev/null &`;
}
In this case PHP waits all the instances of the process to complete.
I don't understand why.

I have a workaround here, but anyway i don't understand why the above example
doesn't work.

If i don't run the cycle here , but run other file and there run the cycle
that runs the the background processes everything is OK.

------------------------------------
/*This file gets $_POST , implodes it , and passes the string to the other
script */
//Run_check.php
$ids=implode(',',$_POST);
` php run1.php $ids`;
------------------------------------

------------------------------------
/*This script takes the input , explodes it and runs a cycle that runs the
background process*/
//run1.php :

$kwid=explode(',',$argv[1]);
foreach ($kwid as $kid){
        `php run.php param1 param 2 > /dev/null &`;
}
------------------------------------
Everything is OK.

attached mail follows:


Oh wait... you are not specifying your $_POST variable. you need to
use the key for $_POST. just do a print_r($_POST) to find the key
from the $_POST array that you are looking for. also, i would not
pass a $_POST variable directly to your shell without escaping it
somehow, first...

foreach ($_POST[$key] ...

Jordan

> Did you try also sending stderr to /dev/null rather than stdout only?
>
> I think the syntax is to add a "2>&1":
> foreach ($_POST as $kid){
> `php run.php param1 param2 > /dev/null 2>&1 &`;
> }
>
> This should put each process in the background and suppress all
> errors and output. Does that work?
>
> Jordan
>
>
>
> On Aug 31, 2005, at 11:44 AM, Georgi Ivanov wrote:
>
>
>> foreach ($_POST as $kid){
>> `php run.php param1 param2 > /dev/null &`;
>> }
>>
>
>

attached mail follows:


Interaction to write to a input file type is denied in browsers not to read
the value so you can can get the full path using JavaScript like any other
input in the form(document.formname.inputname.value) and pass it to other
input field lets say input fullpath using something like
document.formname.fullpath = document.formname.inputname.value <-- all using
javascript

So yes you can get the fullpath however you should redirect your question
to a JavaScript List or perhaps a javascript-php list.

Regards

Angelo

----- Original Message -----
From: "Jasper Bryant-Greene" <jasperbryant-greene.name>
To: <php-generallists.php.net>
Sent: Tuesday, August 30, 2005 7:14 AM
Subject: Re: [PHP] upload file - clients path to file?

> angelozlogic.co.za wrote:
> > I havent found an answer after looking at the manual. I'm trying to find
> > out if it possible to find the path of the file on the clients pc once
> > a form has been submitted with the file upload form.
> > I know its possible to get the file name but I need the whole path.
> > is this possible?
>
> Not with pure PHP. Maybe with some JavaScript, but most browsers heavily
> limit any interaction with <input type="file"> controls from JavaScript.
> So probably not at all.
>
> --
> Jasper Bryant-Greene
> Freelance web developer
> http://jasper.bryant-greene.name/
>
> If you find my advice useful, please consider donating to a poor
> student! You can choose whatever amount you think my advice was
> worth to you. http://tinyurl.com/7oa5s
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I have an array of strings in which I am passing to imagettfbbox() in order
to calculate the height of the text box for each string. I am then
subtracting the height from the y position in order to deviate the pivot
point form the top left corner to the bottom left corner when I used
imagettftext() to draw the text on an image. I am giving both commands a
fontsize of 50, an angle of 0 and I am using the font ARIAL.

I am having an issue where the first string comes back with a height of 50
and the next comes back with 47. Then 50 again for the next following
string and then 47 again for the next one foloowing that. It keeps going on
and on like this and I do not understand why. I am using the same font,
font size, and angle for each string so shouldnt they all come back as the
same size?

Here's a snippet of what I am doing:

  $file = "this can be any file";
  $im = imagecreatefromjpeg($file);

  $textcolor = imagecolorallocate($im, 0, 0, 0);
  $fontfile = "arial.ttf";
  $fontsize = 50;

  $arr = split("CR", $_GET['text']);

  $boxes = count($arr);
  if (preg_match('/[0-9]/', $boxes)){
    for($c=0;$c<$boxes;$c++){
      $text = stripslashes($arr[$c]);
      $y = $fontsize * $c;
      $bbox = imagettfbbox($fontsize, 0, $fontfile, $text);
      $dy = $bbox[7] - $bbox[1];
      $py = $y-$dy;

      imagettftext($im, $fontsize, 0, 1, $py, $textcolor, $fontfile, $text);
    }
  }

  header("Content-type: image/jpeg");
  imagejpeg($im, "" ,95);
  imagedestroy($im);

attached mail follows:


> I have an array of strings in which I am passing to imagettfbbox() in order
> to calculate the height of the text box for each string. I am then
> subtracting the height from the y position in order to deviate the pivot
> point form the top left corner to the bottom left corner when I used
> imagettftext() to draw the text on an image. I am giving both commands a
> fontsize of 50, an angle of 0 and I am using the font ARIAL.
>
> I am having an issue where the first string comes back with a height of 50
> and the next comes back with 47. Then 50 again for the next following
> string and then 47 again for the next one foloowing that. It keeps going on
> and on like this and I do not understand why. I am using the same font,
> font size, and angle for each string so shouldnt they all come back as the
> same size?

Is each line of the file the same? It's going to vary depending on what
letters are in the string (ascenders and descenders for letters like
qygpi, etc.).

maybe that's it?

>
> Here's a snippet of what I am doing:
>
> $file = "this can be any file";
> $im = imagecreatefromjpeg($file);
>
> $textcolor = imagecolorallocate($im, 0, 0, 0);
> $fontfile = "arial.ttf";
> $fontsize = 50;
>
> $arr = split("CR", $_GET['text']);
>
> $boxes = count($arr);
> if (preg_match('/[0-9]/', $boxes)){
> for($c=0;$c<$boxes;$c++){
> $text = stripslashes($arr[$c]);
> $y = $fontsize * $c;
> $bbox = imagettfbbox($fontsize, 0, $fontfile, $text);
> $dy = $bbox[7] - $bbox[1];
> $py = $y-$dy;
>
> imagettftext($im, $fontsize, 0, 1, $py, $textcolor, $fontfile, $text);
> }
> }
>
> header("Content-type: image/jpeg");
> imagejpeg($im, "" ,95);
> imagedestroy($im);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


How do I make the text transparent over the background ?

In my web app, I want to to put a layer BEHIND the image to control the
color of the php-created text
So, the layer color in the web app shows thru the text php creates....
Would like to use alpha transparency so the color looks clean :)

how would I amend the below script to do this ?

many thanks
g

header("Content-type:".$mime); //$mime = image/png
$im = imagecreatetruecolor(200, 16); //use to draw a text box

imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
$left = 5; //add a little pad to the left edge
$color = imagecolorallocate($im, 255, 255, 255);
$fontSize = 11;

// choose a font
$fontPath = "/home/siren/fonts/";
$defaultFont = "tahomabd.ttf";
$fontName = "arial.ttf";
$font = $fontPath.$fontName ;
if (! file_exists($font)) {
    $font = $fontPath.$defaultFont ;
}

$text= "background color shows through the text" // Add the text
imagettftext($im, $fontSize, 0, 10, 13, $color, $font, $text);
imagepng($im);
readfile($im);
imagedestroy($im);

attached mail follows:


I have the following nested ifs:

if ($row['date'] < '2005-10-02') {
             if ($row['time'] < '12:00') {
                 if ($row['field'] == 'P5' ) {

                     echo "<td class=\"tabletextbluebg\">Success";

}
}
}

else {

         echo "<td class=\"tabletextred\">Failed";
}
</td>

Whenever the 3 if statements are true, I always get the correct
"Success" to echo. However, if any or all of the if statements are
false, I never get "Failed" to echo.

I know it's something simple, but I just can't see it at the moment.

TIA

Albert Padley