/    Sign up×
Community /Pin to ProfileBookmark

So that I do not bang my head against the wall

Before I order some PHP books, perhaps, I should state what are my initial goals in using PHP.

Initially, there are two tasks I wish to solve:

  • 1. I tell users that the URL for, say, my Sorting topic is [URL=”http://www.standards.com/index.html?Sorting”]http://www.standards.com/index.html?Sorting[/URL] and for my, say, PageFileUsageMonitor is [URL=”http://www.standards.com/index.html?PageFileUsageMonitor”]http://www.standards.com/index.html?PageFileUsageMonitor[/URL].
  • This allows me to chasge the actual URL, without the user having to know the real URL, and eliminates the need for my brain cells to remember the actual URL.

    However, thus far, all of my web pages use relative URLs, which facilitates my maintaining a copy of my web site on my PC.

    If a user were to click on a link within a downloaded web page, the link would not work unless the user happened to have already downloaded the appropriate files, and placed them in the proper directory hierarchy.

    I tried to change my Javascript to test whether a URL existed, and go to the alternative, i.e., the absolute URL. But client-side Javascript does not allow for testing such existence, at least that’s what I was led to beliieve in discussing this in a Javascript forum several years ago.

    I have not tried server side Javascript because I was unsure what I would be allowed to place on the server.

    I ASSuME that PHP can solve this issue.
    Would PHP be a better solution than server side Javascript?

  • 2. My other issue is even more important.
  • I’d like to be able to require the user to choose, say, an “I Agree” button before permitting a file to be downloaded. I believe that I could do this with Javascript, but, as I understand it, using Javascript would reveal the actual URL of the file, allowing the user to bypass the “I Agree” and download the file.

    I’ve been told that using PHP, I could effectively hide the string containg the file URL. Is that true? Do I need a “PHP compiler” to achieve this?

    to post a comment
    PHP

    4 Comments(s)

    Copy linkTweet thisAlerts:
    @NogDogJun 16.2009 — The first issue sounds like something you could do in PHP using the "front controller" pattern (but certainly not the only way). You could also do it in conjunction with Apache ModRewrite for "prettier" URLs, allowing the user to enter [noparse]"www.yoursite.com/foo" and have Apache convert that to "www.yoursite.com/index.php?page=foo"[/noparse]. The specific page requested would then be in [b]$_GET['page'][/b], which would be evaluated in index.php and used to decide what file then gets included to display that page.

    As far as the "I agree" thing, that could simply be done by using a post-method form that submits the HTTP post data you need for it to happen.
    Copy linkTweet thisAlerts:
    @Howard_KaikowauthorJun 16.2009 — The first issue sounds like something you could do in PHP using the "front controller" pattern (but certainly not the only way). You could also do it in conjunction with Apache ModRewrite for "prettier" URLs, allowing the user to enter [noparse]"www.yoursite.com/foo" and have Apache convert that to "www.yoursite.com/index.php?page=foo"[/noparse]. The specific page requested would then be in [b]$_GET['page'][/b], which would be evaluated in index.php and used to decide what file then gets included to display that page.

    As far as the "I agree" thing, that could simply be done by using a post-method form that submits the HTTP post data you need for it to happen.[/QUOTE]


    Thanx.
    Copy linkTweet thisAlerts:
    @Howard_KaikowauthorJun 21.2009 — Earlier in this thread, I described one of the problems that I want to solve.

    I've sort of concluded that this is really a client-side problem, for me, working with relative, rather than absolute URLs, if I hard code the absolute URLs in the HTML.

    In that case, I would then need to use a script (PHP or Javascrip?) on my PC to convert the absolute URLs to relative URLs, but not actually change the documents.

    Does that seem like a proper solution?

    Would PHP be better?

    If so, it is my understanding that for Desktop GUI applications I would need to install PHP-GTK on my desktop.

    In addition, I would have to install a PHP on my desktop for client side use.

    If so, what PHP do I install?

    What other software must be installed?

    Does the above make sense?

    I tell users that the URL for, say, my Sorting topic is http://www.standards.com/index.html?Sorting and for my, say, PageFileUsageMonitor is http://www.standards.com/index.html?PageFileUsageMonitor.

    This allows me to chasge the actual URL, without the user having to know the real URL, and eliminates the need for my brain cells to remember the actual URL.

    However, thus far, all of my web pages use relative URLs, which facilitates my maintaining a copy of my web site on my PC.

    If a user were to click on a link within a downloaded web page, the link would not work unless the user happened to have already downloaded the appropriate files, and placed them in the proper directory hierarchy.

    I tried to change my Javascript to test whether a URL existed, and go to the alternative, i.e., the absolute URL. But client-side Javascript does not allow for testing such existence, at least that's what I was led to beliieve in discussing this in a Javascript forum several years ago.

    I have not tried server side Javascript because I was unsure what I would be allowed to place on the server.

    I ASSuME that PHP can solve this issue.

    Would PHP be a better solution than server side Javascript?[/QUOTE]
    Copy linkTweet thisAlerts:
    @Howard_KaikowauthorJun 21.2009 — Earlier in this thread, I described one of the problems that I want to solve.

    I've sort of concluded that this is really a client-side problem, for me, working with relative, rather than absolute URLs, if I hard code the absolute URLs in the HTML.

    In that case, I would then need to use a script (PHP or Javascrip?) on my PC to convert the absolute URLs to relative URLs, but not actually change the documents.

    Does that seem like a proper solution?

    Would PHP be better?

    If so, it is my understanding that for Desktop GUI applications I would need to install PHP-GTK on my desktop.

    In addition, I would have to install a PHP on my desktop for client side use.

    If so, what PHP do I install?

    What other software must be installed?

    Does the above make sense?[/QUOTE]


    I just thought of a problem, whether I use PHP or Javascript.

    Up until 11 May 2009, I was using dial-up, so it was clear when I was not connected to the internet.

    Now that I use cable intenet, unless I pull the cable modem, I am always on the internet.

    So, I would need a way to force PHP or Javascript to think that it is not connected to the internet.

    Or, is there a way to avoid this problem?
    ×

    Success!

    Help @Howard_Kaikow spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.4,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...