ckroon
Posts: 869
|
| Posted: 05/18/2009, 12:53 PM |
|
On this forum, the threads are filtered by the url "forum_id".
When I remove this from the URL window, it redirects me to the main page.. which is great.
What is the code that does this?
Right now, on the page/grid I created, if you remove the Urlit just shows ALL records.
Is there a CCS way of doing this that I am missing or is this in the Events code?
Thanks!
_________________
Walter Kempees...you are dearly missed. |
 |
 |
melvyn
Posts: 333
|
| Posted: 05/18/2009, 4:11 PM |
|
Event After Initialize:
if (!isset($_GET['post_id'])){
global $Redirect;
$Redirect = "index.php";
}
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
ckroon
Posts: 869
|
| Posted: 05/19/2009, 10:16 AM |
|
Thanks Melvyn.. that works if the users takes away teh URL completely but if they remove the integer...
change it from
forumid=1
to
forumid=
It still displays all the records and doesnt redirect..
I tried this:
if
(CCGetFromGet("forumid","") < 0 ){ global $Redirect; $Redirect = "mainboard1.php";}
But it doesn't do anything :)
_________________
Walter Kempees...you are dearly missed. |
 |
 |
melvyn
Posts: 333
|
| Posted: 05/19/2009, 10:55 AM |
|
I gave the general idea.
Try this:
if ( (!isset($_GET['post_id']))&&($_GET['post_id']>0 )){
global $Redirect;
$Redirect = "index.php";
}
The above will check two conditions:
1) post_id is in the url
2) post_id has a value greater than zero.
Both must match. If not, will redirect.
Anyways, that doesn't know if the value in the url is a correct value.
Also don't work when the variable value is an string.
For string variables try this
if ( (!isset($_GET['post_id'])) && (strlen($_GET['post_id'])>0) ){
global $Redirect;
$Redirect = "index.php";
}
The above will check it receives a value in post_id and that value must have at least one character (string or numeric).
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
damian
Posts: 838
|
| Posted: 05/19/2009, 5:49 PM |
|
check in your VQB - you can set a default value...
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
asongo
Posts: 19
|
| Posted: 05/19/2009, 6:08 PM |
|
global $Redirect;
if(CCGetParam("post_id","") == "") {
$Redirect = "index.php";
}
_________________
PHP 4.4x ,MySQL 4.0x
Kaohsiung,Taiwan |
 |
 |