php-general Digest 14 Oct 2004 09:35:50 -0000 Issue 3052

Topics (messages 199424 through 199462):

Installing PHP 5.0.2 on Fedora Core 2
        199424 by: Don
        199436 by: Greg Donald

Re: ezmlm-sub or alternative
        199425 by: Mark Hubert
        199447 by: Jason Wong

hy problems with php 5.01 installation !
        199426 by: Nicolae Serban
        199437 by: Greg Donald

deleting multiple items from a database
        199427 by: Adil
        199434 by: Jay Blanchard
        199438 by: Robby Russell
        199440 by: Curt Zirzow

.htaccess and .htpasswd
        199428 by: Afan Pasalic
        199429 by: Matthew Sims
        199430 by: Matt M.
        199431 by: Afan Pasalic
        199432 by: John Nichel
        199433 by: Afan Pasalic
        199461 by: Mulley, Nikhil

Re: php err msg/issue...
        199435 by: Curt Zirzow

rename() on NT
        199439 by: Jed R. Brubaker

question about mkdir() and ownership permissions
        199441 by: Jason FB
        199448 by: Jason Wong

Re: mail problems - phpinfo information
        199442 by: Jason Wong

Re: Security patch from 4.3.8 to 4.3.9
        199443 by: Jason Wong
        199453 by: Steve Brown

Determine variable with the lowest value?
        199444 by: BOOT
        199445 by: Greg Donald
        199446 by: Jason Wong
        199457 by: BOOT

Re: Image upload not working correctly
        199449 by: Jason Wong

Re: Form Validation
        199450 by: Mattias Thorslund

Re: Working out the image path...partly solved, please have a look at my code
        199451 by: Mag

Adding TEXT over an Image
        199452 by: GH
        199454 by: Mattias Thorslund
        199455 by: GH
        199458 by: Thomas Goyne
        199460 by: GH

' (Single Quotes) in user inputs
        199456 by: Ben
        199459 by: John Holmes

Help with sessions problem please
        199462 by: Graham Cossey

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi,
 
I'm getting an error trying to install PHP 5.0.2 on a fresh Fedora Core 2
installation:
 
"Sorry, I cannot run apxs
apxs was not found"
 
I verified this by searching the drive, it is not there.  Is Apache
installed by default without using --enable-so ?
 
If so, what can I do?????
 
Thanks,
Don

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.776 / Virus Database: 523 - Release Date: 10/12/2004
 

--- End Message ---
--- Begin Message ---
On Wed, 13 Oct 2004 15:55:46 -0400, Don <[EMAIL PROTECTED]> wrote:
> I'm getting an error trying to install PHP 5.0.2 on a fresh Fedora Core 2
> installation:
> 
> "Sorry, I cannot run apxs
> apxs was not found"
> 
> I verified this by searching the drive, it is not there.  Is Apache
> installed by default without using --enable-so ?
> 
> If so, what can I do?????

Search the mailing list archives, a very similar if not exact issue
was discussed just last week:

http://marc.theaimsgroup.com/?l=php-general


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Thanks so much for the insight which is a much simpler way.

I successfully set up a test page (a form) that takes email to, from, subject and body and sends it.

<?php
$emailto=$_GET['emailto'];
$emailfrom=$_GET['emailfrom'];
$emailsub=$_GET['emailsub'];
$emailbody=$_GET['emailbody'];
$headers = "From: <$emailfrom>\r\n";
$headers .=     "Return-Path: <$emailfrom>\r\n";
if(mail($emailto, $emailsub, $emailbody, $headers)) {
        echo"Email Sent";
        exit;
}
echo "Email Error";
?>

However, when I send a message to subscribe to the EZMLM list, it sends ok, but doesn't get added to the list. When I send a test message to myself I noticed that the Return-path in the email sent is not what I set in my script, but that of the apache user. I wonder if that is where the EZMLM-sub gets the address for submission and is sending the confirmation to the dead mailbox.

Any insight?

Thanks,

Mark



On Oct 11, 2004, at 8:55 PM, James McGlinn wrote:

Hi Mark,

I'm writing a little script (my 3rd) that takes name (first, last) and email address
and writes it to txt file and submits the email address to an EZMLM list server.

All is well but I'm not sure where to go for the submission.

The command line - ezmlm-sub works (from the shell)... if the user is root or vpopmail.

 Is there a safe way to run the shell command via a php script?
