-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
PHP SESSION variables problem
requinix replied to xfrancis's topic in PHP Installation and Configuration
Make sure you have error reporting settings appropriate for development: make sure your php.ini has error_reporting = -1 display_errors = onand restart Apache if it does not already. Then try your code and look for error messages. If that doesn't help you find and fix the problem, post your code. -
New thread: http://forums.phpfreaks.com/topic/299787-to-create-an-hyperlink-in-php-which-is-used-to-open-an-file-with-any-format-which-is-saved-on-the-server-folder/
-
Ah, hosting support... Form inputs only work if you give them names. The IDs are just for the client side - mostly Javascript. <form method="post" action="#"> <input type="text" id="date1" name="post1" size="8"> <br /> <input type="text" id="date2" name="post2" size="8"> <br /> <input type="submit" name="submit"> </form>
-
Using date comparison in an if statement
requinix replied to ohboyatoytruck's topic in PHP Coding Help
But not the equals sign? -
Using date comparison in an if statement
requinix replied to ohboyatoytruck's topic in PHP Coding Help
Two options: a) Compare using timestamps. If you're only doing this in PHP then sometimes that's easier, and the fact that it's just straight numbers makes it easier to understand. $renewaldate = time(); if ($organisationsize == "Up to $3M" && $membershipyear = '2016' && $renewaldate >= mktime(0, 0, 0, 2, 15, 2016)) {b) Compare using date strings. There are three conditions you must satisfy for this to work: 1. Reading left to right, each number in the string (eg, hour, month) must be a larger unit than the next. So you can do year/month/day (year>month>day) but not year/day/month (year>day 2. Every component must be a number, and each number must be padded (with zeroes) to the largest length. For example, days can max out at two digits long, therefore every day must be padded to two digits. So no 'D' (day name) or 'j' (unpadded day number). 3. Both strings must use the same format string. You can't compare YYYY/MM/DD with YYYY-MM-DD. In practice that means you'll probably use one of two formats: YYYY-MM-DD ("Y-m-d") or YYYY-MM-DD HH:MM:SS ("Y-m-d H:i:s"), and the exact separator character doesn't matter. -
What if you turn off your firewall (temporarily)?
-
I thought you were using ngrok?
-
Understanding what a EVAL and base_decoder is doing
requinix replied to blmg2009's topic in PHP Coding Help
Either an exploit, or legitimate code that a seller wants to "protect" from prying eyes. blmg2009, there's good news and bad news. The bad news is that we can't help you decode something that's under license, which the stuff you posted is. (Normally I would remove licensed code, but what you posted isn't... well, it's harmless to have exposed.) The good news is that you want to understand how it works, not to break it apart. A fine line indeed. It's a horrible practice and wastes system resources doing a lot of stupid work, but some people think it's what they have to do to protect their code. Maybe they don't know much about licensing, or maybe they think it's truly effective, or what else I don't know. But the basic idea is to be able to give someone some code that works without being readable by a human. With PHP that's typically some combination of base64_decode() and gzinflate() that ultimately produces some code which can be eval()ed. Do that over and over again and eventually you get actual code that does actual stuff. It's like layers of an onion, except peeling onions isn't as painful. -
The nginx server needs to be listening on your LAN address too. As in 192.168.1.x. And the port for the firewall rule is the one that nginx uses. 8080. Your computer doesn't know anything about what the router is doing. What do you mean? What things? Make what unique? If there isn't already a rule set up for nginx then you'd need to make one: make a new firewall exception for a particular program (and find nginx.exe or whatever) so the rule doesn't grant access to everything, then allow access to port 8080 and any remote host.
-
1. The server has to be listening on your LAN IP address. 127.0.0.1 will only work for connections from the same computer. 2. Make sure your firewall allows inbound connections to that port. 3. Set up a port forwarding on your router from whatever port to your LAN IP address (and port).
-
There was a problem where all new users were required to have admin approval to validate an account. This has been changed back to something reasonable. New users from here on: upon registration you should receive an email. Please follow the instructions to approve your account. Existing users who are unapproved: click the Resend link in the top-right to get the email. Follow those instructions too. Should work.
-
I just email them to myself. For real. An actual email account. Is there a particular reason you aren't doing that?
-
Page visit check... SQLSTATE[HY093] Error message
requinix replied to SalientAnimal's topic in PHP Coding Help
Is #RETURN A LIST OF WHICH USERS ARE INDICATED IN THE PAGE_HIT TABLE $stmtvisit = $db->prepare('SELECT * FROM sys_page_hit WHERE memberID = $_SESSION[memberID]'); $stmtvisit->execute; $results = $stmtvisit->fetchAll(PDO::FETCH_ASSOC); echo $results;that code still around? Because there are a couple big problems with it. -
Procedures to send email with multiple data
requinix replied to FooKelvin's topic in Microsoft SQL - MSSQL
Why the heck are you sending emails from within the database server? -
Why did you comment out the return false? Don't you want it to return false for all the other cases that it didn't return true?
-
I can guess, but I'll ask anyways: What's your code now?
-
Where ATXMicro was - can there a ATX be build in !?
requinix replied to Maze's topic in Miscellaneous
Depends on the case... -
So you're seeing that "thank you for your email" message but not receiving the email? Did you change anything after taking the code from the original test script (where you got the email using PHPMailer) and copy/pasting it into the script that handles the contact form? And I assume the values for Username and Password and From are all correct in your real code and you edited those just for posting it here?
-
onfocus="this.readonly=false;" readonly is a boolean attribute on most s. Unless you want to actually remove the existing readonly attribute. The primary difference is what would happen if the form is reset. this.removeAttribute('readonly')
-
Alright. Use a DateTime for the chosen date and diff it to starting date. That will give you a DateInterval which can tell you how many days are between the two dates. Since you don't care about the number of cycles between the two dates (k from before) all you have to do is use modulus to get the day number (d). Which needs a bit more of an explanation. Say the diff is 108 days. The most obvious course of action is to +1 (because the starting date is day #1 and not day #0) and %15 to get 4. That's not quite right. Say the diff is 14 days. Smaller number. +1 is 15 and %15 is 0. That's not right: you need to get 15 and not 0. You could say "if result == 0 then result = 15" but there's an easier way: ($diff % 15) + 1What you're actually doing is taking the diff, +1 because of the starting date, then doing a trick where you -1 then %15 then +1. Watch: (14 % 15) + 1 = 15which is the result you wanted. And (108 % 15) + 1 = 4like before. $pattern = 15; $start_date = new DateTime("2015-12-14"); // day 1 // Day 15 = 2015-12-29 $chosen_date = new DateTime("2016-03-30"); $difference = $chosen_date->diff($start_date)->days; $day_number = ($difference % $pattern) + 1; If($day_number == 13 || $day_number == 15) { Echo "possible outcome. Day $day_number."; } Else { Echo "not possible, day $day_number"; }
-
Okay, so I think I figured out what you want. $start_date is the first date. You may have picked it arbitrarily, I don't know. 14 days later is the end of that cycle (1+14=15), and 15 days later (2015-12-30) is actually day 1 of the next cycle. Now you have a $chosen_date. That's going to be 15 * k + d inclusive days between it and the starting date, where k is the number of complete cycles between them and d would be the day number. As an example, with 2015-12-31 it's 17 = 15 * (1) + (2), meaning 1 complete cycle and the date is day #2 in the cycle. If the chosen date is 2016-03-30, that's 108 days later or day #109 (1+108) of the cycle. 109 = 15 * (7) + 4 and so the date is day #4 of whatever cycle. Right?
-
Adding exceptions to HTACCESS rewrites for https
requinix replied to blmg2009's topic in Apache HTTP Server
Yes, that's the code. Currently it says "if not using HTTPS then redirect to the https:// version of the page". That needs to be modified to say To get that new condition you can use RewriteCond %{REQUEST_URI} !^/index.php?route=ebay/openbay/(which assumes that this site is not located in a subdirectory underneath the domain) added next to the existing RewriteCond. -
There is so much more to doing emailing properly, and so many ways it can go wrong. Do yourself a favor and get yourself a copy of PHPMailer. (There are other things but it's the most popular.) There are tons of examples and plenty of documentation on how to use it, and it will take care of everything for you.