In my code, the shoutbox doesnt work. The code is ment to replace [shoutbox]no= with <?php include("shoutbox.php?no= then replace [/shoutbox] with "); ?> which it does, but then the php code just appears in the sorce of the webpage. Does anyone know how to fix it?
Thanks
Notice from electriic ink:
There's no need to sign your name. We can see who started the topic
$string = strstr ($input, '[shoutbox]'); // Removes all parts of string that are NOT [shoutbox]...[/shoutbox] $string = strstr ($string, '[/shoutbox]', true); $string = $string . '[/shoutbox]'; // End remove
If you want to execute a string as if it were PHP code, consider researching eval. Just be careful with this function, as you wouldn't want user input to be ran as PHP code, so you may need to properly verify the string before running eval.
BTW, you can't include files the way you want them to be included; that is, assigning _GET variables.
It doesnt replace the $1 with the shoutbox id and the error message is;
QUOTE
[b]Warning: include(shoutbox.php?no=$1) [function.include]: failed to open stream: No error in C:\wamp\www\replace\index.php on line 18
Warning: include() [function.include]: Failed opening 'shoutbox.php?no=$1' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\replace\index.php on line 18
Even if it did replace the 1 variable, it still wouldn't work. As i've mentioned above, you cannot include files the way you want to. If you want to set $_GET['id'], you have to do so with the parent page.
$string = strstr ($input, '[shoutbox]'); // Removes all parts of string that are NOT [shoutbox]...[/shoutbox] $string = strstr ($string, '[/shoutbox]', true); $string = $string . '[/shoutbox]'; // End remove
Ok, but if im not just going to add a shoutbox code in there, i will post other tags like so then it wont work
It does. That's what this part of the code does:
CODE
$string = strstr ($input, '[shoutbox]'); // Removes all parts of string that are NOT [shoutbox]...[/shoutbox] $string = strstr ($string, '[/shoutbox]', true); $string = $string . '[/shoutbox]'; // End remove
It removes all parts of input that are not [shoutbox]...[/shoutbox] and processes them separately. Unless you can see otherwise...
BTW, what truefusion is saying about including files (I don't think you understand - sorry if you do) is this:
You can't include a file like this:
CODE
include 'file.php?id=1';
And have the code in file.php as:
CODE
function ($_GET['id']);
It doesn't work. If you want to "give" a variable to an included file, you have to this:
If i have a word like c.........a......t (with the dots in) and i wanted to replace it with cat how
would i do it. If i use CODE <?php $patterns =
"/c(*)a(*)t/"; $replace = "cat"; echo
preg_replace($patterns, $replace, 'c.....a.........t');
[/color][color="#000000"]?> then when i type something like "
c ome a nd look at t his" is also filtered. Is
there any way just to filter cat with dots in? ....
I can't delete a little file using file manager in Cpanel. I'm trying to delete a .png
image, actually, I'm trying to replace it. The response comes back as a success, but when I
reload my site it's still there. Then I go back to the file manager and go up a level, then back
and WOOP! There it is! I'm beyond frustrated here. What is going on?....
This is my source pic, i label it as S . This is my handsome pic, i label it as O : First,
i cut and paste my picture into the S picture. Turn low the opacity and fill and adjust the position
so that it fit the S picture: Erase the unwanted area. Go to image-adjustment-brightness and
contrast and adjust the lightning. Go to image-adjustment-color balance and adjust the color of O
picture until you get harmonic tone. Repeat these steps until you get the desired colour. Mine look
like this: Repeat all these steps until you get the best result. By com....
QUOTE 'Red Devils' replace Blues as champions Manchester United regained the English
Premiership title on Sunday after closest rivals Chelsea were held 1-1 by Arsenal. With two matches
to play United, who last won the title four years ago, hold a seven-point advantage over Chelsea,
who have won it for the past two seasons. United had beaten Manchester City 1-0 on Saturday thanks
to a Cristiano Ronaldo penalty - his 23rd goal of the season - and Chelsea were up against it when
they went 1-0 down and lost Khalid Bouhlarouz - who was sent-off - in the first-....
Sigh... preg_replace is getting very annoying for me. Could sombody tell me what I'm doing
wrong? Im making a bbcode replace for the forums I made, and preg_replace is being a b****...
Right now Im working on the tag, and I want to check for valid URL's, because idiots in the
forum are adding js and stuff in the image tags and messing it all up. So i put a function in the
array that holds all of the replacements: CODE
$main_search=array('/\[b\](.*?)\[\/b\]
/is','/\[i\ ....
I must be a total noob, or just really tired...............-.- either way, I cannot understand what
exactly those funky strings preg_replace wants for the pattern. Could sombody explain to me exactly
what the pattern string and the replace string in preg replace does? I get str_replace...
that's quite basic. I considered myself a pro at php until tonight........haha shows how much i
know. I bet tomorow, if i look it up I'll get it.... Anyway.. any help? Thanks.....
/laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" />....
I need a code that replaces all spaces between ] brackets with an underscore. So, basically, I
write this into a variable: CODE bla bla something [[some text]] more text here
And I want a script to change it to this: CODE bla bla something [[some_text]]
more text here Any suggestions?....
Microsoft have decided to come up with a new image format to add to the common JPGs, GIFs and PNGs
of today. It is to be called Windows Media Photo format or WMP for short. It is said to
"Surpass the limitations of existing file formats" and here is what it'll offer: Numerous
colour formats for printing and displaying High-quality lossy or even lossless compression
Really efficient decoding for numerous resolutions For more features, visit
http://www.microsoft.com/whdc/xps/wmphoto.mspx Presumeably, the JPEG2000 format or JP2 was ....
Hi, Im going to teach you how to replace a CD-Rom drive in a PC. It just takes a few simple steps
to do this, it is really not that hard. You can trust me since I have an a+ certification in
computer hardware and software. I know what I am doing, I am an expert. 1. First of all, you need
to shut off your computer. To do this press the power button on the front of the computer after you
have shut it down from Start> Shutdown on your start menu. 2. Unplug the power cord from your
computer. This is the big black/white/grey plug that plugs into the power supply on the bac....
Hello everyone, This is how to replace RAM in a PC. It just takes a few simple steps to do this, it
is really not that hard. You can trust me since I have an a+ certification in computer hardware and
software. I know what I am doing, I am an expert. 1. First of all, you need to shut off your
computer. To do this press the power button on the front of the computer after you have shut it down
from Start> Shutdown on your start menu. 2. Unplug the power cord from your computer. This is the
big black/white/grey plug that plugs into the power supply on the back of your PC.....
It's hard to believe that the Chief Justice is no longer William Rehnquist. He was the answer to
the citizenship exam question: Who is the Chief Justice of the US Supreme Court? Ans: William
Rehnquist. Wow... Personally, I think Bush brings death to his people in a karma-like way. So many
people have died during his terms already. Just think, during Bush's reign all kinds of natural
disasters occured (hurricanes, tsunamis), war, terrorist attacks, Supreme Court Justices died...Of
course, I'm not saying that Bush wants these things to happen or is directly re....
Hi, Does anyone know how i can do this, or scripts that will work on Trap17's servers and will
do the following: I have a .doc file form. Which i want to have filled in automactically, by HTML
Form and emailed to my address, with the data filled in. Any ideas? I have heard many differing
things, like XML, RTF, DOC, PDF... I have serched through many places and come up empty handed with
anything that works. /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> ....
When I try to edit, remove, rename, or replace my index into my public_html folder. It does not
work. Is there anyway to erase everything on your account, and start from scratch. Or a way to fix
this problem. I have PMed and Emailed the admin but haven't gotten help, can anyone here help
me?....
I don't know anything about PHP, except that I use phpBB and have modified my forums template
files. I used to make web sites years ago and just got back into it a couple months ago. I wonder
if I should stop using shtml and switch to php. I don't really have time to learn php (at least
not yet), but if it's easy to replace my Server Side Include with php (just to be more "modern")
I would be willing to do so. Anyone have any suggestions about me doing so? Am I'm too old
school for using shtml? Lol /laugh.gif' border='0' style='vertical-align:middle' ....
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.