Or can someone suggest another way to submit an address to ezmlm.

You can make use of the public interface to ezmlm-sub by sending an email to <listname>[EMAIL PROTECTED]

You'll need to set the 'From:' header of your emails to the address of your subscriber.

You can find information on the mail() function at http://www.php.net/mail


James McGlinn Project Manager BCom, BSc, Zend Certified Engineer (PHP)

Servers.co.nz Ltd
68 Shortland St, Auckland PO Box 3688 Shortland St, Auckland, New Zealand
Phone: 0800 4 SERVERS Fax: +64 9 358 5187

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



--- End Message ---
--- Begin Message ---
On Thursday 14 October 2004 04:01, Mark Hubert wrote:

> However, when I send a message to subscribe to the EZMLM list, it sends
> ok, but doesn't get added to the list. When I send a test message to
> myself I noticed that the Return-path in the email sent is not what I
> set in my script, but that of the apache user. I wonder if that is
> where the EZMLM-sub gets the address for submission and is sending the
> confirmation to the dead mailbox.

http://zend.com/lists/php-general/200410/msg00887.html

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Yow!  We're going to a new disco!
*/

--- End Message ---
--- Begin Message ---
I try to install php 5.01 on Windows 2003 Server with Apache 2.052 !
I try to install as Module and as Cgi !! ( i restart the server if you
asking of that :-) )

When i try an test.php (  just phpinfo(); ) in the web page apears
just the code of the test.php !!!

When i try to install as module i have no error ! 

Thankyou , !
-- 
<------------------------------------------------->
<---- Nicolae Serban  -------------------->
<--- http://e-dream.dtedu.net --------->
<------------------------------------------------->

--- End Message ---
--- Begin Message ---
On Wed, 13 Oct 2004 23:06:29 +0300, Nicolae Serban
<[EMAIL PROTECTED]> wrote:
> I try to install php 5.01 on Windows 2003 Server with Apache 2.052 !
> I try to install as Module and as Cgi !! ( i restart the server if you
> asking of that :-) )
> 
> When i try an test.php (  just phpinfo(); ) in the web page apears
> just the code of the test.php !!!
> 
> When i try to install as module i have no error !
> 
> Thankyou , !

You missed a step somewhere!

Try, try again!

http://www.php.net/manual/en/install.windows.apache2.php !


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Hey everyone, I'm trying to delete multiple records from a database using
PHP. I have a file list page which shows each entry in the database with a
checkbox next to it.  At the bottom of the page is a "Delete" button.  A
user should be able to check as many items on the file list and hit delete
which would cause all checked items to be wiped from the database.

Unfortunately I'm running into really erratic behavior with this.  First the
page worked fine on Mac(in the Safari browser) but not on IE  on any OS.
Now I can only delete the first time in the list but ONLY in Safari once
more.

As far as the code goes what I'm doing is retrieving each record from the
database and assigning the "value" attribute of each checkbox the unique id
from the database.  From that point on, when a checkbox is checked and the
delete button is pressed, I push each checked unique id into an array and
then call a function that cycles through the array and deletes each database
entry.  The last step is a simple page refresh.   I'm posting some of the
more relevant sections of the code I've used below:

echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
//form declaration
echo "<input type=\"submit\" value=\"Delete\"value=\"Submit\">";
//The delete button
    <td><input type=\"checkbox\"
value=\"{$row['upload_id']}\"></input><br/></td>";        //This is what the
checkbox is coded as
    $stack[] = $row['upload_id'];        //This should get pushed into an
array called stack when the delete button is hit(and it does when I echo it
out, so this part works)
 echo "</form>";

 if (isset($_POST['stack'])) {
    deleteFiles();        //This checks to see if the array stack is not
empty, and if not it calls this function which is declared as shown below.
}


function deleteFiles() {
    foreach($_POST['stack'] as $i) {        //This should work but I can't
tell if it is or isn't
         mysql_query("DELETE FROM uploads WHERE upload_id =" . "$i");
    }
   header("Location: http://"; . $_SERVER['PHP_SELF']);        //forces a
page refresh to show the file list without the items that were deleted.
}


I appreciate any help I can get on this.
Thank you
Adil.

