/    Sign up×
Community /Pin to ProfileBookmark

Which Php Functions Checks For Dynamic Links ?

Folks,

To begin with, I don’t want to allow my users to submit me their links that are dynamic. Contains the “?”.
And so, how to check if url is dynamic or not ? Is there any builtin php function that checks for this ? Dynamic links, I mean.

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@daveyerwinJul 14.2021 — > @developer_web#1634138 To begin with, I don't want to allow my users to submit me their links that are dynamic. Contains the "?".

> And so, how to check if url is dynamic or not ? Is there any builtin php function that checks for this ? Dynamic links, I mean.



- - - - - - - - - - - - - - -
allow or disallow based on the results of

a check for the presents of "?"
Copy linkTweet thisAlerts:
@NogDogJul 14.2021 — [code=php]
if(parse_url($url, PHP_URL_QUERY)) {
echo "Hey, no query strings, please";
}
[/code]
Copy linkTweet thisAlerts:
@NogDogJul 14.2021 — Note, however, that the lack of a query string does not mean it's not "dynamic". A RESTful link like https://example.com/autos/mercedes/black could be made to work exactly like https://example.com/autos.php?make=mercedes&color=black. 🤷‍♂️
Copy linkTweet thisAlerts:
@MonexteJul 15.2021 — You can make separate file to identify dynamic and static
Copy linkTweet thisAlerts:
@developer_webauthorJul 15.2021 — @NogDog#1634156


Mmm. So, how would you go about sorting this mess out then ?
Copy linkTweet thisAlerts:
@developer_webauthorJul 15.2021 — @Monexte#1634174

Oh! And just how would you go about doing that ?
Copy linkTweet thisAlerts:
@NogDogJul 15.2021 — > @developer_web#1634180 So, how would you go about sorting this mess out then

I'd start by making darned sure it is actually a problem if a user provides a "dynamic" link. Is this really an issue, and if so, why? Do you not want users to post links to specific articles on a wordpress blog, but only to the home page of that blog -- because an article link is going to be a "dynamic" link.
Copy linkTweet thisAlerts:
@developer_webauthorJul 15.2021 — @NogDog#1634191

Well, I did want to allow users like you to submit your dynamic links but before I accept such links I got to fix this code of Zorg's so the output is not in encoded format:

https://www.webdeveloper.com/d/394997-how-to-analyze-url-to-auto-add-appropriate-encoding-on-appropriate-spots/10

Now because I have failed to fix that code of Zorg's, I then thought "oh HELL! Let's quit accepting dynamic links at the beginning and just accept static links. And once this code is fixed ...

https://www.webdeveloper.com/d/394997-how-to-analyze-url-to-auto-add-appropriate-encoding-on-appropriate-spots/10

then I can then go and accept dynamic url submissions."

Your choice NogDog. You want me to accept dynamic links ? Then the sooner this code is sorted the sooner I can accept dynamic url submissions. Ok ?

https://www.webdeveloper.com/d/394997-how-to-analyze-url-to-auto-add-appropriate-encoding-on-appropriate-spots/23

Or, you can fix your own code as Zorg suggests I use that instead. Fix it so no url gets echoed but a link. And most of all, explain to me your code there:

https://www.webdeveloper.com/d/394997-how-to-analyze-url-to-auto-add-appropriate-encoding-on-appropriate-spots/2

Have a good guess which line I am choking on. On your code, I mean. Don't want to simply copy & paste. Got to understand your code.

https://www.webdeveloper.com/d/394997-how-to-analyze-url-to-auto-add-appropriate-encoding-on-appropriate-spots/2
Copy linkTweet thisAlerts:
@developer_webauthorJul 23.2021 — @NogDog

Ermmm ... NogDog ?
Copy linkTweet thisAlerts:
@NogDogJul 23.2021 — @developer_web#1634629

Please stop bumping your threads. If people have not replied, it's because they don't know and/or they don't care.
Copy linkTweet thisAlerts:
@developer_webauthorJul 23.2021 — @NogDog#1634632

I thought they missed it on the day I made the post because they were busy with other threads. And so, a week or two later, I bump my threads to bring it to their attention, just incase they are free that day. Not busy with other threads on the bumping day, I mean.
Copy linkTweet thisAlerts:
@ballzopJul 26.2021 — Generally speaking, they don't point to the same location. That would be a redirect and would cause the "real" URL (without any authentication protection on it) to be available to the client who could share it.

The server side code just picks the file off the file system and returns it directly (e.g. with readfile (don't forget to set the Content-Type header)).[.](https://tomzpot.com/) [.](https://mdro.fun/mobdro/)
×

Success!

Help @developer_web 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 4.24,
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,
)...