Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Need GET variables.
#1

[eluser]fensen[/eluser]
Hi all,

I'm developing a website for mobile phones in Japan.

I can't use POST forms due to technical restrictions and user requirements. I can't use javaScript, because most mobile browsers here do not have JS support.

Therefore I REALLY need to use GET forms. And I don't want to compromise the site security with work-arounds.

Any ideas?

Thanks!
#2

[eluser]tonanbarbarian[/eluser]
look into using
Code:
$config['enable_query_strings'] = true;

When this option is enabled the GET parameters are not cleared out.
You will also not be able to use segments
But you should be able to use GET forms
#3

[eluser]phpzone[/eluser]
I've been using $_REQUEST instead of $_GET as $_REQUEST doesn't appear to be cleared
by CodeIgniter. Obviously make sure you security check the inputs, although usually I only use integers in this way and so cast them like "$page=(int)@$_REQUEST['page'];" that.

I assume this behaviour will remain with subsequent release?

If someone could advise on that as I wish to use $_REQUEST like this.
#4

[eluser]nirbhab[/eluser]
hi

by default:
Code:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

make
Code:
$config['enable_query_strings'] = TRUE;

than you can access the controllers and methods by
Code:
index.php?c=mycontroller&m=mymethod&otherGetVariables=345
#5

[eluser]fensen[/eluser]
Problem is that I don't want to disable URI segments because I'm using them for the back-end of the site, which is for PC browsers.

I only need GET variables for the front-end, which is for Mobile browsers.

I want to use the same server for the back-end and front-end.

So I guess the only solution is not to use CI for the front-end.

What a pity Sad

Thanks to everybody.
#6

[eluser]tonanbarbarian[/eluser]
why not put some code into the config.php file that detects if the site is front or back end and set the 'enable_query_strings' accordingly?

or if you are saying you are going to have to build 2 apps anyway , front and back seperated, why not just split the ci app into 2 folders, one for each, and have the front use enable_query_strings and the back not
#7

[eluser]fensen[/eluser]
I solved this problem this way:

1. I created a directory called "PUBLIC" that is not parsed by the CI framework
.htaccess file:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|PUBLIC|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

2. Changed my form to:
Code:
<form method=GET action='/PUBLIC/get_shop.php'>



3. in "get_shop.php" I read the query string and redirect to the CI framework, using uri segments.
Code:
header("Location: /index.php/mobile/shops/details/". $_GET["shop"] ."/");

Thanks to everybody.




Theme © iAndrew 2016 - Forum software by © MyBB