--- End Message ---
--- Begin Message ---
[snip]
function deleteFiles() {
    foreach($_POST['stack'] as $i) {        //This should work but I
can't
tell if it is or isn't
         mysql_query("DELETE FROM uploads WHERE upload_id =" . "$i");
    }
[/snip]

Try print_r $_POST['stack'] and see what you get.

--- End Message ---
--- Begin Message ---
On Wed, 2004-10-13 at 16:11 -0400, Adil wrote:
> function deleteFiles() {
>     foreach($_POST['stack'] as $i) {        //This should work but I
> can't
> tell if it is or isn't
>          mysql_query("DELETE FROM uploads WHERE upload_id =" . "$i");
>     }
>    header("Location: http://"; . $_SERVER['PHP_SELF']);        //forces
> a
> page refresh to show the file list without the items that were
> deleted.
> }

For sanity of your mysql database, you might consider making this one
query.

Something like
DELETE FROM table WHERE id IN (32,34,46,432,35);

generating your list of numbers/ids from your array...

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
* Thus wrote Adil:
> 
> As far as the code goes what I'm doing is retrieving each record from the
> database and assigning the "value" attribute of each checkbox the unique id
> from the database.  From that point on, when a checkbox is checked and the
> delete button is pressed, I push each checked unique id into an array and
> then call a function that cycles through the array and deletes each database
> entry.  The last step is a simple page refresh.   I'm posting some of the
> more relevant sections of the code I've used below:
> 
> echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
> //form declaration
> echo "<input type=\"submit\" value=\"Delete\"value=\"Submit\">";
> //The delete button
>     <td><input type=\"checkbox\"
> value=\"{$row['upload_id']}\"></input><br/></td>";        //This is what the
> checkbox is coded as

This is your problem, you need to give the checkbox a name:
<input type="checkbox" name="stack[]" value="...">

When the form is submitted $_POST['stack'] will contain an array of
items that were checked.


Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message ---
# .htaccess
AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/www/html/path/to/file/admin/.htpasswd"
require valid-user

# .htpasswd
Admin:ChqaxtiTH1e0E

Both files are in same directory.

Why it doesn't work?

Can I use as AuthUserFile ".htpasswd" since they are in the same directory?

I know its not smart but let's get this working and I'll move .htpasswd later to "upper level" :)



-afan
--- End Message ---
--- Begin Message ---
> # .htaccess
> AuthType Basic
> AuthName "Restricted Area"
> AuthUserFile "/www/html/path/to/file/admin/.htpasswd"
> require valid-user
>
> # .htpasswd
> Admin:ChqaxtiTH1e0E
>
> Both files are in same directory.
>
> Why it doesn't work?
>
> Can I use as AuthUserFile ".htpasswd" since they are in the same
> directory?
>
> I know its not smart but let's get this working and I'll move .htpasswd
> later to "upper level" :)
>
>
>
> -afan


Dude...do you know what mailing list you're on?

http://httpd.apache.org/lists.html

-- 
--Matthew Sims
--<http://killermookie.org>

--- End Message ---
--- Begin Message ---
try an apache mailing list.

--- End Message ---
--- Begin Message ---
Oops!
Sorry guy, sent to wrong place!

I apology.
:)

-afan

Matt M. wrote:
try an apache mailing list.


.


--- End Message ---
--- Begin Message --- Afan Pasalic wrote:
# .htaccess
AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/www/html/path/to/file/admin/.htpasswd"
require valid-user

# .htpasswd
Admin:ChqaxtiTH1e0E

Both files are in same directory.

Why it doesn't work?

Can I use as AuthUserFile ".htpasswd" since they are in the same directory?

I know its not smart but let's get this working and I'll move .htpasswd later to "upper level" :)

Did my filter throw an Apache mailing list email into my php folder?

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

--- End Message ---
--- Begin Message ---
Yes, I sent it on wrong place.
:)

Sorry.

-afan



Matthew Sims wrote:
# .htaccess
AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/www/html/path/to/file/admin/.htpasswd"
require valid-user

# .htpasswd
Admin:ChqaxtiTH1e0E

Both files are in same directory.

Why it doesn't work?

Can I use as AuthUserFile ".htpasswd" since they are in the same
directory?

I know its not smart but let's get this working and I'll move .htpasswd
later to "upper level" :)



-afan



Dude...do you know what mailing list you're on?

http://httpd.apache.org/lists.html


