JS/PHP/HTML issue for loading multiple tour on the same html page

  • Hi all ^^
    I'm finishing my web app and have another request to ask cause of my limited experience in php...
    I want to have an only html page who could launch different tours depending on wich a href we have clicked *wink*
    Not clear ?? ^^

    The code part to explain better.

    The calling code :

    Code
    <a href="my_tour_page.html" >My first tour</a>
    <a href="my_tour_page.html" >My second tour</a>


    And then in my_tour_page.html :

    What I'd like is that my href links to an unique html page, but launches different tour ^^
    Do you think that'll be possible with php stuf using variables on the href ?
    Like :

    Code
    <a href="my_tour_page.php?tour1"


    And in the my_tour_page.php

    The goal is to change the path of the tour.xml using variables in the <a href...

    All ideas are welcomed ^^
    Thank you in advance !
    Best regards.

  • Thanks I am studying php already ^^
    I know that Google is our friend *wink*
    Just want to have some tips cause I don't know where to start and very newbie to php *whistling*
    Moreover I think that this issue will be very helpfull for the Krpano community *thumbsup*
    Looking for solutions, if I get it work by myself I'll post it ^^
    Regards.

  • Hi sachagriffin ^
    Thanks for the tip !
    I got it to work partially but have problem with plugins and script path now...
    Getting crazy !
    Here's what I've done in the different pages :

    In the all demo page :

    Code
    <a href="tour.php?path=visites/myfirsttour/ ">My First Tour</a>
    <a href="tour.php?path=visites/mysecondtour/">My Second Tour</a>

    And in the tour.php :

    It works perfectly but now obviously have path errors *cursing*
    All my tours are in a specific folder like this :
    visites/myfirsttour/(here all the panos and xml files)
    visites/mysecondtour/(here all the panos and xml files)

    In the xml I'm calling image plugins like this :

    The image_set_iphone.png gives me an error...
    I tried :

    Code
    %HTMLPATH%/visites/myfirsttour/images/image_set_iphone.png
    or either
    visites/myfirsttour/images/image_set_iphone.png


    But doesn't work *cry*
    Really this path issue always makes me crazy !
    At this purpose I already got this kind of problem wich I was talking in this post...
    The path doesn't make problem when using flash, cause I solved it by compiling the xml files.
    But for HTML5 it's very annoying...

    I'm searching but no hope of succes...
    If you have a magic disney issue with mickey mouse dancing on the xlm paths that interest me ^^
    Best regards.

  • Okay found a first part issue... *tongue*
    I've went back to this documentation page and used the %CURRENTXML% variable to set my path dynamicly ^^
    But now have another path problem for the scripts *confused*
    Argghhh !!!
    Not getting out of this ^^
    With the previous structure, I have mysecondtour using gyro.js and combobox.js.
    My tour.php is calling the tour.js, and the xml file the combobox.js and gyro.js...
    Whatever I try always gives me an path error to gyro and combobox...
    Getting furthur with that but what a waste of time !
    Thanks again.

  • It's ok just take it slow, I'm sure you'll figure it out and use the placeholders appropriately.
    You haven't shown your directory structure.. so maybe you need something like.

    %CURRENTXML%/../../images/image_set_iphone.png

    and as always, keep in mind, that someone can type in whatever they want for a get variable and make your code start working with it.
    So if you use them incorrectly, someone can take down your website in a few minutes.

  • Ok Thanks a lot for support ^^
    I actually found a solution by getting the tour.php file in the visites directory as follow:
    /visite contains :
    -tour.php
    -pano folder (pano1 folder/panos two folder...)
    -js folder with all my js centralized
    - plugin folder with all plugins centralized

    With this directory structure I bypass the paths problems...
    I'm really new to php, and doesn't understand your warning :

    Zitat

    and as always, keep in mind, that someone can type in whatever they want for a get variable and make your code start working with it.
    So if you use them incorrectly, someone can take down your website in a few minutes.

    What do you mean here ?
    If it's about getting my code it doesn't matter I'm open sourced for those, and in fact it's impossible to really protect the images and work so...
    And therefor if you mean that by passing variables into url people can change the titles or tour.xml path themselves,
    what danger is in there ? I only act on the paths and titles for this stuff ^^
    Thanks again for your help !!
    Cheers.

  • Here is the source of what I've done.

    In the main page calling the tours :

    Code
    <a href="mytours/tour.php?tour.xml" >My First Tour</a>
    <a href="mytours/tour.php?tour1.xml" >My Second Tour</a>
    <a href="mytours/tour.php?tour2.xml" >My Third Tour</a>
    ...

    In the page tour.php:

    Hoping it could help some people who want to do this kind of thing ^^
    Cheers.

  • Well back when I was learning php I used a get variable to include a file in my php.
    Someone set the get variable to include an email script uploaded to an anonymous filesharing site, which they could then use to make my webserver send out a bazillion emails.
    After that I was more aware of how someone could change inputs to do nefarious things.

    Ok Thanks a lot for support ^^

    What do you mean here ?
    If it's about getting my code it doesn't matter I'm open sourced for those, and in fact it's impossible to really protect the images and work so...
    And therefor if you mean that by passing variables into url people can change the titles or tour.xml path themselves,
    what danger is in there ? I only act on the paths and titles for this stuff ^^
    Thanks again for your help !!
    Cheers.

  • Hi again ^^
    Ok I understood the risks of passing things by url.
    I looked around in that security purpose but the only issue I found for the moment is URL rewritting by htaccess...
    But that seems very hard stuff ^^
    I know that in my use some malicious people could change my tour xml or titles directly from my server...
    Can you give me another way hint for securing that ?
    Thanks again and let you know my progress.
    Best regards.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!