General discussions : Non mobile discussion : Need some help with a PHP algorithm
>
New Topic
>
Reply<
Esato Forum Index
>
General discussions >
Non mobile discussion
> Need some help with a PHP algorithm
Bookmark topic
OK.
This one's for hardcore PHP programmers (namely nuke_phpbb forums).
I want to do something similar to what happens here with Esato's hosted images. This is, and unlogged (anonymous user) can't view the pic in a post, and instead, another pic is placed.
So i need to parse a $message and replace any URL in <img> tags and between [img][/img] BBcode tags (don't really know if both aplly).
I'm completely lost here...
Maybe laffen could give me a snip of his code...
I'm very thankful to anyone who can point me a direction.
Cheers.
--
Posted: 2005-04-13 02:40:52
Edit :
Quote
good luck! have u tried www.phpBB.com or somethin simlar?
This message was posted from a P900
--
Posted: 2005-04-13 02:44:47
Edit :
Quote
I have this running on my page, but its not nuke, its xoops, i can let you have my script if i will find this thread to morrow when im at a pc :P
This message was posted from a Nokia
--
Posted: 2005-04-13 02:45:35
Edit :
Quote
Statndard PHP stuff like search and replace using 'ereg' bits should do what you want .
--
Posted: 2005-04-13 07:40:35
Edit :
Quote
I tried something like the "ereg" thing. Namely "preg_replace" but i failed to get it working.
A code snip would be very much appreciated.
--
Posted: 2005-04-13 11:14:17
Edit :
Quote
OK. I got it.
Just before the "Parse smilies" section in viewtopic.php
put this:
////////////////////////////////////////////////////////////////////////
// TWEAK TO REMOVE IMAGE DISPLAY FROM NOT LOGGED IN USERS
//
// PG: 2005/04/13
////////////////////////////////////////////////////////////////////////
if (!$userdata['session_logged_in'])
{
$message = ereg_replace("<img[^>]*>", "<img src="modules/Forums/images/logintoview.jpg">", $message);
}
And voilá!

[ This Message was edited by: Krubach on 2005-04-13 20:32 ]
--
Posted: 2005-04-13 21:31:58
Edit :
Quote
No Wurries... sorted !
--
Posted: 2005-04-13 23:28:46
Edit :
Quote
New Topic
Reply