--- End Message ---
--- Begin Message ---
Can I know the platform on which you are running apache.

-----Original Message-----
From: Matthew Sims [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 14, 2004 1:57 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] .htaccess and .htpasswd


> # .htaccess
> AuthType Basic
> AuthName "Restricted Area"
> AuthUserFile "/www/html/path/to/file/admin/.htpasswd"
> require valid-user
>
> # .htpasswd
> Admin:ChqaxtiTH1e0E
>
> Both files are in same directory.
>
> Why it doesn't work?
>
> Can I use as AuthUserFile ".htpasswd" since they are in the same
> directory?
>
> I know its not smart but let's get this working and I'll move .htpasswd
> later to "upper level" :)
>
>
>
> -afan


Dude...do you know what mailing list you're on?

http://httpd.apache.org/lists.html

-- 
--Matthew Sims
--<http://killermookie.org>

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

--- End Message ---
--- Begin Message ---
* Thus wrote bruce:
> curt...
> 
> when i print $rs, i get the following:
> displaying $rs shows that $rs is:
> 
> ResultSet Object (
>....
> [rows] => Array ( )                 <<<<<<<<<<<<<<<
> [pos] => 0                         <<<<<<<<<<<<<<<<<
>...

> when i print $rs->pos, i get '0'
> 
> so are you saying that the code can't handle '$rs->rows[0] = $rec'

Thats different than what you originally had:
  $rs->rows[0]->fields = $rec

php is being friendly and creating an object before assigning the
variable (to a non-existing array element). The error you are
getting is because you have E_STRICT included in your
error_reporting level.  

;E_STRICT      - run-time notices, enable to have PHP suggest changes
                 to your code which will ensure the best interoperability
                 and forward compatibility of your code

> if this is the case, how can this be corrected....

$rs->rows[0] = new stdClass();
$rs->rows[0]->fields = $rec;

Curt.
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message ---
Can this be done when the file already exists?

 cleong at organic dot com says
29-Mar-2000 04:36
rename() doesn't seem to overwrite files on NT. The behavior is an 
OS-dependent side-effect I guess.

on the PHP site @ http://us2.php.net/manual/en/function.rename.php

So this this true, or is there some work around that doesn't involve 
unlinking the file first?

Thanks!

--- End Message ---
--- Begin Message ---
PHP General List,

I am trying to use mkdir() on a shared unix server to create a directory within my home space. I have to have the ability for my user on this server to upload to this folder, however I think that mkdir() creates the directory and makes it owned by the process running Apache -- nobody, httpd, or apache depending on the system (which is someone else's so I don't know)

I get permission denied when I try to upload to these folders.

I suppose I could use mkdir and specify the mode as 0777 to give broad write access to these folders, but I always thought this was a security risk.

Does anyone know how I can create a directory which is owned by my user account on this server-- or have any other creative suggetions?

Thanks.

Jason FB
--- End Message ---
--- Begin Message ---
On Thursday 14 October 2004 06:02, Jason FB wrote:

> Does anyone know how I can create a directory which is owned by my
> user account on this server-- or have any other creative suggetions?

If you have it, use FTP.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Ask not for whom the Bell tolls, and you will pay only the station-to-station
rate.
                -- Howard Kandel
*/

--- End Message ---
--- Begin Message ---
On Thursday 14 October 2004 01:10, Matthew Sims wrote:

> The mail settings in php.ini is for Windows only. When using PHP on
> Unix/Linux, mail() always defaults to the sendmail binary on localhost. So
> you can ignore what it says in phpinfo.

That's incorrect. The 

  sendmail_path =

setting is very much a un*x only setting (although for most standard server 
setups you never need to change it).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Intel CPUs are not defective, they just act that way.
                -- Henry Spencer
*/

--- End Message ---
--- Begin Message ---
On Thursday 14 October 2004 00:55, Jay Blanchard wrote:
> [snip]
> Hello, I would like to know if there is a patch just for the security
> fix from PHP-4.3.8 to PHP-4.3.9 and where can I found it.
> [/snip]
>
> Looking at http://www.php/net/downloads I do not see one.

Maybe that's why the OP asked? Anyway I don't see the reason why one would 
want a patch. Surely bandwidth can't be an issue? And applying a patch would 
most certainly mean taking the webserver offline briefly as would a full 
upgrade.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The first version always gets thrown away.
*/

--- End Message ---
--- Begin Message ---
> Hello, I would like to know if there is a patch just for the security
> fix from PHP-4.3.8 to PHP-4.3.9 and where can I found it.

4.3.8 -> 4.3.9 is not a security fix, i.e. there are no security holes
closed in 4.3.9.  From the 4.3.9 announce:

"PHP Development Team is proud to announce the immediate release of
PHP 4.3.9.  This is a maintenance release that in addition to over 50
non-critical bug fixes, addresses a problem with GPC input
processing."

Steve

--- End Message ---
--- Begin Message ---
Any help with this would be appreciated.

I am trying to come up with something that will find which variable(s) have
the lowest value and inidicate which variable this is. In the event that
variables have an equally low value then it is to randomly pick one of the
variables and idicate which this is.

I have been able to do this by means of if comparisons but the more I
variables I add then the more complicated and messy it becomes. There has to
be a simpler way. If it makes any difference, the variables could just as
easily be array elements.

example:

$a = 2
$b =2
$c= 4
$d= 5
$e=6
$f =7

the code should determine that $a and $b have the lowest value, and randomly
pick one of them. if $a was = 1 instead then it would just pick $a


Thanks for any suggestions!

--- End Message ---
--- Begin Message ---
On Wed, 13 Oct 2004 17:19:28 -0500, BOOT <[EMAIL PROTECTED]> wrote:
> the code should determine that $a and $b have the lowest value, and randomly
> pick one of them. if $a was = 1 instead then it would just pick $a
> 
> Thanks for any suggestions!

Use an array.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
On Thursday 14 October 2004 06:19, BOOT wrote:

[snip]

> I have been able to do this by means of if comparisons but the more I
> variables I add then the more complicated and messy it becomes. There has
> to be a simpler way. If it makes any difference, the variables could just
> as easily be array elements.

So stick them into an array and use one of the many array functions.

> the code should determine that $a and $b have the lowest value, and
> randomly pick one of them. if $a was = 1 instead then it would just pick $a

The "randomly pick one" part you would have to code yourself.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
It's amazing how much better you feel once you've given up hope.
*/

--- End Message ---
--- Begin Message ---
Thanks guys. Yes I figured using an array and the MIN function would be a
start.

Now the random part.....




"Boot" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Any help with this would be appreciated.
>
> I am trying to come up with something that will find which variable(s)
have
> the lowest value and inidicate which variable this is. In the event that
> variables have an equally low value then it is to randomly pick one of the
> variables and idicate which this is.
>
> I have been able to do this by means of if comparisons but the more I
> variables I add then the more complicated and messy it becomes. There has
to
> be a simpler way. If it makes any difference, the variables could just as
> easily be array elements.
>
> example:
>
> $a = 2
> $b =2
> $c= 4
> $d= 5
> $e=6
> $f =7
>
> the code should determine that $a and $b have the lowest value, and
randomly
> pick one of them. if $a was = 1 instead then it would just pick $a
>
>
> Thanks for any suggestions!

--- End Message ---
--- Begin Message ---
On Thursday 14 October 2004 02:40, Dave Grant wrote:

> echo "Thumb image uploaded to ".$thumbPath."<br />\n";
> echo "Full image uploaded to ".$fullPath."<br />\n";

Do these look OK?

> Everything works fine, except that the images are simply not there when we
> go look for them.  The best explanation I can come up with is that they are
> not moved, but I have no idea why.  I've done this with no problem on my
> personal site.  Is it a problem with the move_uploaded_file function?  Any
> ideas?

What does the PHP error log say?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Faith goes out through the window when beauty comes in at the door.
*/

--- End Message ---
--- Begin Message --- There are several JavaScript solutions for validating forms on the client side. Search on hotscripts.com and google.com.

Client-side validation (in the browser) is useful, but you shouldn't depend on it to guarantee that the data that your users submit is valid. You should also validate the data in your PHP script as you process the form.

Oh, and there are several PHP-based list managers available, for instance phplist, so you may not need to program it yourself.

/Mattias

Huang, Ou wrote:

I am currently working on a newsletter mailing list project and
developed a form in php. I would like to validate before it is
submitted. What would be the best way to validate a form? Write your own
routines or using a form validator. I just started learning PHP, so
don't have much experience on this. I am thinking using a form validator
but not sure where I can get it.

Any suggestions would be appreciated!

Thanks.





--
More views at http://www.thorslund.us

--- End Message ---
--- Begin Message ---
Hey Matt,


> > /../imgs/blah.jpg should return
> > http://www.textx.com/t1/t2/imgs/blah.jpg
> > 
> > but its returning:
> > http://www.textx.com/t1/t2/t3/imgs/blah.jpg
> > 
> > and this: /../../imgs/blah.jpg
> > should return:
> http://www.textx.com/t1/imgs/blah.jpg
> > 
> > but its returning:
> > http://www.textx.com/t1/t2/imgs/blah.jpg
> > 
> > in both cases one extra level directory :-(
> > 
> > Any ideas?



> ok, I gave it a try and honestly this is probably
> over my head :) but
> here is something to try


Nope, no go...but dont worry about it, most of the PHP
gurus on the list have not replied so I guess it was
beyond them too....so where do we mere mortals have a
chance :-D

Will leave it as as for now and come back to it at a
later date i guess.

Thanks for trying.
Mag


 
> <?php
> 
> $url='http://www.textx.com/t1/t2/t3/blah.html';
> 
> function ret_url($rel_path, $base = '')
> {
>       $base_path = substr($base, 0, strpos($base,
> '/',7));
> 
>       if(substr($rel_path,0,1)=='/' &&
> strpos($rel_path,'/../') === false)
>       {  
>               return $base_path.$rel_path; 
>       }
> 
>         elseif(strpos($rel_path,'://') > 0)
>                 {  return $rel_path; }
> 
>         else {  
>               return collapse(dirname($base),$rel_path); 
>       }
> 
> return $rel_path;
> }
> 
> /* this function removes the /../ parts */
> function collapse($path,$rel_path)
> {
>       
>       $parsed = parse_url($path);
>       preg_match_all('/\/\.\./',$rel_path, $matches); 
>       if(($count = count($matches[0])) > 0) {
>               $parts = preg_split('/\//', $parsed['path'], -1,
> PREG_SPLIT_NO_EMPTY);
>               for ($i = 1;$i <= $count; $i++) {
>                       array_pop($parts);
>               }
>               $path = str_replace($parsed['path'],
> '/'.implode($parts,'/'), $path);
>       }
> 
>       $rel_path = (preg_match('/^\//',$rel_path)) ?
> $rel_path :'/'.$rel_path;
>       $path = preg_replace('/\/\.\./', '',
> $path.$rel_path);
>       
>       return $path;
> }
> 
> 
> $uris = array();
> $uris[] = '/blah.jpg';
> $uris[] ='/imgs/blah.jpg';
> $uris[] ='imgs/blah.jpg';
> $uris[] ='../imgs/blah.jpg';
> $uris[] ='/../imgs/blah.jpg';  // ## not working ##
> $uris[] ='/../../imgs/test.jpg'; // ## not working
> ##
> $uris[] ='http://some-site-blah.com/imgs/blah.jpg';
> 
> echo '<table border=1>';
> foreach($uris as $uri)
> {
> echo '<tr><td>'.htmlspecialchars($uri).'</
>
td><td>'.htmlspecialchars(ret_url($uri,$url)).'</td></tr>';
> }
> echo '</table>';
> ?>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

--- End Message ---
--- Begin Message ---
Good Evening:

 I would like to know if it is possible to add text over an image. If
so can someone please help me with it?

 Here is what I would like to do. I currently have a "random masthead"
that I pull from my database (the location of the image is stored
there with other info such as credits and description)

I would like to overlay on top of the Masthead the words
"Administration Mode" without me having to create a duplicate copy of
the original mastheads and save them again... I would like to be able
to just have a bit of code that would add on top.  I ask this because
I have too many masthead options right now that it would be infeasable
for me to create duplicates of each one to just add Administration
Mode as an overlay.

Thank You.
Gary 

I am new to PHP and currently am runing PHP 4

--- End Message ---
--- Begin Message --- With PHP, use GD to print your text on a copy of your image.. Look at the image functions in the manual:
http://us2.php.net/manual/en/ref.image.php

- Or -

With CSS, use "background-image" to load the image behind your text:

#header {
        background: #90a090;
        background-image: url('/header.jpg');
}


