Ocs-server/Gfx4/get post headers: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
GFX provides a class that automatically handles and parse GET and POST data. | GFX provides a class that automatically handles and parse GET and POST data. | ||
So instead of directly accessing those arrays you should use | So instead of directly accessing those arrays you should use EHeader. | ||
---------- | ---------- | ||
If you have to output your data you can use: | If you have to output your data you can use: | ||
''' | '''EHeader::out_get(string $name);'''<br> | ||
''' | '''EHeader::out_post(string $name);'''<br> | ||
----------------- | ----------------- | ||
If you have to insert your data into database and you need them to be safe you can use: | If you have to insert your data into database and you need them to be safe you can use: | ||
''' | '''EHeader::secure_get(string $name);'''<br> | ||
''' | '''EHeader::secure_post(string $name);'''<br> | ||
------------------ | ------------------ | ||
If you need all your data to be safe you can easily do: | If you need all your data to be safe you can easily do: | ||
''' | '''EHeader::safeAll();''' | ||
------------------ | ------------------ | ||
You can also set GET and POST manually using: | You can also set GET and POST manually using: | ||
''' | '''EHeader::add_get(string $key, string $value);'''<br> | ||
''' | '''EHeader::add_post(string $key, string $value);'''<br> | ||
-------------- | -------------- | ||
You can check existance of GET and POST manually using: | You can check existance of GET and POST manually using: | ||
''' | '''EHeader::exists_get(string $key);'''<br> | ||
''' | '''EHeader::exists_post(string $key);'''<br> | ||
-------------- | -------------- | ||
You can use this class to get/set cookie data via: | You can use this class to get/set cookie data via: | ||
''' | '''EHeader::get_cookie(string $key);'''<br> | ||
''' | '''EHeader::set_cookie(string $key, $value);'''<br> | ||
''' | '''EHeader::del_cookie(string $key);'''<br> | ||
This can result particularly useful when you need to use EModel's insert and update | This can result particularly useful when you need to use EModel's insert and update | ||
Line 38: | Line 38: | ||
the unsafe way using: | the unsafe way using: | ||
''' | '''EHeader::get(string $key);'''<br> | ||
''' | '''EHeader::post(string $key);'''<br> | ||
---------------- | ---------------- | ||
If you have a string formed as a standard get key/value list (e.g. example=val&example2=val2) | If you have a string formed as a standard get key/value list (e.g. example=val&example2=val2) | ||
you can use this handy method to have that added to the module's stack. | you can use this handy method to have that added to the module's stack. | ||
<br> | <br> | ||
''' | '''EHeader::add_from_string(string $str);''' | ||
---------------- | ---------------- | ||
You can get the script page with all exta data(''&data=example?...'') erased by using: | You can get the script page with all exta data(''&data=example?...'') erased by using: | ||
<br> | <br> | ||
''' | '''EHeader::erase_get_data(string $url);''' | ||
----------------- | ----------------- | ||
EHeader can be configure in the generic config file of gfx, which can be located | |||
here: ''gfx3/config/generic.conf.php''. | here: ''gfx3/config/generic.conf.php''. | ||
Revision as of 12:40, 20 May 2016
GFX provides a class that automatically handles and parse GET and POST data. So instead of directly accessing those arrays you should use EHeader.
If you have to output your data you can use:
EHeader::out_get(string $name);
EHeader::out_post(string $name);
If you have to insert your data into database and you need them to be safe you can use:
EHeader::secure_get(string $name);
EHeader::secure_post(string $name);
If you need all your data to be safe you can easily do:
EHeader::safeAll();
You can also set GET and POST manually using:
EHeader::add_get(string $key, string $value);
EHeader::add_post(string $key, string $value);
You can check existance of GET and POST manually using:
EHeader::exists_get(string $key);
EHeader::exists_post(string $key);
You can use this class to get/set cookie data via:
EHeader::get_cookie(string $key);
EHeader::set_cookie(string $key, $value);
EHeader::del_cookie(string $key);
This can result particularly useful when you need to use EModel's insert and update but not all the data comes from user request.
If you want to take those variables fast and you can't decide you can choose the unsafe way using:
EHeader::get(string $key);
EHeader::post(string $key);
If you have a string formed as a standard get key/value list (e.g. example=val&example2=val2)
you can use this handy method to have that added to the module's stack.
EHeader::add_from_string(string $str);
You can get the script page with all exta data(&data=example?...) erased by using:
EHeader::erase_get_data(string $url);
EHeader can be configure in the generic config file of gfx, which can be located here: gfx3/config/generic.conf.php.
Example:
<?php die("You cannot see config in here."); ?>
protectheaders|yes
protectheaders|no