Professional Web Applications Themes

Forward part of URL to php script? - PHP Development

hi! If I have got an URL like .... http://www.xyz.com/profiles/Peter .... I would like to display the profile of "Peter". How can I forward the value "Peter" to a php script? Thanks in advance, Markus...

  1. #1

    Default Forward part of URL to php script?

    hi!

    If I have got an URL like ....

    http://www.xyz.com/profiles/Peter

    .... I would like to display the profile of "Peter".

    How can I forward the value "Peter" to a php script?

    Thanks in advance,
    Markus


    Markus Guest

  2. #2

    Default Re: Forward part of URL to php script?

    You need to use a link like the following;

    http://www.xyz.com/profiles.php?user=peter

    Michael

    "Markus Wallner" <com> wrote in message
    news:42ef587d$0$3854$inode.at... 


    Michael Guest

  3. #3

    Default Re: Forward part of URL to php script?

    Markus Wallner wrote: 

    mod_rewrite (if you are using Apache) or handle 404 error with your own
    php script (redirect with header("Location: ... "); ).


    -veikko

    --
    veikko
    mail .com
    makinen
    Veikko Guest

  4. #4

    Default Re: Forward part of URL to php script?

    $profile = preg_replace('#.*/([^/]+)/?$#', "$1", $_SERVER['REQUEST_URI']);

    Dae


    "Markus Wallner" <com> wrote in message
    news:42ef587d$0$3854$inode.at... 


    Daedalus.OS Guest

  5. #5

    Default Re: Forward part of URL to php script?

    On 2005-08-02 13-27-50 Markus Wallner <com> wrote: 

    The easiest way would be to have a script named "profiles" which works on
    the PATH_INFO.
    For this purpose, you have to enable PATH_INFO for this script and set it
    to be pd by PHP explicitly:

    <Files "profiles">
    AcceptPathInfo On
    ForceType application/x-httpd-php
    </Files>

    In your script (profiles without .php), you can use $_SERVER['PATH_INFO']
    then.

    Btw.: Maybe you should think this over...
    I would prefer /users/Peter as a base, where
    /users/Peter/profile is the profile,
    /users/Peter/photo is his photo,
    /users/Peter/galleries/* are the user supplied galleries,
    /users/Peter/guestbook is the users guestbook,
    /users/Peter/ICQ is a redirect to the users contact
    and so on...

    In my opinion, this would be more logical than writing /what/from-what,
    because I would group the services by the user they apply to, not the
    opposite way around.

    HTH,
    Simon
    --
    Simon Stienen <http://slashlife.org/>
    "What you do in this world is a matter of no consequence,
    The question is, what can you make people believe that you have done."
    /Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/
    Simon Guest

  6. #6

    Default Re: Forward part of URL to php script?

    Thanks a lot for the suggestions!

    Really great!





    "Simon Stienen" <slashlife.org> schrieb im Newsbeitrag
    news:slashlife.org... 
    >
    > The easiest way would be to have a script named "profiles" which works on
    > the PATH_INFO.
    > For this purpose, you have to enable PATH_INFO for this script and set it
    > to be pd by PHP explicitly:
    >
    > <Files "profiles">
    > AcceptPathInfo On
    > ForceType application/x-httpd-php
    > </Files>
    >
    > In your script (profiles without .php), you can use $_SERVER['PATH_INFO']
    > then.
    >
    > Btw.: Maybe you should think this over...
    > I would prefer /users/Peter as a base, where
    > /users/Peter/profile is the profile,
    > /users/Peter/photo is his photo,
    > /users/Peter/galleries/* are the user supplied galleries,
    > /users/Peter/guestbook is the users guestbook,
    > /users/Peter/ICQ is a redirect to the users contact
    > and so on...
    >
    > In my opinion, this would be more logical than writing /what/from-what,
    > because I would group the services by the user they apply to, not the
    > opposite way around.
    >
    > HTH,
    > Simon
    > --
    > Simon Stienen <http://slashlife.org/>
    > "What you do in this world is a matter of no consequence,
    > The question is, what can you make people believe that you have done."
    > /Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/[/ref]


    Markus Guest

Similar Threads

  1. Creating PDFs, part colour, part B&W doent
    By Jacqui_Knight@adobeforums.com in forum Adobe Indesign Windows
    Replies: 5
    Last Post: May 15th, 07:46 PM
  2. Running command from string variable as if part of script
    By Tushar Gokhale in forum PERL Beginners
    Replies: 3
    Last Post: December 23rd, 02:52 AM
  3. simple script to navigate Back/Forward with one frame only
    By SOCRATES in forum Macromedia Director Lingo
    Replies: 2
    Last Post: December 20th, 11:57 AM
  4. imporovement to part of my script
    By LeeD in forum Macromedia Director Basics
    Replies: 2
    Last Post: August 5th, 12:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139