We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Validating Segment URL

Development and Programming

vw000's avatar
vw000
241 posts
4 years ago
vw000's avatar vw000

The validation docs has examples on POST data forms which work fine, but how would someone do a more simple validation?

For example validate a specific EE URL like {segment_2} or another EE tag used in the template which needs to be validated manually without a POST or GET request?

I can obviously fake the $_POST request, but putting more simple examples would also be useful in the documentation.

I think that is a case most framework and people will use. Pass data on the URL but make sure someone does not alter it and tamper with the data which needs to be validated before passing the segment to the template.

       
Andy McCormick's avatar
Andy McCormick
183 posts
about 4 years ago
Andy McCormick's avatar Andy McCormick

To clarify are you trying to validate within an add-on you’re developing or are you just wanting to use the segment variables on the front-end and looking for help there. Sorry, I’m just not clear on exactly how to help on this one?

       
ZealousWeb's avatar
ZealousWeb
16 posts
about 4 years ago
ZealousWeb's avatar ZealousWeb

@vw000 Do you want to validate the segment value of the URL by using some template function? For example, Is segment value is numeric? Is it email address? or etc.

       
vw000's avatar
vw000
241 posts
about 4 years ago
vw000's avatar vw000

No add-on. I’m just trying to validate a specific name passed on the URL with PHP. I managed to do this quite easily with PHP. For some reason the same regex does not work with the EE regex validator but works fine with raw PHP.

The build in data validator with EE works with all the prebuild fields but not with the regex one.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.