Loop through $crawl with a for or foreach loop. You are now trying to put the method on an array instead of the strings inside the array.I'm trying to make something I can find on websites those words have or not but I can't print which word I have found.
View attachment 176011
I see I'm not good at those things but trying to make free tools for website owners. If anyone helps me with code I'm really appricaitedLoop through $crawl with a for or foreach loop. You are now trying to put the method on an array instead of the strings inside the array.
I'm on my phone now, but maybe someone else can type it out.
@Gogol Deleted member 923340
I see I'm not good at those things but trying to make free tools for website owners. If anyone helps me with code I'm really appricaited
<?php
if (isset($_POST['checker'])) {
$content = file_get_contents($_POST['checkurl']);
$content = htmlspecialchars($content);
$words = [
'HAPpY', 'Demo', 'Thing'
];
foreach ($words as $word) {
if (strpos($content, $word) !== false) {
echo $word . ' found!' . PHP_EOL;
} else {
echo $word . ' not found!' . PHP_EOL;
}
}
}
My man! I gave up on my phone because of that haha, didn't want to type that all overPHP:<?php if (isset($_POST['checker'])) { $content = file_get_contents($_POST['checkurl']); $content = htmlspecialchars($content); $words = [ 'HAPpY', 'Demo', 'Thing' ]; foreach ($words as $word) { if (strpos($content, $word) !== false) { echo $word . ' found!' . PHP_EOL; } else { echo $word . ' not found!' . PHP_EOL; } } }
Next time, post the code inside CODE tags, not as image![]()
Thank you so much and mb. You are right. Actually I don't wanna show them which words I'm searching for. When I found a word on website I could show which word is they have. Thanks for your time again.PHP:<?php if (isset($_POST['checker'])) { $content = file_get_contents($_POST['checkurl']); $content = htmlspecialchars($content); $words = [ 'HAPpY', 'Demo', 'Thing' ]; foreach ($words as $word) { if (strpos($content, $word) !== false) { echo $word . ' found!' . PHP_EOL; } else { echo $word . ' not found!' . PHP_EOL; } } }
Next time, post the code inside CODE tags, not as image![]()
Should work, however...PHP:<?php if (isset($_POST['checker'])) { $content = file_get_contents($_POST['checkurl']); $content = htmlspecialchars($content); $words = [ 'HAPpY', 'Demo', 'Thing' ]; foreach ($words as $word) { if (strpos($content, $word) !== false) { echo $word . ' found!' . PHP_EOL; } else { echo $word . ' not found!' . PHP_EOL; } } }
Next time, post the code inside CODE tags, not as image![]()
Should work, however...
That file_get_contents call may (and will) result in LFI attack.
It's unsanitized user input.
For example what if I send / etc / passwd (remove spaces, cf is weird) as the checkurl?![]()
Should work, however...
That file_get_contents call may (and will) result in LFI attack.
It's unsanitized user input.
For example what if I send / etc / passwd (remove spaces, cf is weird) as the checkurl?![]()
<form action="page.php" method="POST">
<input type="text" name="checkurl">
<button name="checker">Check</button>
</form>
Yeah the code should work like i said. If thats all you have, you should be ok. However if you use the content further, e.g. print the value of $content, it will print sensitive server files (in other words, LFI or local file inclusion).I'm using like this. There is no db connection or something. Only one-page work for this.HTML:<form action="page.php" method="POST"> <input type="text" name="checkurl"> <button name="checker">Check</button> </form>
He should turn on open_basedirShould work, however...
That file_get_contents call may (and will) result in LFI attack.
It's unsanitized user input.
For example what if I send / etc / passwd (remove spaces, cf is weird) as the checkurl?![]()
Hmm does that work? Not sure, i gotta check that setting. What I would do in this case is break the string apart with / and \ and then take the last member of the array, which should be the filename. Ofcourse, this could also be overflown or something, but it can be handled with a try catch.He should turn on open_basedir![]()