Create a PHP Page Dynamically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Noyb

    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.
  • Nik Coughin

    #2
    Re: Create a PHP Page Dynamically

    Noyb wrote:[color=blue]
    > 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.[/color]

    Yes.





    Comment

    • Gordon Burditt

      #3
      Re: Create a PHP Page Dynamically

      >Is it possible to create a php page dynaimically? For example, when a[color=blue]
      >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.[/color]

      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

      Comment

      • Noyb

        #4
        Re: Create a PHP Page Dynamically

        Gordon Burditt wrote:
        [color=blue][color=green]
        >>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.[/color]
        >
        >
        > 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[/color]

        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.

        Comment

        • Noyb

          #5
          Re: Create a PHP Page Dynamically

          Nik Coughin wrote:
          [color=blue]
          > Noyb wrote:
          >[color=green]
          >>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.[/color]
          >
          >
          > Yes.
          >
          > http://www.php.net/manual/en/ref.filesystem.php
          >
          >
          >[/color]
          Thanks Nik!

          Comment

          • Markus Ernst

            #6
            Re: Create a PHP Page Dynamically

            "Noyb" <none@hotmail.c om> schrieb im Newsbeitrag
            news:v7hNc.1740 4$Qu5.3560@news read2.news.pas. earthlink.net.. .[color=blue]
            > 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.[/color]

            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


            Comment

            • Savut

              #7
              Re: Create a PHP Page Dynamically


              "Markus Ernst" <derernst@NO#SP #AMgmx.ch> wrote in message
              news:41061daf$0 $456$afc38c87@n ews.easynet.ch. ..[color=blue]
              > "Noyb" <none@hotmail.c om> schrieb im Newsbeitrag
              > news:v7hNc.1740 4$Qu5.3560@news read2.news.pas. earthlink.net.. .[color=green]
              >> 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.[/color]
              >
              > 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[/color]

              "DocumentIn dex index.php" would be better and faster

              Savut

              [color=blue]
              > - 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
              >
              >[/color]

              Comment

              • Noyb

                #8
                Re: Create a PHP Page Dynamically

                Savut wrote:[color=blue]
                >
                > "Markus Ernst" <derernst@NO#SP #AMgmx.ch> wrote in message
                > news:41061daf$0 $456$afc38c87@n ews.easynet.ch. ..
                >[color=green]
                >> "Noyb" <none@hotmail.c om> schrieb im Newsbeitrag
                >> news:v7hNc.1740 4$Qu5.3560@news read2.news.pas. earthlink.net.. .
                >>[color=darkred]
                >>> 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.[/color]
                >>
                >>
                >> 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[/color]
                >
                >
                > "DocumentIn dex index.php" would be better and faster
                >
                > Savut
                > http://ww.savut.com
                >[color=green]
                >> - 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
                >>
                >>[/color]
                >[/color]

                Thanks Markus and Savut!

                Comment

                • eclipsboi

                  #9
                  Re: Create a PHP Page Dynamically

                  On Tue, 27 Jul 2004 08:36:05 -0400, "Savut" <webki@hotmail. com> wrote:
                  [color=blue]
                  >
                  >"DocumentInd ex index.php" would be better and faster[/color]
                  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.

                  Comment

                  • Savut

                    #10
                    Re: Create a PHP Page Dynamically

                    Then mod_rewrite would do the job perfectly

                    Savut


                    "eclipsboi" <eclipsboi@hotm ail.com> wrote in message
                    news:7lddg0pqk0 nuvllr6qv3h1lkg tjovr8h71@4ax.c om...[color=blue]
                    > On Tue, 27 Jul 2004 08:36:05 -0400, "Savut" <webki@hotmail. com> wrote:
                    >[color=green]
                    >>
                    >>"DocumentInde x index.php" would be better and faster[/color]
                    > 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.[/color]

                    Comment

                    • Hostmaster \(NS\)

                      #11
                      Re: Create a PHP Page Dynamically

                      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" <none@hotmail.c om> wrote in message news:v7hNc.1740 4$Qu5.3560@news read2.news.pas. earthlink.net.. .[color=blue]
                      > 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.[/color]

                      Comment

                      Working...