<h1 id="header">Administration Mode</h1>


/Mattias



GH wrote:

Good Evening:

I would like to know if it is possible to add text over an image. If
so can someone please help me with it?

Here is what I would like to do. I currently have a "random masthead"
that I pull from my database (the location of the image is stored
there with other info such as credits and description)

I would like to overlay on top of the Masthead the words
"Administration Mode" without me having to create a duplicate copy of
the original mastheads and save them again... I would like to be able
to just have a bit of code that would add on top.  I ask this because
I have too many masthead options right now that it would be infeasable
for me to create duplicates of each one to just add Administration
Mode as an overlay.

Thank You.
Gary

I am new to PHP and currently am runing PHP 4





--
More views at http://www.thorslund.us

--- End Message ---
--- Begin Message ---
I was actually looking for a PHP version... I heard that there were
image editing/creationg features....


On Wed, 13 Oct 2004 19:32:37 -0700, Mattias Thorslund
<[EMAIL PROTECTED]> wrote:
> With PHP, use GD to print your text on a copy of your image..  Look at
> the image functions in the manual:
> http://us2.php.net/manual/en/ref.image.php
> 
> - Or -
> 
> With CSS, use "background-image" to load the image behind your text:
> 
> #header {
>        background: #90a090;
>        background-image: url('/header.jpg');
> }
> 
> <h1 id="header">Administration Mode</h1>
> 
> /Mattias
> 
> 
> 
> 
> GH wrote:
> 
> >Good Evening:
> >
> > I would like to know if it is possible to add text over an image. If
> >so can someone please help me with it?
> >
> > Here is what I would like to do. I currently have a "random masthead"
> >that I pull from my database (the location of the image is stored
> >there with other info such as credits and description)
> >
> >I would like to overlay on top of the Masthead the words
> >"Administration Mode" without me having to create a duplicate copy of
> >the original mastheads and save them again... I would like to be able
> >to just have a bit of code that would add on top.  I ask this because
> >I have too many masthead options right now that it would be infeasable
> >for me to create duplicates of each one to just add Administration
> >Mode as an overlay.
> >
> >Thank You.
> >Gary
> >
> >I am new to PHP and currently am runing PHP 4
> >
> >
> >
> 
> 
> --
> More views at http://www.thorslund.us
> 
>

