2009-09-07, 03:20 AM
2009-09-07, 03:27 AM
PMed.
2009-09-07, 06:37 AM
how about:
Does that work?
<?php
$variable .= "Value1";
$variable .= "Value2";
echo $variable;
Does that work?
2009-09-07, 07:46 AM
(2009-09-07, 06:37 AM)magicstuff Wrote: [ -> ]Does that work?
No.
Zash, from what I understand about your script, having 2 variables as one really doesn't pay off. A nice technique, but pointless. Explode is useful when you have lots of information that you want to put into a variable (and you know where it is so it's easy to retrieve), but it's just as simple to leave it as array values.
In the code you posted a few up from here, you're using a plain $linkback. Because you've exploded it, it is now an array. It should look something like this:
Array(
[0] => $cfg['scan_needle']
[1] => $cfg['scan_needle_2']
)
So, for your script to work, you will need to put either $linkback[0] or $linkback[1].
2009-09-07, 12:00 PM
Yea that's not my goal. I need it so that linkback will represent both. Xiofire said this is right:
$linkback = cfg['scan_needle'];
$linkback .= cfg['scan_needle_2']
If this doesn't work then I may be forced to just set up some if else statement
$linkback = cfg['scan_needle'];
$linkback .= cfg['scan_needle_2']
If this doesn't work then I may be forced to just set up some if else statement
2009-09-07, 12:17 PM
(2009-09-07, 12:00 PM)Zash Wrote: [ -> ]Yea that's not my goal. I need it so that linkback will represent both. Xiofire said this is right:
$linkback = cfg['scan_needle'];
$linkback .= cfg['scan_needle_2']
If this doesn't work then I may be forced to just set up some if else statement
Doing that, if cfg['scan_needle'] =
www.example.com
and cfg['scan_needle_2'] =
www.test.com
then $linkback would end up being
www.example.comwww.test.com
would it not...??
2009-09-07, 12:18 PM
(2009-09-07, 12:00 PM)Zash Wrote: [ -> ]Yea that's not my goal. I need it so that linkback will represent both. Xiofire said this is right:Nope didn't work. I'm gonna try an if else...
$linkback = cfg['scan_needle'];
$linkback .= cfg['scan_needle_2']
If this doesn't work then I may be forced to just set up some if else statement
I got it
Just had to change:
if (!$errors && $cfg['scan'])
{
$found_needle = false;
$url_2 = @parse_url($hint);
if (isset($url_2['host']) && $url_2['host'] == $url['host'])
{
$tmp = "http://".$url['host'];
if (isset($url_2['path']))
$tmp .= $url_2['path'];
if (isset($url_2['query']))
$tmp .= '?'.$url_2['query'];
$data = file_get_contents($tmp);
if (stristr($data, $cfg['scan_needle']) !== false)
$found_needle = true;
}
if (!$found_needle)
{
$scanner = new Scanner();
$scanner->init($proxy, $cfg['scan_needle']);
$found_needle = $scanner->scan($cfg['scan_timeout']);
}
if (!$found_needle)
$errors[] = 'We can\'t find a link back to us on your website.';
to if (!$errors && $cfg['scan'])
{
$found_needle = false;
$url_2 = @parse_url($hint);
if (isset($url_2['host']) && $url_2['host'] == $url['host'])
{
$tmp = "http://".$url['host'];
if (isset($url_2['path']))
$tmp .= $url_2['path'];
if (isset($url_2['query']))
$tmp .= '?'.$url_2['query'];
$data = file_get_contents($tmp);
if (stristr($data, $cfg['scan_needle']) !== false)
$found_needle = true;
}
if (!$found_needle)
{
$scanner = new Scanner();
$scanner->init($proxy, $cfg['scan_needle']);
$found_needle = $scanner->scan($cfg['scan_timeout']);
}
if (!$found_needle)
{
$scanner = new Scanner();
$scanner->init($proxy, $cfg['scan_needle_2']);
$found_needle = $scanner->scan($cfg['scan_timeout']);
}
if (!$found_needle)
$errors[] = 'We can\'t find a link back to us on your website.';
Just needed add a second check 2009-09-07, 04:16 PM
Assuming this :
Then your code would be better like this :
And you would be able to add many other needles afterward as needed.
P.S. I wonder how you could solve your own customers issues with their scripts as customer support...
$cfg['scan_needle'] = '<a href="http://MyDomain.com"|"<a href="http://www.MyDomain.com"';
Then your code would be better like this :
if (!$errors && $cfg['scan'])
{
$needles = explode('|', $cfg['scan_needle']);
$found_needle = false;
$url_2 = @parse_url($hint);
if (isset($url_2['host']) && $url_2['host'] == $url['host'])
{
$tmp = "http://".$url['host'];
if (isset($url_2['path']))
$tmp .= $url_2['path'];
if (isset($url_2['query']))
$tmp .= '?'.$url_2['query'];
$data = file_get_contents($tmp);
foreach($needles as $needle){
if (stristr($data, $needle) !== false){
$found_needle = true;
break;
}
}
}
if (!$found_needle)
$errors[] = 'We can\'t find a link back to us on your website.';
And you would be able to add many other needles afterward as needed.
P.S. I wonder how you could solve your own customers issues with their scripts as customer support...
2009-09-07, 04:21 PM
(2009-09-07, 04:16 PM)exdiogene Wrote: [ -> ]Assuming this :I have a basic knowledge of PHP, and I'm learning. Plus, I am not the only one, I do get help
$cfg['scan_needle'] = '<a href="http://MyDomain.com"|"<a href="http://www.MyDomain.com"';
Then your code would be better like this :
if (!$errors && $cfg['scan']) { $needles = explode('|', $cfg['scan_needle']); $found_needle = false; $url_2 = @parse_url($hint); if (isset($url_2['host']) && $url_2['host'] == $url['host']) { $tmp = "http://".$url['host']; if (isset($url_2['path'])) $tmp .= $url_2['path']; if (isset($url_2['query'])) $tmp .= '?'.$url_2['query']; $data = file_get_contents($tmp); foreach($needles as $needle){ if (stristr($data, $needle) !== false){ $found_needle = true; break; } } } if (!$found_needle) $errors[] = 'We can\'t find a link back to us on your website.';
And you would be able to add many other needles afterward as needed.
P.S. I wonder how you could solve your own customers issues with their scripts as customer support...
2009-09-07, 05:28 PM
Why not just use an array? :| instead of explode and all that stuff.
Just do
Just do
$cfg['scan_needle'] = array('MyDomain.com', 'www.MyDomain.com');
And then justforeach($cfg['scan_needle'] as $needle)