Lodius2000
Members-
Posts
586 -
Joined
-
Last visited
Never
Everything posted by Lodius2000
-
so first things first, it doesnt highlight this is my example script <pre xml:php> (<-this works for fomatting but not highlighting but ive also tried <pre lang:php>, <pre lang=php>, then i switched to {geshibot} and tried {geshibot}, {geshibot xml:php}, {geshibot lang:php}, {geshibot lang=php} <?php print "hello world"; ?> </pre> also, with both the geshibot and the preloaded geishi mambots it seems like the code is being interpreted as well as displayed, for instance print "<br />\n"; prints print " \n"; also the code does not wrap so long lines of code break the page layout, how do I get it to put the gray box around the code like we have here on this forum so that it doesnt break the page? any help you guys have is much appreciated
-
guys, thanks for the responses, the word list as i now see does look like it is just replacing the vowels, but it is intended to block any word I want with any string i want so crap could become c*** if i deemed cr*p to be too revealing (obviously using a word with a much higher offensiveness) I could even change crap into ***REMOVED*** (which i guess takes out the case sensitivity) but what i really want is for me to add the problem word once to the wordlist, and then the preg function to find the word but retain the case of the letters that are not changed so that the comment (that is what this is for) would not be altered too much So If I wErE tO tYpE cRaP lIkE tHiS it would turn into So If I wErE tO tYpE cR*P lIkE tHiS thus retaining the style of the author but filtering the bad words
-
thats a much better answer haku, thanks
-
its because file paths are relative to the file you are currently accessing if(file_exists("/home/user/protected/test.txt")) is looking for the file /home/user/public_html/beta/java/home/user/protected/test.txt the ../ backs you up a folder does that make sense?
-
going off this thread http://www.phpfreaks.com/forums/index.php/topic,225600.15.html I was wondering if there is a way to make the expression used here case insensitive <?php $comment = 'Dang this crap, I want to shoot somebody. But that would be dangerous!'; $wordlist = "crap:cr*p|dang:d*ng|shoot:sh**t"; $words = explode('|', $wordlist); foreach ($words as $key=>$word) { list($needle[$key],$replacement[$key])=explode(':', $word); $needle[$key]= "/\b{$needle[$key]}\b/i"; } $comment = preg_replace($needle,$replacement, $comment); echo $comment; ?> so that crap replaces with cr*p and Crap replaces with Cr*p or CRAP replaces with CR*P and so on //terrible at regex Thanks
-
ima moron thanks
-
ok so now im really confused $badword = $db->getAll('SELECT word FROM badwords ORDER BY id'); $replacement = $db->getAll('SELECT replacement FROM badwords ORDER BY id'); foreach ($badword as $v) { $b[] = $v['badword']; } $badword = $b; foreach ($replacement as $val) { $r[] = $val['replacement']; } $replacement = $r; print_r($badword); print "<br>"; print_r($replacement); prints Array ( [0] => [1] => [2] => [3] => ) Array ( [0] => bl**d [1] => f*rt [2] => h*ll [3] => j*rk ) why would it work for the one that you gave me ($replacement) and not the one that i modified it for ($badword)
-
crayon that print_r's as Array ( [0] => [1] => [2] => [3] => )
-
this $replacement = $db->getAll('SELECT replacement FROM badwords ORDER BY id'); print_r()'s a this Array ( [0] => Array ( [replacement] => bl**d ) [1] => Array ( [replacement] => f*rt ) [2] => Array ( [replacement] => h*ll ) [3] => Array ( [replacement] => j*rk ) ) i $replacement to be an array that looks like $replacement = array (bl**d, f*rt, h*ll, j*rk) and i am at a loss as to how i tried foreach ($badword as $needle){ $needle = array($needle); } yeah, that didnt work help thanks
-
[SOLVED] php foreach combined with javasvript function
Lodius2000 replied to Lodius2000's topic in PHP Coding Help
concatinate $thumb onto the end of both the js fucntion definition and the call to the js function I love epiphanies on the way home from work SOLVED -
hrm, dunno man I use peardb so i dont really know my mysql functions too well, but i think but you would have to find a way to apply MRES to all of the elements of the $row_result array
-
huh?
-
look up add slashes or mysql_real_escape_string ALWAYS ESCAPE YOUR DATA - not yelling just emphasising
-
Hi, ive got a js function inside php foreach and it isnt doing the right thing <?php foreach($thumbs as $thumb){ $url = $db->getOne('SELECT thumb_url FROM image WHERE id = ?', array($thumb)); print '<div class="img">'; print ("<script type=\"text/javascript\">\nfunction uploadwindow() { new_window = window.open('../editcaption/index.php?id=" . $thumb . "','popup','width=650,height=440,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); } </script> </script> <a href=\"javascript:uploadwindow();\">" . $url . "</a>"); print '<div class="desc">Image '.$thumb.'</div></div>'; } ?> it is an image gallery that when you click an image the caption comes up in a popup, so you can edit it now the problem is that the portion that says window.open('../editcaption/index.php?id=" . $thumb . "','popup',' the $thumb always points to the last $thumb in the foreach loop, no matter which of the images that you click on the frontend side you click to open the popup. I checked the page source and each of the urls in the separate js functions do point to the right iteration of $thumb, but like i said when clicked they all go to the last $thumb Thanks for the help
-
[SOLVED] how do i re-number my rows in my db
Lodius2000 replied to Lodius2000's topic in PHP Coding Help
agreed, have since rectified the problem solved -
[SOLVED] how do i re-number my rows in my db
Lodius2000 replied to Lodius2000's topic in PHP Coding Help
hrm, i guess other than for display purposes (i use the old '<tr class="' . $styles[$i % 2] .'">' trick to make the table easier to read) it doesnt -
I dont know all the names but would it hurt to change the zone to maybe Europe/Warsaw sore somewhere east of you by one timezone, I am sure there are some cities in africa that qualify too. //berlin is 8 hours from gmt, wow, would never have guessed
-
I have a table with an INT field called id, i have a script that can delete a row if needed, problem is i need to re-number all of my rows because if i delete id=3, i am left with 1,2,4,5... I think i could do it with a few array functions (but im coming up blank on which they are), also the only way i can think to do that would be to set up a foreach and do an update for all the rows but could it also be done in sql help thanks
-
retrieving values from nested post array
Lodius2000 replied to Lodius2000's topic in PHP Coding Help
awesome thanks -
retrieving values from nested post array
Lodius2000 replied to Lodius2000's topic in PHP Coding Help
so generic, where does my id number go, if $_POST[1]['word'] i can now retrieve $word but ive lost '1' thanks -
solved... but I started a followup topic http://www.phpfreaks.com/forums/index.php/topic,226631.0.html
-
this is a followup to my last topic, which was solved http://www.phpfreaks.com/forums/index.php/topic,226621.0.html but now the topic has changes enough to warrant a new topic and a repost of my last post in the previous topic, which contains the question I wanted to ask here so I want to split apart my post array so i can query the db post looks like this $_POST[1]['word'] $_POST[1]['replace'] $_POST[2]['word'] $_POST[2]['replace'] where the integer is a row number so to split it apart i use <?php foreach ($_POST[] as $word, $replace){ mysql_query("UPDATE badwords SET word = $word WHERE id={$_POST['id']}"); //repeat for replace } ?> is that right? thanks
-
so I want to split apart my post array so i can query the db post looks like this $_POST[1]['word'] $_POST[1]['replace'] $_POST[2]['word'] $_POST[2]['replace'] where the integer is a row number so to split it apart i use <?php foreach ($_POST[] as $word, $replace){ mysql_query("UPDATE badwords SET word = $word WHERE id={$_POST['id']}"); //repeat for replace } ?> is that right? thanks
-
suite