[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 02-26-2007, 08:27 AM   #1 (permalink)
NamePros Member
 
Join Date: Jan 2007
Posts: 171
0.00 NP$ (Donate)

crazyryan is on a distinguished road


$5 for giving me fix - extremely annoying small error

Basically, if you go to http://www.proxy.gd/proxies/proxy.php?id=73 it'll redirect, however when I go to http://www.proxy.gd/proxy/id/73/ it doesn't redirect, it always used to and for some reason it's just stopped. My code is below.

PHP Code:
<?
// We need the database stuff
require 'config.php';
if (
$_GET['id']) {
$id = mysql_real_escape_string($_GET['id']);
// Check ID exists
$q = "SELECT * from links where link_id = '$id'";
$res = mysql_query($q) or die("Error in query " . mysql_error());
$nr = mysql_num_rows($res);
if (
$nr > 0) {
$data = mysql_fetch_assoc($res);
mysql_query("UPDATE links set link_visitors = (link_visitors + 1) where link_id = '$id'");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>You are being redirected to <?php echo " " . $data['link_title'] . " "; ?> now.</title>
<!-- Begin Publisher Code -->
<script src='http://www.adversalservers.com/publisherJS.js'></script>
<script type='text/javascript' language='javascript'>
initAdversal('2c908c519fb86e4e0f9158fadddfb82c', true);
</script>
<!-- End Publisher Code -->
<link href="http://www.proxy.gd/style/style.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
    <link href="http://www.proxy.gd/style/ieBugs.css" rel="stylesheet" type="text/css" />
<![endif-->
</head>

<div id="border">
<div id="wrapper"><?php
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url= " . $data['link_url'] . "\">
<p class=\"box\" align=\"center\">You are being redirected to "
. $data['link_title'] . " now.<br /><br /></p>";
exit();
}
else {
echo
"Invalid ID";
}
}
else {
echo
"No ID specified";
}
?>


</div></div>
<body>
</body>
</html>
I'm not sure if this is a PHP error or mod_rewrite error, although I can't think of it being a mod_rewrite error ..

Options +FollowSymLinks
RewriteEngine on
RewriteRule proxy/(.*)/(.*)/$ /proxies/proxy.php?$1=$2

Is my mod_rewrite code. If you can help me fix this and get the mod_rewrited url working I'll send you $5 via paypal, thanks.
__________________
Proxy
crazyryan is offline  
Old 02-26-2007, 08:30 AM   #2 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Location: United Kingdom
Posts: 344
482.75 NP$ (Donate)

lee101 is a jewel in the roughlee101 is a jewel in the roughlee101 is a jewel in the rough


I'm not entirely sure with mod_rewrite, but it may be worth trying
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ./proxy/(.*)/(.*)/$ /proxies/proxy.php?$1=$2
In the htaccess file

If that doesn't work then try putting
<?php echo $_SERVER['REQUEST_URI']; ?>
at the top of proxy.php, then accessing it through the mod_rewrited file and if it doesn't come up with a URL like the other page, then that narrows it down to the .htaccess file, if the URL is like the non-mod_rewrite one, then it must be a php problem
__________________
http://bypasstopsite.com - Submit your proxy!
http://biggertwitter.com - Make twitter a bit bigger!
Currently Developing - Linux Screenshots

Last edited by lee101; 02-26-2007 at 08:33 AM.
lee101 is offline  
Old 02-26-2007, 08:36 AM   #3 (permalink)
NamePros Member
 
Join Date: Jan 2007
Posts: 171
0.00 NP$ (Donate)

crazyryan is on a distinguished road


That mod_rewrite code didn't work, putting that request code thing in proxy.php showed "/proxies/proxy.php?id=73" on http://www.proxy.gd/proxies/proxy.php?id=73 - but not on the mod_rewrite part.
__________________
Proxy
crazyryan is offline  
Old 02-26-2007, 08:46 AM   #4 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Location: United Kingdom
Posts: 344
482.75 NP$ (Donate)

lee101 is a jewel in the roughlee101 is a jewel in the roughlee101 is a jewel in the rough


hmm, i see what you mean about this being an annoying errror lol,
I am thinking this is a mod_reqrite error then, since it doesn't seem to be passing on the variables correctly

Try these, in the following order

1st
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ./proxy/(.+?)/(.+?)/$ /proxies/proxy.php?$1=$2
if not then
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ./proxy/(.+?)/(.+?)/ /proxies/proxy.php?$1=$2
edit: A third thought, after looking through the apache manual
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^proxy/(.*)/(.*)/$ /proxies/proxy.php?$1=$2
And a fourth for good luck
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^proxy/(.+?)/(.+?)/$ /proxies/proxy.php?$1=$2
Hopefuly one of these will work!

Lee
__________________
http://bypasstopsite.com - Submit your proxy!
http://biggertwitter.com - Make twitter a bit bigger!
Currently Developing - Linux Screenshots

Last edited by lee101; 02-26-2007 at 08:50 AM.
lee101 is offline  
Old 02-26-2007, 08:56 AM   #5 (permalink)
NamePros Member
 
Join Date: Jan 2007
Posts: 171
0.00 NP$ (Donate)

crazyryan is on a distinguished road


Neither of them worked

Fixed it, I had something else in my .htaccess that must have been interfering with it.
__________________
Proxy
crazyryan is offline  
Old 02-26-2007, 09:05 AM   #6 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Location: United Kingdom
Posts: 344
482.75 NP$ (Donate)

lee101 is a jewel in the roughlee101 is a jewel in the roughlee101 is a jewel in the rough


Argh dammit!
Last attempt lol, after that I'm afraid I may give up
Code:
RewriteEngine On
RewriteRule ^page/(.+)$ /proxies/proxy.php?id=$1
That should work, I think hope pray etc.

Lee
__________________
http://bypasstopsite.com - Submit your proxy!
http://biggertwitter.com - Make twitter a bit bigger!
Currently Developing - Linux Screenshots
lee101 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 07:17 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85