--- End Message ---
--- Begin Message ---
Which is exactly what the first link is.

On Wed, 13 Oct 2004 22:42:04 -0400, GH <[EMAIL PROTECTED]> wrote:

I was actually looking for a PHP version... I heard that there were
image editing/creationg features....


On Wed, 13 Oct 2004 19:32:37 -0700, Mattias Thorslund <[EMAIL PROTECTED]> wrote:
With PHP, use GD to print your text on a copy of your image..  Look at
the image functions in the manual:
http://us2.php.net/manual/en/ref.image.php

- Or -

With CSS, use "background-image" to load the image behind your text:

#header {
       background: #90a090;
       background-image: url('/header.jpg');
}

<h1 id="header">Administration Mode</h1>

/Mattias




GH wrote:

>Good Evening:
>
> I would like to know if it is possible to add text over an image. If
>so can someone please help me with it?
>
> Here is what I would like to do. I currently have a "random masthead"
>that I pull from my database (the location of the image is stored
>there with other info such as credits and description)
>
>I would like to overlay on top of the Masthead the words
>"Administration Mode" without me having to create a duplicate copy of
>the original mastheads and save them again... I would like to be able
>to just have a bit of code that would add on top.  I ask this because
>I have too many masthead options right now that it would be infeasable
>for me to create duplicates of each one to just add Administration
>Mode as an overlay.
>
>Thank You.
>Gary
>
>I am new to PHP and currently am runing PHP 4
>
>
>


