Page 1 of 1

How to run a php file invisibly?

Posted: Mon Dec 09, 2002 4:26 pm
by sickmusic
Okay this is the scenario:

Everytime a user Posts a Message.. I'm assuming some processing happens in which an entry is added to the mySQL database.

Fair enough..

What I would like to do is, immediately after the entry has been added into the database, I would like a php file to be run before the browser is forwarded to:
Your message has been entered successfully

Click Here to view your message

Click Here to return to the forum


Can somebody please point me to the appropriate file and section to updated..?

If you need more information on what I am trying to do.. please ask..
Its basically topics_anywhere.php which has been modified to add an entry into a .js text file. This text file needs to be updated every time a user posts a message.

Many thanks..

FYI: http://www.phpbb.com/phpBB/viewtopic.php?t=55269

Posted: Tue Dec 10, 2002 3:43 pm
by sickmusic
bump*

OKay..

how about..
can someone point me in the right direction on some sort of tutorial that explains how a message is posted.. i.e. what files are processed when a user hits submit..

Many thanks in advance..

Posted: Tue Dec 10, 2002 4:03 pm
by JohnFish
Ok, so you want to alter the text on the page return after someone poste?

(just trying to understand, :D )

Edit: Ok, I get it, you would add your PHP at where the submit button links to give you the verification page, posting.php would need to be modified to do what you want.

Posted: Tue Dec 10, 2002 4:22 pm
by sickmusic
JohnFish wrote: Ok, so you want to alter the text on the page return after someone poste?

(just trying to understand, :D )

Edit: Ok, I get it, you would add your PHP at where the submit button links to give you the verification page.


No..
when someone hits submit, I want the browser to forward to topics_anywhere.php

topics_anywhere.php after being processed will then forward itself to
Your message has been entered successfully

Click Here to view your message

Click Here to return to the forum


so essentially im trying to add an extra bit of functionality to the process that POSTS a message, before it ends.

The funtionality I am trying to add is as follows:

http://members.lycos.co.uk/screenplay/p ... cl=mp3link

what this php file does is gathers up all the latest posts.. and writes the last 15 post to a text file.

my home page at www.sickmusic.com has a bit of javascript that take input from the specified text file (a .js file).
If you load my page up, u'll notice a Live Forum Topics section.. I am at the moment manually refreshing this with a link to the right of it.

i just want to find the most appropriate place to open that url.. ive been digging thro the php code.. and cant find the php file or section of it that does the last bit of processing before being complete.

Hope this helps.. and doesnt confuse you guys. thanks..

Posted: Tue Dec 10, 2002 5:05 pm
by JohnFish
The easy answer- this is very difficult to do, and may mess with the security of your forum. One of the main vulnerabilities in a forum is from the posting input window. That is why you are having trouble finding a place to put your code easily. The submit button input is run through the PHP in posting.php and returns the window you want to redirect before.

I'm not sure how to do what you want without compromising the security of your forum.

Posted: Tue Dec 10, 2002 9:30 pm
by whofarted
if all your looking to do is get the last 15 posts you don't need to write a whole file for that. you should get the phpbb_fetch_posts.php mod.

that would keep the topics live & up to the second. It's kinda the same thing as my forum. If you want, go to my site in my sig. & look at the top middle. You'll see the last 5 posts in the public forums.

Posted: Wed Dec 11, 2002 4:25 pm
by sickmusic
johnFish wrote: I'm not sure how to do what you want without compromising the security of your forum.


fair enough..

Understand the security aspect. The only security threat that i could see id someone modifying the url

http://members.lycos.co.uk/screenplay/p ... cl=mp3link

and changing n=15 to some riduculus number.. hence causing the text file to be filled with n number of lines

with a bit of effort i can change topics_anywhere.php, so that it takes not parameters from the url and harcode the values.

Unless you are aware of any other security feature I may be compromising??
whofarted wrote: if all your looking to do is get the last 15 posts you don't need to write a whole file for that. you should get the phpbb_fetch_posts.php mod.


OKay this is the clever bit..
My forum is hosted on Lycos.. yes free 50 megs.. yes banners.. yes problems..

and my main site is hosted for free by a friend who unfortunately can't provide php or mysql..

but i found a mod here.. topics_anywhere.. that allows the last n number of posts to be allowed to be displayed on any website in the world..

topics_anywhere.php basically spits out
document.writeln(url of post)

but because its on lycos.. other stuff is added.. i.e and extra script for advertising..

this causes my script n my home page to break.

My workaround involved changing topics_anywhere.php so that it writes to xyz.js

and my home page uses a Javascriptlet with a src pointing to xyz.js

therefore everytime a person posts a message xyz.js should be refreshed.. i.e topics_anywhere.php should be run.

:roll:

Posted: Fri Mar 21, 2003 4:08 am
by Feanoro
Mate, if you ever figure it out, id love to hear about it.

Ive been looking to do the same thing for ages

The Fetch Post mod gives the whole post.

Cheers