Jump to content

Jacques1

Members
  • Posts

    4,207
  • Joined

  • Last visited

  • Days Won

    209

Everything posted by Jacques1

  1. He “flamed” you? C'mon. You've had a mental block, and somebody made fun of it. Yes, that can happen on the Internet. So what? Your project is fine, being new to PHP is fine, and there are plenty of people willing to help you. Fix the problem and move on. When you don't understand something, it's generally a good idea to address it directly and ask specific questions. Ignoring replies or merely stating that you don't understand them isn't really helpful. It can also be frustrating after a while.
  2. If you don't like coding: Create a backup in case something goes wrong. Export the data as a CSV file (SELECT ... INTO OUTFILE ...) Do the searching and replacing with a good editor like Notepad++, Reimport the data (LOAD DATA INFILE ...).
  3. Yes, I understand that. But for what purpose are you removing the BBCodes? Why should users not be able to click on Youtube links?
  4. And your doing this why, exactly? MySQL does't have a search-and-replace function based on regular expressions. But PHP does.
  5. There's an R TCP/IP server and an actively maintained client for PHP which takes care of the low-level stuff (parsing etc.).
  6. Frankly, I've never understood the purpose of those if-there's-a-row-then-fetch-it checks. I just call the fetch method. If it returns a row, I know there's one. If it doesn't, there's none (ignoring errors checks etc.).
  7. You're calling odbc_fetch_array() twice, and each call is “destructive” in the sense that it removes the next row from the result set. When there's one row, only the first call gets it. The second call cannot fetch anything. How about you remove the first “test call” altogether and do your var_dump() when the data is actually supposed to be fetched?
  8. So what's your question? Note that the library hasn't been released yet (and probably never will), so all you can get with composer is the latest stage of development: composer require kachkaev/php-r dev-master The library also isn't compatible with PHP 7, so if you plan to do an update in the near future, that's a problem. I'd look for an alternative.
  9. The OP likes to post his questions on many different forums at the same time. This has already been answered on CodingForums ($badWords isn't $badwords).
  10. Jacques1

    cron jobs

    Open the PHP error log, post the error here.
  11. Jacques1

    cron jobs

    The standard library for sending HTTP requests is cURL. Depending on the PHP settings, you may also be able to pass a URL to functions like fopen(). But this is more of a hack and often deactivated for security reasons.
  12. It's an entire application. So this sounds more like a job for the hire-a-programmer section.
  13. Jacques1

    cron jobs

    OK. None of this requires a cronjob. The timeout issues you had earlier can be fixed by simply disabling the time limit. PHP scripts run as long as you want them to run. You don't need to store the sequence either. If the user selects the colors and immediately starts the sequence, the data can simply be read from memory. So this boils down to a simple loop: <?php const BASE_URL = 'http://127.0.0.1/directory'; const SLEEP_AMOUNT = 5; // disable time limit set_time_limit(0); // example colors; this data is submitted by the user $colors = [ '009688', '66CCFF', 'FF4E50', ]; foreach ($colors as $color) { http_request('GET', BASE_URL.'/'.$color); // use cURL to make the request sleep(SLEEP_AMOUNT); }
  14. Sure. I can at least explain the ideas which do come from me. admin, master and franchisee are subsets of the staff table with the ID being a foreign key. The three recruitment tables cover the following three cases: The boss recruits a staff member as either an admin or a master. The “recruitment” can be deactivated and reactivated at any time (it's really supervision, not a recruitment). An admin from the admin table can recruit a staff member as either a master or franchisee. The recruitment can be (de)activated by both the admin himself and the boss. A master from the master table recruits a staff member as a franchisee (there are no other options). This relation can be (de)activated by any of the involved recruiters (the master, the admin who recruited the master, the boss). The role column can come in conflict with the role tables (e. g. a staff member recruited as an admin won't be able to recruit anybody until he's inserted into the admin table). This could be fixed by further splitting the recruitment tables. I can't comment on the SQL dump.
  15. It don't think so. It's a model of the data. Since there are specific rules for who can recruit whom, a recruitment is not just a simple person-to-person relationship. A lowly franchisee cannot recruit a boss. A master cannot recruit another master. You can pretend that anybody can recruit anybody and then implement the rules with triggers. This has been suggested in the previous thread. The problem is that triggers are obscure, and until now, nobody has volunteered to implement them. Or you could accept arbitrary data and then try to clean it up in the application, but I don't think that's a a good idea. So you won't get around the fact that there are different types of recruitments which involve different types of roles.
  16. Jacques1

    cron jobs

    We might be able to help you if you would be so kind as to state your real, actual problem. No more plot twists. You initially asked about how to make a cronjob execute PHP statements in a text file. Then it turned out you want to “fetch data from a website”. Now it turns out what you actually want to do is control LEDs which just happen to be attached to an HTTP server. So this is about LEDs, yes? And you want to do what with the LEDs? Go through a single sequence of colors? Then the entire cronjob stuff is nonsense. Timeouts can be fixed by disabling the time limit. Anyway, forget about PHP and just give us a coherent description of the ultimate goal together with concrete examples. Something like: “I want to show red for 5 seconds, then green for 15 seconds, then again red for 10 seconds.”
  17. And you need to HTML-escape your variables. You can't just drop random strings into your markup and assume that they won't interfere with the rest of the page. In the worst case, this can be used to inject malicious code (also known as cross-site scripting). <?php function html_escape($raw_input, $encoding) { return htmlspecialchars($raw_input, ENT_QUOTES | ENT_SUBSTITUTE, $encoding); } <?php const APP_HTML_ENCODING = 'UTF-8'; // insert your encoding here echo '<option value="'.html_escape($user_data['id'], APP_HTML_ENCODING).'" '.($user_data['id'] == $opened['id'] ? 'selected' : '').'>'.html_escape($user_data['fullname'], APP_HTML_ENCODING).'</option>'; Of course the best solution is to avoid this kind of PHPHTML spaghetti code altogether.
  18. What kind of “relay” are you talking about?
  19. Again: What does “not work” mean? Is there a problem on the page itself? Are you simply not getting any e-mail? Has the application ever sent any e-mails? Be specific! We're not sitting in front of your screen, and we cannot read your mind. Your e-mails don't have a From header, the headers should be terminated with \r\n rather than \n, and you should try a plaintext mail before jumping to HTML content.
  20. No, the error log on the server. An internal server error by definition happens on the server. To find out the path, run php -i | grep error_log If it says “no value”, try the error log of your webserver (Apache?).
  21. How about checking the error log?
  22. The offset is 0-based, so starting at 1 will skip the only row. A GROUP BY clause only makes sense when you're using an aggregate function like SUM() or AVG().
  23. And then ...? Again: I'm asking for the specific problem. What happens? You've claimed that only one person can use the test at a time. That's too vague. It may not even be true (maybe there's some other problem, maybe the user interface is confusing, I don't know). If you want any kind of feedback from this forum, you need to be specific. We know nothing about your application or your problem. If the application simply crashes, that's a bad sign and may require extensive debugging as well as code changes. If there's an intentional limit, that's a good sign and may indeed be a quick fix (this is an estimate, not a definite fact).
  24. Jacques1

    cron jobs

    Please don't duplicate your topics, and try to pick a sensible forum for your questions. I've removed your new thread from the third-party section, because you're already discussing it here, and it's not a third-party script.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.