-- More views at http://www.thorslund.us






-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

http://www.smempire.org
--- End Message ---
--- Begin Message ---
I'm sorry all that I originally saw on my screen was the CSS part



On Wed, 13 Oct 2004 20:22:07 -0700, Thomas Goyne
<[EMAIL PROTECTED]> wrote:
> Which is exactly what the first link is.
> 
> 
> 
> On Wed, 13 Oct 2004 22:42:04 -0400, GH <[EMAIL PROTECTED]> wrote:
> 
> > I was actually looking for a PHP version... I heard that there were
> > image editing/creationg features....
> >
> >
> > On Wed, 13 Oct 2004 19:32:37 -0700, Mattias Thorslund
> > <[EMAIL PROTECTED]> wrote:
> >> With PHP, use GD to print your text on a copy of your image..  Look at
> >> the image functions in the manual:
> >> http://us2.php.net/manual/en/ref.image.php
> >>
> >> - Or -
> >>
> >> With CSS, use "background-image" to load the image behind your text:
> >>
> >> #header {
> >>        background: #90a090;
> >>        background-image: url('/header.jpg');
> >> }
> >>
> >> <h1 id="header">Administration Mode</h1>
> >>
> >> /Mattias
> >>
> >>
> >>
> >>
> >> GH wrote:
> >>
> >> >Good Evening:
> >> >
> >> > I would like to know if it is possible to add text over an image. If
> >> >so can someone please help me with it?
> >> >
> >> > Here is what I would like to do. I currently have a "random masthead"
> >> >that I pull from my database (the location of the image is stored
> >> >there with other info such as credits and description)
> >> >
> >> >I would like to overlay on top of the Masthead the words
> >> >"Administration Mode" without me having to create a duplicate copy of
> >> >the original mastheads and save them again... I would like to be able
> >> >to just have a bit of code that would add on top.  I ask this because
> >> >I have too many masthead options right now that it would be infeasable
> >> >for me to create duplicates of each one to just add Administration
> >> >Mode as an overlay.
> >> >
> >> >Thank You.
> >> >Gary
> >> >
> >> >I am new to PHP and currently am runing PHP 4
> >> >
> >> >
> >> >
> >>
> >>
> >> --
> >> More views at http://www.thorslund.us
> >>
> >>
> >
> 
> 
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
> 
> http://www.smempire.org
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
I am running into a problem with user input when a user inputs a single 
quote in the form field, such as entering O'Brien as a last name.  When the 
user enters this, PHP adds a \ in front of the single quote, and then if the 
form is submitted again, adds a \ in front of the \ and again in front of 
the single quote.  Example:

