tags:

views:

47

answers:

1

I'm trying to understand code that I bought so I can modify it.

In the index.php there are picture links:

<a href="test10,10"><img title="" border=1 
src="makethumb.php?pic=product_images/test101.jpg&amp;w=121&amp;sq=N" / ></a>

I don't understand the href since it is not pointing to a page. test10 is an id of a picture. I assumed it was going back to the index.php and the code would extract the test10,10 from the url, but it's not. I know that because I put in trace code as the first line.

The question is, where is the link going to?

I know it that it somewhere in the process it executes a page called profile.php, but nowhere in the source code (doing a global search) is there an explicit call to profile.php.

As a related question, is there a way to profile the code to see what pages it's calling without using xdebug, which for the life of me I can't get working after many hours of trying every suggestion I found here and else where. (I'm using xampp)

The flow is: you enter the site www.site.com/final/index.php. which displays pictures with the link as above. When you click on the picture with an id of test10 it takes you to www.site.com/final/test10,1

thanks

+4  A: 

The question is, where is the link going to?

Under normal circumstances, a request to

www.yourdomain.com/current_directory/test10,10 

is made.

Usually, Apache will try to find a file of that name, and fail.

If the behaviour you get is different, then there is probably a mod_rewrite rule set up somewhere. Look for .htaccess files (note, files in parent directories affect all children) and check the httpd.conf, httpd-vhosts.conf and other log files for any RewriteRule settings.

Pekka
thanks.On my test apache, that no one touches except me, I wrote a test program linking to localhost/page.php/abc and it goes to page.php without a problem. the abc is visible in 4 places within $_SERVER
sdfor
@sdfor can you post a full example URL of `test10,10`? Because if it's something like `domain/profile.php/test10,10` it will be routed to `profile.php` and `test10,10` will be in the `REQUEST_URI` / `PATH_INFO` variables. When you have a long chain of directories and one of them is an existing file, that file is called. Is that what's the issue here?
Pekka
sdfor
@sdfor no, what happens if you click the link? What directory are you in?
Pekka
ah,www.site.com/final/index.php contains the link and we end up in www.site.com/final/test10,10I became aware of the problem when I moved the site to www.site.com and got rid of the '/final' and now it starts in www.site.com/index.php and it tries to go to www.site.com/final/test10,10 which causes an error.
sdfor
@sdfor at which point does it enter `/final`?
Pekka
However, it doesn't go straight to www.site.com/final/test10,10. I know it goes to other pages in-between. Based on what you said I searched for mod_rewite function calls and I found a few, but that's not it, I commented them all out for a test. Is there some other function like mod_rewrite?
sdfor
That's the problem, I can't figure out where it's going and how it gets to /final/test10,10. I wish I could get a profile trace working.
sdfor
@sdfor I don't think a PHP trace will help you here, this is at Apache level if I understand it correctly. Still, your description is hazy. Can you rephrase, step by step (maybe starting when you enter the site), what exactly happens and from which point on `final` enters the equation? Best edit your question, that's probably too much for the comments.
Pekka
"When you click on the picture with an id of test10 it takes you to www.site.com/final/test10,1" What is the exact full URL of that link? What is the content when you right-click the link and choose "copy URL" (or whatever it's named)?
Pekka
The flow is: you enter the site www.site.com/final/index.php. which displays pictures with the link as above. When you click on the picture with an id of test10 it takes you to www.site.com/final/test10,1I'm sure it's taking a circuitous route to get there. The question is how do I follow alink like href="test10,1" particularly when it's not going back to the page it resides on.baffled.
sdfor
@sdfor check my last comment before yours, I'd like to see the full URL (including server name.)
Pekka
good point.in firefox right mouse and "copy link location" results in www.site.com/final/test10,1in the site without the final, a rightmouse yields: www.site.com/test10,1
sdfor
@sdfor Okay. So there is no file with that name or `test10` in the root directory, right? There is no `.htaccess` file either? I'm off now but will check back later.
Pekka
you're on the right track! great! there is no page test10, but I found the htaccess! with the following:RewriteRule ^fdfsdf\.html$ /final/page.php?document=58RewriteRule ^fdfsdf\.html$ /final/page.php?document=RewriteRule ^fsdfsd,html$ /final/page.php?document=RewriteRule ^fsdfsd,html$ /final/page.php?document=RewriteRule ^page\.html$ final/page.php?document=73I'm not sure how to read that, but I'll learn.
sdfor
@sdfor make a backup of everything and just remove `/final`. Might already work.
Pekka
@sdfor then for safety, search the whole project for other mentions of `final`. There may be other locations where this is hard-coded.
Pekka
I searched within the ide and the database. the ide didn't consider the htaccess file even though it's in the same directory. Live and learn.thanks ever so much!!!
sdfor