473,395 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Create a PHP Page Dynamically

Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.
Jul 17 '05 #1
10 3977
Noyb wrote:
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name
so users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.


Yes.

http://www.php.net/manual/en/ref.filesystem.php

Jul 17 '05 #2
>Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.


You can write one PHP page that does all sorts of stuff depending
on how it is called. For example, it looks at what name it was
called under, looks this up in a database, and spits out a page for
the user based on his entries there. This works best if the pages
follow a pattern rather than being completely free-form. For
example, I suspect that Ebay item-for-sale pages are generated out
of a template, with some seller-supplied pieces, including text,
html, and maybe a few images (or at the very least, links to images
hosted elsewhere). (I have no idea whether Ebay uses PHP, though).

Yes, you can create files in the document tree, if permissions are
set up to do this. I'd be REALLY, REALLY careful about letting
users create PHP pages which can ALSO write on the filesystem: it's
very easy to open up security holes this way. See fopen(), for
example, with a filename argument, if you really want to do this.

Gordon L. Burditt
Jul 17 '05 #3
Gordon Burditt wrote:
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.

You can write one PHP page that does all sorts of stuff depending
on how it is called. For example, it looks at what name it was
called under, looks this up in a database, and spits out a page for
the user based on his entries there. This works best if the pages
follow a pattern rather than being completely free-form. For
example, I suspect that Ebay item-for-sale pages are generated out
of a template, with some seller-supplied pieces, including text,
html, and maybe a few images (or at the very least, links to images
hosted elsewhere). (I have no idea whether Ebay uses PHP, though).

Yes, you can create files in the document tree, if permissions are
set up to do this. I'd be REALLY, REALLY careful about letting
users create PHP pages which can ALSO write on the filesystem: it's
very easy to open up security holes this way. See fopen(), for
example, with a filename argument, if you really want to do this.

Gordon L. Burditt


