TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 777
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 104
  • Total: 104

TP prefixing absolute paths in php scripts?

Started by Inge Jones, January 29, 2007, 06:00:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jacortina

See above. href and img specifications should be quoted (just like it is in the snippet you referred to).

Inge Jones

#11
Let me post the version I actually have working.

$featuredsite = array (
'<a href="http://sims2noir.blogspot.com/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featuredjudfernoir.jpg"></a>',
'<a href="http://bluemooner.com/primrose/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featuredprimrosegardens.jpg"></a>',
'<a href="http://www.freewebs.com/t2suggas/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featuredt2suggas.jpg"></a>',
'<a href="http://minena.prismbaby.com/sims/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featuredminiroll.jpg"></a>',
'<a href="http://www.catandsusims.com/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featuredcatandsusims200x200.jpg"></a>',
'<a href="http://www.strawberry-patch.net/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featuredpurplepaws.jpg"></a>',
'<a href="http://inlimite.com/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featured_mickeyinlimite.gif"></a>',
'<a href="http://community.livejournal.com/msr_simstuff/" target="_blank"><img src="http://ffss.simlogical.com/featuredsites/featured-msr_simstuff.jpg"></a>',
);

shuffle($featuredsite);

echo $featuredsite[0];


Now, all I want different is I want it to get those images from attachments not the featuredsite folder I had to make

Ianedres

The version you actually have working uses a double quotation mark after the img src= and the one you posted with variables used only a single quote.  :coolsmiley:

Inge Jones

Yes the one I posted was just an example to illustrate what I was trying to do.  It never did work, and of course I appreciate the advice on fixing it, which will be useful for the future.

But the one I have working *doesn't work on the attachments folder* and that is what my underlying problem is, the whole reason I am posting at all.

jacortina

If you have a 'localhost' allow in the htaccess, it might not be resolving correctly to allow a subdomain. Perhaps an 'Allow from simlogical.com' (or even explicitly ffss.simlogical.com) might help.

Inge Jones

That's something I could try.  That requires my users not to have their referrer hidden doesn't it?

How does TP usually let /tp-downloads know it's "friendly" ( or how does SMF let /attachments know?) and get past the .htaccess?   Is there something I could borrow?

jacortina

Your site's URL (the forum's /index.php) is the referrer for virtually everything done by SMF or TP (unless, for some reason, a different file is being 'executed', in which case that's the referrer/referring URL). For regular domains, 'localhost' usually resolves to the same thing. I haven't really worked with subdomains and I'm just throwing out something to try here.

Inge Jones

Ok thanks.  I am just going to try out a test forum which is not in a subdomain and see if I get different results!

jacortina

Also, check what the actual permissions and OWNERSHIP are on the files and directories.

If you directly created the directory (via FTP, for example) and uploaded files. ownership would be yours. But on most severs PHP runs as user 'nobody'.

Inge Jones

Who does TP or SMF run as?   Can't I set up a script to run as one of them?   You see I thought it would, if it was running from a TP block, run with all the same user ID and permissions as TP.

This website is proudly hosted on Crocweb Cloud Website Hosting.