[PHP] apache htaccess mod rewrite with php querystring urls

2004-08-12 Thread raisinlove
Hi, I realize this isnt specificaly related to php, but most php 
developers are familiar with this.

My website uses an index.php file to load all content with a template, 
using urls like so:

http://www.foo.com/index.php?page=splash.html
In the same directory, there is a file called splash.html, but what I 
would like to do is that if the source file is called, the php file 
would load instead. So typing in:

http://www.foo.com/splash.html
would bring up:
http://www.foo.com/index.php?page=splash.html
instead.
The solution I found was to use an .htaccess file, but it only brings up 
a 403 forbidden access error everytime. ModRewrite is enabled, so what 
could be the problem? Here is the code I used:

RewriteEngine on
RewriteBase /
RewriteRule ^[A-Za-z0-9]\.html$ /index.php?page=$1
thanks for your help :)
-steph
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] apache htaccess mod rewrite with php querystring urls

2004-08-12 Thread raisinlove
A simple redirection using meta refresh in the html file would work
meta http-equiv=refresh
content=1;url=http://www.foo.com/index.php?page=splash.html; 
This isn't what I want since (I should probably have specified) the html 
files contain no headers. The header is generated by the php file.

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


[PHP] Re: apache htaccess mod rewrite with php querystring urls

2004-08-12 Thread raisinlove
[A-Za-z0-9] will only match one character. 
Try this :
 RewriteEngine on
 RewriteRule [A-Za-z0-9]+\.html$ /index.php?page=$1
Ah, good point there. Thanks.
However, I'm still experiencing problems displaying any page contained 
within the folder which holds this htaccess file. I get a 403 Forbidden 
Access error everytime. Your example above is the only code contained in 
my file. What could be the cause of this, and how can I fix it?

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


[PHP] apply function to each array element?

2004-03-29 Thread raisinlove
Hi, I'm looking for a concrete example I could use to create an array 
where each element from an original array is processed by a function.

It seems array_walk would be the solution but it doesnt seem to output 
an array.

My function looks up my array elements in a mysql table and outputs a 
corresponding row value. So I would like my new array to be made up of 
these values.

Can anyone help?

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


Re: [PHP] apply function to each array element?

2004-03-29 Thread raisinlove
Thanks for the reply, I think I'll need to dig deeper as the proposed 
line doesnt work with my function.

array_walk should be fine for this, instead of creating a new array
why not just modify the existing one? I.e.:
The reason I want a new array is that I will then combine both together, 
 for key/value pairs. The original array is a list of directories. My 
database contains data for each directory and in this case I want to 
create an array of the title for each directory that is included in 
the original array. So the final combined array would become something 
like:

array('img_files'='The Images','some_stuff'='Some Stuff'...)

I then generate the sub-directory menus of each of my directories with 
arrays like this.

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


[PHP] writing file on server from database?

2004-03-03 Thread raisinlove
Hi, I'm currently working on a basic website creation script where I 
want an index file created automaticaly within each new folder created.
My attempts at using copy() were foiled by safe-mode restrictions on my 
account but after some research, I discovered this could be circumvented 
 with the use of move_uploaded_file() instead.
Now I'd like to figure out how I could use this to copy an existing 
index.php file on the server to the newly created directories.

But can I use move_uploaded_file() if the file is already on the server? 
If it needs to be an uploaded file, would uploading it once allow me to 
copy it anytime afterwards?

I figured an even better solution could be to store the index file as a 
blob in my MySQL db and have the script write that file to the newly 
created dirs. Is this feasible (especialy with the safe-mode restrictions) ?

Any tips or examples would be much appreciated.

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


[PHP] Re: writing file on server from database?

2004-03-03 Thread raisinlove
Raisinlove wrote:

Hi, I'm currently working on a basic website creation script where I 
want an index file created automaticaly within each new folder created.
My attempts at using copy() were foiled by safe-mode restrictions on my 
account but after some research, I discovered this could be circumvented 
 with the use of move_uploaded_file() instead.
Now I'd like to figure out how I could use this to copy an existing 
index.php file on the server to the newly created directories.

But can I use move_uploaded_file() if the file is already on the server? 
If it needs to be an uploaded file, would uploading it once allow me to 
copy it anytime afterwards?

I figured an even better solution could be to store the index file as a 
blob in my MySQL db and have the script write that file to the newly 
created dirs. Is this feasible (especialy with the safe-mode 
restrictions) ?

Any tips or examples would be much appreciated.

Thanks!
-s
Ok forget what I said regarding the database. I would just like to 
figure out how to copy a file from one directory to another using 
move_uploaded_file. I cant find any proper examples...

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


[PHP] Re: writing file on server from database?

2004-03-03 Thread raisinlove
I found the answer. If safe-mode prevents you from copying files to a 
newly script-generated directory, simply use the following:

ftp_put($conn_id, $newdirectorypath,$sourcefilepath, FTP_ASCII)

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


Re: [PHP] FTP alternative to copy() ?

2004-03-02 Thread raisinlove
Raditha Dissanayake wrote:
then use
`cp source destination`
In my php script? This must be executed automaticaly by the script.
I probably have no other choice than copy() then.
-s

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


Re: [PHP] FTP alternative to copy() ?

2004-03-02 Thread raisinlove
Raisinlove wrote:
Raditha Dissanayake wrote:
then use
`cp source destination` 
In my php script? This must be executed automaticaly by the script.
I probably have no other choice than copy() then.
-s
Ok, I found the solution! ftp_rename() was what I was looking for.
Funny no one mentioned it! I smaked my forhead for not having thought of 
it myself.

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


[PHP] FTP alternative to copy() ?

2004-03-01 Thread raisinlove
Hi, I'd like to know if there's an alternative to copy() to copy a file 
from one directory to another, using the FTP functions?

I figured I could probably open the file from the server and save/upload 
it to a specified path.

Can this be done? What syntax should I use?

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


Re: [PHP] FTP alternative to copy() ?

2004-03-01 Thread raisinlove
Raditha Dissanayake wrote:
Hi,
Are you trying to copy from the FTP to the web server or are you trying 
to pass it through to the end user? if you are on the same network other 
options include RCP (insecure) and SCP (secure)
Actually, it's much simpler than that but it might be overkill.
My overall script is for creating directories on the same server, and 
I'd like to copy the main index file to each new directory that is 
created. So my intention is exactly the same as copy() since it's on the 
same server.
I'm exploring other alternatives because I cant see to get copy() 
working as I intend.

-s

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


Re: [PHP] mkdir and rmdir possible but not readdir and opendir???

2004-02-29 Thread raisinlove
The work-around is to create the directory outside of your web application
from your regular account.  Or if you are allowed to run cgi scripts and
these are set up via cgiwrapper or suExec to run as your own user id, use
this to create the directory.  Once created with the right owner, you can
manipulate it from your regular Apache-embedded PHP scripts.
Thank you! I'm definitely filing this solution for later use. Meanwhile, 
I went back to trying the FTP_MKDIR method and found why that didnt 
work. I realized when accessing the website via ftp that the system path 
was different than the one displayed online. IE: my script path was 
shown as /home/virtual/site... while in my ftp client I was seeing 
/var/www/html...
Changing my path references to the later one fixed everything...so far!

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


[PHP] mkdir and rmdir possible but not readdir and opendir???

2004-02-28 Thread raisinlove
Hi, I'm having trouble understanding why I can create and delete 
directories with my script via mkdir and rmdir, but not simply being 
able to read them with opendir or readdir?

For example, when I attempt to access these directories with opendir, I 
get this error message:

Warning: opendir(): SAFE MODE Restriction in effect. The script whose 
uid is 789 is not allowed to access...

Safe Mode is on as I am hosted on a shared server and cannot change 
this. Surely there's a work-around for this?

Any helpfull input would appreciated
Thanks,
-s
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] mkdir and rmdir possible but not readdir and opendir???

2004-02-28 Thread raisinlove
Hi, I'm having trouble understanding why I can create and delete 
directories with my script via mkdir and rmdir, but not simply being 
able to read them with opendir or readdir?

For example, when I attempt to access these directories with opendir, I 
get this error message:

Warning: opendir(): SAFE MODE Restriction in effect. The script whose 
uid is 789 is not allowed to access...

Safe Mode is on as I am hosted on a shared server and cannot change 
this. Surely there's a work-around for this?

Any helpfull input would appreciated
Thanks,
-s
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mkdir and rmdir possible but not readdir and opendir???

2004-02-28 Thread raisinlove
Rasmus Lerdorf wrote:

This is normal.  You are allowed to create the directory because the
directory you are creating it in is owned by the same user id that owns
the script calling mkdir().  However, since your web server runs as some
other user the owner of the newly created dir will be that user and not
your own so you subsequently cannot manipulate that directory.  Same
problem with safe mode and file uploads.  ISP's are generally better off
using open_basedir instead of safe-mode for this very reason.
I see, so there's no way around this then. I'll inquire to my host why 
open_basedir couldnt be used instead of safe-mode.
There's goes my plan of FTP-less website management :(

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


Re: [PHP] mkdir and rmdir possible but not readdir and opendir???

2004-02-28 Thread raisinlove
Surely if there is a work-around then safe mode would not be doing its job 
properly?
Well this was part of the purpose of my post, before Rasmus explained 
it, I didn't understand why I couldnt access a directory I had created. 
I was hoping for a function which would achieve the same purpose but 
wouldn't be affected by safe-mode. I've seen many other workaround 
solutions to other problems caused by the safe-mode setting.
Unfortunatly this doesnt seem to be such a case.

-s

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