NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page $5 for giving me fix - extremely annoying small error

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-26-2007, 09:27 AM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: Jan 2007
Posts: 207
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:
<?
????: NamePros.com http://www.namepros.com/programming/298839-5-giving-me-fix-extremely-annoying.html
// 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 ..
????: NamePros.com http://www.namepros.com/showthread.php?t=298839

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.
crazyryan is offline  
Old 02-26-2007, 09:30 AM   #2 (permalink)
NamePros Regular
Join Date: Mar 2006
Location: United Kingdom
Posts: 413
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
????: NamePros.com http://www.namepros.com/showthread.php?t=298839

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
__________________
Linux Screenshots
Last edited by lee101; 02-26-2007 at 09:33 AM.
lee101 is offline  
Old 02-26-2007, 09:36 AM THREAD STARTER               #3 (permalink)
NamePros Regular
Join Date: Jan 2007
Posts: 207
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.
crazyryan is offline  
Old 02-26-2007, 09:46 AM   #4 (permalink)
NamePros Regular
Join Date: Mar 2006
Location: United Kingdom
Posts: 413
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!
????: NamePros.com http://www.namepros.com/showthread.php?t=298839

Lee
__________________
Linux Screenshots
Last edited by lee101; 02-26-2007 at 09:50 AM.
lee101 is offline  
Old 02-26-2007, 09:56 AM THREAD STARTER               #5 (permalink)
NamePros Regular
Join Date: Jan 2007
Posts: 207
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.
crazyryan is offline  
Old 02-26-2007, 10:05 AM   #6 (permalink)
NamePros Regular
Join Date: Mar 2006
Location: United Kingdom
Posts: 413
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
__________________
Linux Screenshots
lee101 is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:25 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger