Welcome Guest, Not a member yet? Register   Sign In
URI SEGMENT Replacing DOT ( . ) to underscore ( _ )
#1

[eluser]Saji[/eluser]
Hello Everyone,

I have a problem with one of my project developed in CodeIgniter. The problem is, when i take the URI segment it DOT(.) is replace with UNDERSCORE (_). Why this happen? I have enabled to accept "." in URI string.

$config['permitted_uri_chars'] = 'a-z 0-9~%+\'_=.:_?\-';

Please help...


Thanks
Saji
#2

[eluser]TheFuzzy0ne[/eluser]
I think this is to make URLs safer. Why not convert them back?
#3

[eluser]Saji[/eluser]
Hi TheFuzzy0ne,

Thank you for your reply..

When some one register with our site with e-mail something like [email protected], we splits it into two part, one is username and second is domain.

In the above example, system will give us, username = "saji.tester" and domain = aarthikaindia.com.

I want to show the URL like user/profile/saji.tester/. Its fine, but when i try to get the third segment using $this->uri->segment(3) it returns "saji_tester" .

Also remember, in local(WINDOWS) system its working fine.

In URI Library replacing the unwanted characters?

Thanks
Saji
#4

[eluser]Dam1an[/eluser]
I can see 2 problems with this
1) What happens if you get a [email protected] and [email protected], both will resolve to user/profile/damian
2) Converting _ to . will not work, as a lot of people have _ in their email (and any other 'dodgy' characters will probably be converted to _)
#5

[eluser]Saji[/eluser]
Hi Dam1an,

Thank you for your valuable post.

We will validate username and domain so we don't have a problem.

I will explain it in detail.

The website is a company based network site. User can't login using his username but with e-mail, and E-mail id is unique.

If we have [email protected] and [email protected], we have different company but username is same.
Username is unique in his company network not entire site.

My problem is, why the URI Library Converts DOT (.) to _

Thanks again!!
Saji
#6

[eluser]TheFuzzy0ne[/eluser]
I'm baffled. I've absolutely no idea where the characters are being swapped. I checked the URI and the Router class...
#7

[eluser]Dam1an[/eluser]
@Fuzzy: Saved me doing it, I was about to look in the URI class to see if I could make sense of it lol

It also seems to be a common theme in todays threads... this is the 3rd one about dots becoming underscores in the URI today
#8

[eluser]TheFuzzy0ne[/eluser]
I might be missing something though. There are some regexes I don't understand, although I'm fairly certain that they aren't to blame. Might be worth another look though. I don't understand where else it could be happening.
#9

[eluser]Dam1an[/eluser]
I just had a quick look as well, and can't seem to see the cause of it Sad
#10

[eluser]sophistry[/eluser]
this is a PHP problem leftover from the days of auto globals. PHP tries to outsmart you and changes your incoming data into something it can use as a variable name - dots are not allowed in variable names but underscores are. so, now, 10 years later, PHP still (unhelpfully) changes dot to underscore in some configurations.

http://ellislab.com/forums/viewthread/75734/P30/




Theme © iAndrew 2016 - Forum software by © MyBB