-
Posts
1,008 -
Joined
-
Last visited
Posts posted by spiderwell
-
-
$i is undefined so first time around its not 0 but just nothing, soon as you add 1 it becomes 1, so you dont see the array[0] if that makes sense
-
a very enjoyable and informative read, however i still have insomnia and need to find another good thread like this one
-
i would agree on the sessions thing, array passing in a form seems like extra work to me
-
so did this actually get solved, its a very confusing thread
-
never mind
-
Also there's no closing tag on the </form>. or i couldnt see one, not sure if that would affect anything
-
3rd time lucky (god i hope so!)
<?php $words = array('ass','fuck','shit'); $string = 'Blah blah blah ass blah blah fuck blah blah shit!'; foreach ($words as $value) { if (strpos($string,$value)) { echo "naughty words limit"; break; } } ?>
-
this should do the trick, the mistake i made was with instr() it didnt count number of times a rude word might appear, so was looking for 3 different rude words, rather than a total of 3 rude words, be they all different or the same.
EDIT*** i should be shot for skim reading, this allows you to have 2 rude words and not more, really as soon as you get a hit of 1 curse word you want it to stop. i will post YET A?NOTHER solution haha i think i need to go to bed!! ******
<?php $i = 0; $limit = false; $words = array('ass','fuck','shit'); $string = 'ass ass blah blah ass blah blah shit blah ass!'; foreach ($words as $value) { $i += substr_count($string,$value);// includes multiple counts of the same naughty word if($i>=3) { $limit = true; echo "naughty word limit"; } if ($limit)break;// stops the search going any further } ?>
-
actually that is flawed too, give me a few more mins, haha
-
try this mate, no offence to other poster, but I can't see that snippet working, or maybe I am just going mad:
<?php $i = 0; $words = array('ass','fuck','shit'); $string = 'Blah blah blah ass blah blah fuck blah blah shit!'; foreach ($words as $value) { if (strpos($string,$value)) { $i ++; } if($i>3) echo "naughty words limit"; } ?>
-
hehe cool, i would offer up a solution but am actually trying to work on a project.
-
all that does is check the bad words array , not the string.
-
you arent getting the include file as you havent filled variable $fun with a $_GET['fun'] request, so it will never meet the comparison if($fun=="upload")
-
in my experience its better to do it and not need it than the other way around
-
you could put a count variable into the loop and use that to trigger your break
-
the same way you store their details when they first register!
-
I couldnt see a value for $loginPage
-
the error message is your clue to the problem, its stating that file already exists.
echo out the $secure_folder on the line before so you can see what it is.
-
do a simple if file exists check before trying to include it.
-
the obvious answer is to put the missing file in there?
-
to have it checked just echo 'checked', not checked=checked?
-
-
yeh of course dont put the real name into the field, but I am the worst person for taking my own advice! lol
-
have you tried to send mail with hard coded values first?, something like this:
mail("myownemailaddress@blah.com", "my subject", "my body", "from@me.text.com")
try it in its own page, thus keeping the non sending issue seperate from all the other code.
PHP sessions help
in PHP Coding Help
Posted
as per the last post, slot it in here on the login.php: