| Author |
Message |
floppy
Newbie


Joined: Sep 11, 2006
Posts: 92
|
Posted:
Sat Jan 03, 2009 6:27 pm |
|
I know I just been looking at this too long. I can't for the life of me get this link to shorten.
In the module (what you see below actually works, just doesn't tap). I chose a strange way to switch which maybe the problem. If I didn't miss something obvious. Not 100% sure I ever tried to tap a url that came from header(). My header hurts
| Code: |
SWITCH($_GET['op']){
case 'dosearch':
header('location: modules.php?name='.$module_name.'§ion='.$_POST['section'].'&ctsquery='.urltitle($_POST['ctsquery').'');
break;
default:
if(empty($_GET['section'])){
OpenTable();
echo ctsearch2();
CloseTable();
}else{
SWITCH($_GET['section']){
case 'Content':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/content.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
case 'Club':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/club.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
case 'News':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/news.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
case 'Downloads':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/downloads.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
case 'Shop':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/shop.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
case 'Tutorials':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/tutorials.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
case 'All':
OpenTable();
ctsquery($_GET['ctsquery']);
echo ctsearch2();
include("modules/$module_name/content.php");
include("modules/$module_name/club.php");
include("modules/$module_name/news.php");
include("modules/$module_name/downloads.php");
include("modules/$module_name/shop.php");
include("modules/$module_name/tutorials.php");
ctsresults($count, $ctsquery, $results);
CloseTable();
break;
}
}
break;
} |
GT-Search.php (with some stuff commented out for testing)
| Code: |
$urlin = array(
'"(?<!/)modules.php\?name=Search&section=([a-zA-Z0-9_-]*)&ctsquery=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Search&op=dosearch"',
'"(?<!/)modules.php\?name=Search"'
/*'"(?<!/)modules.php\?name=Content&pa=showpage&pid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
"'(?<!/)modules.php\?name=Club&op=download&fid=([0-9]*)&title=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Club'",
'"(?<!/)modules.php\?name=Clan_Database&l_op=visit&lid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Web_Links&l_op=visit&lid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Clan_Database"',
'"(?<!/)modules.php\?name=Web_Links"',
"'(?<!/)modules.php\?name=Tutorials&t_op=showtutorial&pid=([0-9]*)&title=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Tutorials'",
'"(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&cid=([0-9]*)&lid=([0-9]*)&ttitle=([/:\-\'{}()\,\._&a-zA-Z0-9+= ]*)"',
'"(?<!/)modules.php\?name=Downloads(?!&)"',
'"(?<!/)modules.php\?name=News&file=article&sid=([0-9]*)&mode=([a-z]*)&order=([0-9]*)&thold=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=News&file=article&sid=([0-9]*)&title=([a-zA-Z0-9_-]*)"'*/
);
$urlout = array(
'search-dosearch.html',
'search-\\1-\\2.html',
'search.html'
/*'content-\\1-\\2.html',
"club-download-file-\\1-\\2.html",
"club.html",
'clan-database-viewlink-\\1-\\2.html',
'viewlink-\\1-\\2.html',
'clan-database.html',
'links.html',
"tutorials-view-\\1-\\2.html",
"tutorials.html",
'downloaddetails-\\1-\\2-\\3.html',
'downloads.html',
'article\\1-\\2-\\3-\\4-\\5.html',
'article\\1-\\2.html'*/
); |
.htaccess
| Code: |
#Search
RewriteRule ^search-([a-zA-Z0-9_-]*)-([a-zA-Z0-9_-]*).html* modules.php?name=Search§ion=$1&ctsquery=$2 [L]
RewriteRule ^search-dosearch.html* modules.php?name=Search&op=dosearch [L]
RewriteRule ^search.html* search.html [L] |
Resulting Url
http://www.clan-themes.co.uk/modules.php?name=Search§ion=Club&ctsquery=clan-themes |
| |
|
|
 |
floppy
Newbie


Joined: Sep 11, 2006
Posts: 92
|
Posted:
Sat Jan 03, 2009 7:16 pm |
|
Just not gonna work coded like that. Anyway, the idea is to get linkable searches, but I guess I am back to the drawing boards it looks. |
| |
|
|
 |
floppy
Newbie


Joined: Sep 11, 2006
Posts: 92
|
Posted:
Sat Jan 03, 2009 8:10 pm |
|
I love replying to my own forum post lmao. Anyway got this sorted, BUT still having problems with the tap of course.
I switched to form GET method which sorted out the script, but tap of the files eludes me.
New result urls are
http://www.clan-themes.co.uk/modules.php?name=Search§ion=Club&ctsquery=clan+themes+modules
And this works just addressed bar'd
http://www.clan-themes.co.uk/search-Club-clan+themes+modules.html
Here is a cleaner version of my previous tap - GT-Search.php
| Code: |
$urlin = array(
'"(?<!/)modules.php\?name=Content&pa=showpage&pid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Club&op=download&fid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Tutorials&t_op=showtutorial&pid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&cid=([0-9]*)&lid=([0-9]*)&ttitle=([/:\-\'{}()\,\._&a-zA-Z0-9+= ]*)"',
'"(?<!/)modules.php\?name=News&file=article&sid=([0-9]*)&title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Search&section=([a-zA-Z0-9_-]*)&ctsquery=([a-zA-Z0-9+_-]*)"',
'"(?<!/)modules.php\?name=Search"'
);
$urlout = array(
'content-\\1-\\2.html',
'club-download-file-\\1-\\2.html',
'tutorials-view-\\1-\\2.html',
'downloaddetails-\\1-\\2-\\3.html',
'article\\1-\\2.html',
'search-\\1-\\2.html',
'search.html'
); |
.htaccess
| Code: |
#Search
RewriteRule ^search-([a-zA-Z0-9_-]*)-([a-zA-Z0-9+_-]*).html* modules.php?name=Search§ion=$1&ctsquery=$2 [L]
RewriteRule ^search.html* search.html [L] |
|
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Sat Jan 03, 2009 9:25 pm |
|
header() does a page redirect, so there really isn't anything you can do to tap it. At least I cannot think of anything off the top of my head.
BTW, for search criteria, I've been toying with the idea of using the following RegEx instead of the more lengthy one:
In the GT-*.php script:
([[:punct:][:alnum:] ]*)
In .htaccess:
([[:punct:][:alnum:]\ ]*)
Again, haven't tested it much, but looked promising and far more readable.
I have not tested it yet thoroughly, but it should replace all of this gobbligook:
([/:\-\'{}()\,\._&a-zA-Z0-9+= ]*) |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
floppy
Newbie


Joined: Sep 11, 2006
Posts: 92
|
Posted:
Sat Jan 03, 2009 11:28 pm |
|
Well I am not using header() anymore. Using GET (vs POST) from a form.
www.clan-themes.co.uk/search.html
However, I still can't get it to tap. All the info in my previous post is still the current codes. Not even sure you can tap a url through GET, but it is accessible which makes me thing tap error.
Just some more playing with I guess. I can try some of the above. |
| |
|
|
 |
|
|