Ocs-server/Gfx4/get post headers: Difference between revisions

From KDE Community Wiki
(Created page with "GFX provides a class that automatically handles and parse GET and POST data. So instead of directly accessing those arrays you should use EHeaderDataParser. ---------- If you ...")
 
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
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 EHeaderDataParser.
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:


'''EHeaderDataParser::out_get(string $name);'''<br>
'''EHeader::out_get(string $name);'''<br>
'''EHeaderDataParser::out_post(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:
 
'''EHeaderDataParser::secure_get(string $name);'''<br>
'''EHeader::db_get(string $name);'''<br>
'''EHeaderDataParser::secure_post(string $name);'''<br>
'''EHeader::db_post(string $name);'''<br>
 
These are now obsolete:<br>
'''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:
'''EHeaderDataParser::safeAll();'''
'''EHeader::safeAll();'''
------------------
------------------
You can also set GET and POST manually using:
You can also set GET and POST manually using:


'''EHeaderDataParser::add_get(string $key, string $value);'''<br>
'''EHeader::add_get(string $key, string $value);'''<br>
'''EHeaderDataParser::add_post(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:


'''EHeaderDataParser::exists_get(string $key);'''<br>
'''EHeader::exists_get(string $key);'''<br>
'''EHeaderDataParser::exists_post(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:


'''EHeaderDataParser::get_cookie(string $key);'''<br>
'''EHeader::get_cookie(string $key);'''<br>
'''EHeaderDataParser::set_cookie(string $key, $value);'''<br>
'''EHeader::set_cookie(string $key, $value);'''<br>
'''EHeaderDataParser::del_cookie(string $key);'''<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 42:
the unsafe way using:
the unsafe way using:
'''EHeaderDataParser::get(string $key);'''<br>
'''EHeader::get(string $key);'''<br>
'''EHeaderDataParser::post(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>
'''EHeaderDataParser::add_from_string(string $str);'''
'''EHeader::add_from_string(string $str);'''
----------------
You can get the script page with all exta data(''&data=example?...'') erased by using:
<br>
'''EHeader::erase_get_data(string $url);'''
-----------------
-----------------
EHeaderDataParser can be configure in the generic config file of gfx, which can be located
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''.



Latest revision as of 10:24, 23 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::db_get(string $name);
EHeader::db_post(string $name);

These are now obsolete:
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