Thanks Gordon. I understand what you're talking about but the
convenience of telling people to go to www.mysite.com/jack is what I was
looking for. The answer posted by Nik C.
(http://www.php.net/manual/en/ref.filesystem.php) is just what I was
looking for in case anyone else out there is wondering.
Jul 17 '05 #4
Nik Coughin wrote:
Noyb wrote:
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name
so users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.

Yes.

http://www.php.net/manual/en/ref.filesystem.php

Thanks Nik!
Jul 17 '05 #5
"Noyb" <no**@hotmail.com> schrieb im Newsbeitrag
news:v7******************@newsread2.news.pas.earth link.net...
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.


Alternatively to what Nik and Gordon pointed you to, you could also
- Use mod_rewrite (with a .htaccess file) to redirect all requests to
/index.php
- analyze the address entered:

$url_array = explode("/",$_SERVER['REQUEST_URI']);
$who = $url_array[1];

So if somebody called www.mysite.com/jack $who is now set to "jack", and you
can use this to get jack's data from your database, file or whatever.

HTH
Markus
Jul 17 '05 #6

"Markus Ernst" <derernst@NO#SP#AMgmx.ch> wrote in message
news:41*********************@news.easynet.ch...
"Noyb" <no**@hotmail.com> schrieb im Newsbeitrag
news:v7******************@newsread2.news.pas.earth link.net...
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.
Alternatively to what Nik and Gordon pointed you to, you could also
- Use mod_rewrite (with a .htaccess file) to redirect all requests to
/index.php


"DocumentIndex index.php" would be better and faster

Savut
http://ww.savut.com
- analyze the address entered:

$url_array = explode("/",$_SERVER['REQUEST_URI']);
$who = $url_array[1];

So if somebody called www.mysite.com/jack $who is now set to "jack", and
you
can use this to get jack's data from your database, file or whatever.

HTH
Markus


Jul 17 '05 #7
Savut wrote:

"Markus Ernst" <derernst@NO#SP#AMgmx.ch> wrote in message
news:41*********************@news.easynet.ch...
"Noyb" <no**@hotmail.com> schrieb im Newsbeitrag
news:v7******************@newsread2.news.pas.earth link.net...
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.

Alternatively to what Nik and Gordon pointed you to, you could also
- Use mod_rewrite (with a .htaccess file) to redirect all requests to
/index.php

"DocumentIndex index.php" would be better and faster

Savut
http://ww.savut.com
- analyze the address entered:

$url_array = explode("/",$_SERVER['REQUEST_URI']);
$who = $url_array[1];

So if somebody called www.mysite.com/jack $who is now set to "jack",
and you
can use this to get jack's data from your database, file or whatever.

HTH
Markus


Thanks Markus and Savut!
Jul 17 '05 #8
On Tue, 27 Jul 2004 08:36:05 -0400, "Savut" <we***@hotmail.com> wrote:

"DocumentIndex index.php" would be better and faster

DocumentIndex does not exist in either 1.3 or 2.0 of Apache.
DirectoryIndex and DocumentRoot do, but respectively either determine
the default file to display if none is called, or set the base web
directory for the domain (the latter only being set in the server
config file globally, or via a <VirtualHost> directive.

What this guy wants is in essence, virtual directories. Similar to how
Yahoo Profiles does it (I presume). A way to have virtually infinite
directories, without the physical directories.
Jul 17 '05 #9
Then mod_rewrite would do the job perfectly

Savut
http://www.savut.com

"eclipsboi" <ec*******@hotmail.com> wrote in message
news:7l********************************@4ax.com...
On Tue, 27 Jul 2004 08:36:05 -0400, "Savut" <we***@hotmail.com> wrote:

"DocumentIndex index.php" would be better and faster

DocumentIndex does not exist in either 1.3 or 2.0 of Apache.
DirectoryIndex and DocumentRoot do, but respectively either determine
the default file to display if none is called, or set the base web
directory for the domain (the latter only being set in the server
config file globally, or via a <VirtualHost> directive.

What this guy wants is in essence, virtual directories. Similar to how
Yahoo Profiles does it (I presume). A way to have virtually infinite
directories, without the physical directories.


Jul 17 '05 #10
just have a script create the virtual host and then copy a index.php into their home dir or echo the php code into a php file
"Noyb" <no**@hotmail.com> wrote in message news:v7******************@newsread2.news.pas.earth link.net...
Is it possible to create a php page dynaimically? For example, when a
user is added I'd like to create a page in a directory in their name so
users could go to www.mysite.com/jack or www.mysite.com/jill and
index.php will have been created there. I know there are many ways
around this but I'd like to know if a php page can be created on the
server. Thanks.
Steve.

Jul 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
3
by: Kiyomi | last post by:
Hello, I create a Table1 dynamically at run time, and at the same time, I would like to create LinkButton controls, also dynamically, and insert them into each line in my Table1. I would...
6
by: James Norton-Jones | last post by:
Hi, I am wanting to create Linkbuttons and Event Handlers on the fly. Ideally I would be able to pass the CommandName and CommandArgument to the Event Handler which in turn would pass these to...
0
by: Andrea | last post by:
Hallo, i create controls dynamically on my webproject. most of the controls i create in the oninit-event and all worked wunderfull, but in the event-handling, e.g. the click-event of a button, i...
7
by: moondaddy | last post by:
I want to dynamically create a JavaScript file and cache it on the client for re-use. I know how to write javascript to a web page from the code behind, but I don't know how to actually create a...
4
by: jesper_lofgren | last post by:
Hi there, I have some webcontrols that i want to add dynamically on a page. I have stored the path / namespace in database (ex MyNameSpace.WebControls.Control1) to the class/webcontrol. Lets...
3
by: sloesch | last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net, and ASP.net, and I would like to know how you can create a dynamic hyperlink on the fly to a document stored in a SQL database?...
3
by: rishi145 | last post by:
i want to build a small cms and wanted to know if it was possible to generate a aspx page dynamically? if so how basically i wan to be able to have a button create new page and name it. thanks...
16
by: flip2flik | last post by:
Hi. I am using visual web developer express edition and I am using vb.net as the programming language. I want to create a new aspx file on a button click. I will have a template that the new...
11
by: =?Utf-8?B?UGV0ZXIgSw==?= | last post by:
I am working with Visual Studio or alternately with Expression Web. I need to create about 50 aspx pages with about 1200 thumbnali images, typically arranged in three to four groups per page,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.