Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
floppy
Newbie
Newbie



Joined: Sep 11, 2006
Posts: 92

PostPosted: Sat Jan 03, 2009 6:27 pm Reply with quote

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 Sad

Code:
SWITCH($_GET['op']){
   case 'dosearch':
   header('location: modules.php?name='.$module_name.'&section='.$_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&amp;section=([a-zA-Z0-9_-]*)&amp;ctsquery=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Search&amp;op=dosearch"',
'"(?<!/)modules.php\?name=Search"'
/*'"(?<!/)modules.php\?name=Content&amp;pa=showpage&amp;pid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
"'(?<!/)modules.php\?name=Club&amp;op=download&amp;fid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Club'",
'"(?<!/)modules.php\?name=Clan_Database&amp;l_op=visit&amp;lid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Web_Links&amp;l_op=visit&amp;lid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Clan_Database"',
'"(?<!/)modules.php\?name=Web_Links"',
"'(?<!/)modules.php\?name=Tutorials&amp;t_op=showtutorial&amp;pid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Tutorials'",
'"(?<!/)modules.php\?name=Downloads&amp;d_op=viewdownloaddetails&amp;cid=([0-9]*)&amp;lid=([0-9]*)&amp;ttitle=([/:\-\'{}()\,\._&amp;a-zA-Z0-9+= ]*)"',
'"(?<!/)modules.php\?name=Downloads(?!&)"',
'"(?<!/)modules.php\?name=News&amp;file=article&amp;sid=([0-9]*)&amp;mode=([a-z]*)&amp;order=([0-9]*)&amp;thold=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=News&amp;file=article&amp;sid=([0-9]*)&amp;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&section=$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&section=Club&ctsquery=clan-themes
 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
floppy
Newbie
Newbie



Joined: Sep 11, 2006
Posts: 92

PostPosted: Sat Jan 03, 2009 7:16 pm Reply with quote

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.
 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
floppy
Newbie
Newbie



Joined: Sep 11, 2006
Posts: 92

PostPosted: Sat Jan 03, 2009 8:10 pm Reply with quote

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&section=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&amp;pa=showpage&amp;pid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Club&amp;op=download&amp;fid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Tutorials&amp;t_op=showtutorial&amp;pid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Downloads&amp;d_op=viewdownloaddetails&amp;cid=([0-9]*)&amp;lid=([0-9]*)&amp;ttitle=([/:\-\'{}()\,\._&amp;a-zA-Z0-9+= ]*)"',
'"(?<!/)modules.php\?name=News&amp;file=article&amp;sid=([0-9]*)&amp;title=([a-zA-Z0-9_-]*)"',
'"(?<!/)modules.php\?name=Search&amp;section=([a-zA-Z0-9_-]*)&amp;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&section=$1&ctsquery=$2 [L]
RewriteRule ^search.html* search.html [L]
 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Jan 03, 2009 9:25 pm Reply with quote

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 
View user's profile Send private message Visit poster's website
floppy
Newbie
Newbie



Joined: Sep 11, 2006
Posts: 92

PostPosted: Sat Jan 03, 2009 11:28 pm Reply with quote

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.
 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch
linear-bunch