<INPUT TYPE="TEXT" NAME="lastName" VALUE="$lastName">

if the user enters a name containing a single quote, such as O'Brien, it 
becomes

<INPUT TYPE="TEXT" NAME="lastName" VALUE="O\'Brien">

Upon submitting the form again, it become

<INPUT TYPE="TEXT" NAME="lastName" VALUE="O\\\'Brien">

Any ideas on dealing with this would be greatly appreciated.

Thanks.

Ben 

--- End Message ---
--- Begin Message ---
Ben wrote:

I am running into a problem with user input when a user inputs a single quote in the form field, such as entering O'Brien as a last name. When the user enters this, PHP adds a \ in front of the single quote, and then if the form is submitted again, adds a \ in front of the \ and again in front of the single quote. Example:

<INPUT TYPE="TEXT" NAME="lastName" VALUE="$lastName">

if the user enters a name containing a single quote, such as O'Brien, it becomes

<INPUT TYPE="TEXT" NAME="lastName" VALUE="O\'Brien">

Upon submitting the form again, it become

<INPUT TYPE="TEXT" NAME="lastName" VALUE="O\\\'Brien">

Any ideas on dealing with this would be greatly appreciated.

Search the manual for magic_quotes_gpc and stripslashes()...

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
I'm having a bad day with sessions which hopefully someone can help me with.

A user logs in to my 'site' (script1.php) and I store relevant details in a
session, all fine. I redirect to another page (script2.php) which checks and
retrieves certain session values, all fine. My problem is with script3.php
which happens to be within an iframe in script2.php. When the user is
automatically passed to that page, from log in, the session details are not
available but if the user makes a (menu) selection the session values are
available to script3.php within the iframe. help !

Simplified code:

script1.php
<?php
  session_start();
  [some code]
  $_SESSION['user'] = $_POST['user'];
  [some code]
  $hdr = "Location: script2.php?".SID;
  header($hdr);
?>

script2.php
<?php
  session_start();
  if (!isset($_SESSION['user']))
      Header("Location: ../index.htm"); << Does not redirect.
  [some code]
  <iframe name="content" src="script3.php">
    Your browser does not support the use of frames.
  </ifame>
  [some code]
?>

script3.php
<?php
  session_start();
  print_r($_SESSION); << outputs Array()
  [some code]
?>

If you need any specific info on my config just ask and I'll try and supply
it.

TIA
Graham

--- End Message ---

Reply via email to