Welcome Guest, Not a member yet? Register   Sign In
problem with encode
#1

[eluser]Sawariya[/eluser]
Hi Friends

i am passing encoded data through URL.But encoded result produsing '==' at the end of encoded
so getting an error like
The URI you submitted has disallowed characters.

this is my code
<a href="&lt;?=site_url().'test/view/'.$this->encrypt->encode($row->user_id);?&gt;">&lt;?=$row->display_name;?&gt;</a>

anybody can help me
#2

[eluser]Sawariya[/eluser]
Friends any body have solution for this...
#3

[eluser]Chris Newton[/eluser]
You could just add = to the list of allowed characters in the URI string. I believe that's an option in the config file.

It might be better to just POST the data though, rather than passing it as an argument.
#4

[eluser]Sawariya[/eluser]
yah you are correct already i changed in config file..
it was working... but i think that is not a correct solution..
i think your second suggestion is good.
any other option for this problem??
thanks for your reply
#5

[eluser]Sawariya[/eluser]
But i am using href... so how can i pass those encoded data??..
i dont want to show it in url..

thanks in advance
#6

[eluser]adamp1[/eluser]
I had the same kind of problem with the encode function. Sadly I too didnt find a good solution. I don't know why it encodes the string and puts a == on the end. Well a little solution could be since you know it always has a == on the end, remove it, and add it on late? I know its note nice but it could work.
#7

[eluser]Edemilson Lima[/eluser]
Change
Code:
<a href="&lt;?=site_url().'test/view/'.$this->encrypt->encode($row->user_id);?&gt;">&lt;?=$row->display_name;?&gt;</a>

To:

Code:
&lt;form action="&lt;?=site_url().'test/view/'?&gt;" method="post" style="margin:0px; float:left"&gt;
&lt;input type="hidden" name="user_id" value="&lt;?=$this-&gt;encrypt->encode($row->user_id)?&gt;" />
&lt;input type="submit" value="&lt;?=$row-&gt;display_name?&gt;" />&lt;/form&gt;

This will show a button instead of a link. You can change the layout of the submit button adding an inline CSS if you don't want a button there.
At your "/test/view" controller you will need to get the $this->input->post('user_id') instead of the segment or the parameter passed to the function.
Remember that after submiting a form using post, the back button will not work as before.
The style="margin:0px; float:left" at the form tag is to make it fit in the page like a link. May you need to change this.
#8

[eluser]Sawariya[/eluser]
Hi Edemilson Lima

Both are correct... but i am using href... i already explained my problem... i cant change allowed charecter in config

wat is the solution for this....

thanks for repy
#9

[eluser]Edemilson Lima[/eluser]
I still not understand. Don't you can change the config at "system/application/config/config.php"?

I think you just need to open it and add the char "=" to the allowed characters:

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

Remember to always put the minus "-" at the end of the string, if you want to allow it in your URIs. If you put it before (for example: "_-="), the regular expression will consider the characters from "_" to "=" in the ASCII table.




Theme © iAndrew 2016 - Forum software by © MyBB