-
Posts
4,207 -
Joined
-
Last visited
-
Days Won
209
Everything posted by Jacques1
-
Early booking reservation system using DateTime
Jacques1 replied to bg17aw's topic in PHP Coding Help
The effeminate special-little-snowflake attitude isn't going to help you in any IT community. If you want people to take you seriously, learn to shut up and listen. There's nothing worse than newbies who try to sound smart when they clearly have no idea what they're talking about. I said data format, not date format. Stop babbling, then you might actually get what people are telling you. -
Early booking reservation system using DateTime
Jacques1 replied to bg17aw's topic in PHP Coding Help
This time, I'm going to avoid cheap jokes about Wordpress users who think they're programmers. Let me put it this way: If you ever want to solve real problems and get past the copy-and-paste-from-Stackoverflow stage, there's a lot for you to learn. What you just can't seem to understand is the concept of choosing the right data structure. You've now spent at least two days working on a trivial interval search, and you still haven't managed to do anything but add another layer of duct tape to your code. Have you never wondered why you need so much time and help for simple problems? I'll give you a hint: Storing dates as strings in an unsorted array is probably the dumbest possible structure for an interval search. -
Error converting these codes to their mysqli counterpart.
Jacques1 replied to Olaolu's topic in PHP Coding Help
No, kid, I'm not going to do your homework, and, no, this is not urgent for me. If you urgently need to get a job done, we have the jobs section. Shall I move your thread? -
Error converting these codes to their mysqli counterpart.
Jacques1 replied to Olaolu's topic in PHP Coding Help
99% of the code is plain nonsense, so trying to translate this word for word will be a major waste of time, and you may have to start all over again in a few years. I recommend you learn PDO (mysqli sucks), try to understand the goal of the code and then reimplement it with the techniques of the 21st century. -
Early booking reservation system using DateTime
Jacques1 replied to bg17aw's topic in PHP Coding Help
You realize that Barand's entirey suggestion is based on changing the date format, right? So, yes, you are indeed horribly confused. -
The problem is that you aren't looking for help. You want others to do your job, for free. While you're pretty good at begging for code and getting people to spoonfeed you, that's also the reason why you don't make any progress whatsoever. I hear you complain a lot about shitty jobs, bad code you've inherited, all kinds of limitations etc. Have you ever wondered why nobody lets you do more interesting tasks? I'll give you a hint: When somebody can't echo a variable after 7 years of programming and needs Internet forums to do that for him, then people are going to question not just his competence but also his attitude. So maybe it's time to grow up and take responsibility instead of blaming everybody else and acting like a spoiled child.
-
You've been told exactly how to fix your code. On top of that, you've been given alternative code. If that's still not enough, I'm starting to doubt your willingness to work on the problem. This is no We-write-your-code service. After 7 years, you should know that.
-
I haven't written any code. I've told you what's wrong with your code, but you've appearently decided to rewrite it anyway. That's fine, but then you should have a basic understanding of what that code you've copypasted does. If you don't even know what to echo, maybe you should go back to the code you do understand.
-
Early booking reservation system using DateTime
Jacques1 replied to bg17aw's topic in PHP Coding Help
And yet you are using strings, not DateTime objects. So the real question is how to map those strings to DateTime objects, yes? Because usort() has nothing to do with your problem. As soon as the array elements can be compared with the standard operators, you just call sort(). -
How about: That what should be echoed (hint: there's a variable containing HTML markup). We know what you want. I'm not sure if you're reading the replies, though.
-
You're putting the selected attribute outside of the tag. You should actually see the text "selected ..." right in the menu where it doesn't belong.
-
So the code writes itself. Cool.
-
Look, none of us is a mind reader, and we're not sitting in front of your screen. If you want help with your code, we need to actually see that code (not just random fragments), and it's your job to do basic debugging. Like: What is the value of $page after the code above? Did you read my reply regarding the code error? And your directory check still makes no sense. Have you symlinked/copied the exact same script into multiple directories? Why would you do that?
-
This doesn't look right: } else if ($dir = 'mail') { ^^^^^ But, yeah, a tiny bit of information might help. Besides, those directory check gymnastics look very weird and fragile. Why can't you have a proper routing mechanism like with your other pages?
-
Good old Microsoft Notepad?
-
You have an opening brace in line 11 which is never closed. To avoid this kind of error, you should use consistent formatting. Note that a cookie-based check is entirely useless, because the user can just delete the cookie. In fact, an automated attack script won't even accept your cookies. Why should it do you that favor? The check also seems logically flawed. You first let the user log in regardless of the counter. And then you check whether the user is allowed to logged in -- but that's already too late.
-
Netbeans or Eclipse. What are you currently using?
-
Sounds like shaddf is mixing up GROUP BY and ORDER BY.
-
Get a proper editor or IDE with syntax highlighting. Then you don't need us to play human parsers.
-
GitHub / php / php-src I highly doubt that this is going to help you, though. The JSON parser is based on a formal grammar and a lot of PHP-specific features. A much better approach would be to use a JSON library for C++.
-
Yeah, well, so what is the problem? What should the data look like? You keep saying that only the first line is read, but how did you determine that? What specifically is missing? I'm not a mind reader. If you want me to take a wild guess, I'd say you're missing the “UNT”. Your function extracts everything between “UNH” and “UNT”, but your sample data has no “UNT”, so nothing gets extracted. Unless you've left out all relevant bits, which would be somewhat silly. In any case: Do some basic debugging with var_dump() so that you can provide concrete information. I'm not interested in guessing games with foreign languages and exotic data formats.
-
The form has zero bot protection, so get ready for a lot of spam and possibly people trying to flood your inbox. If you don't want to annoy your customers with CAPTCHAs, that's fine, but you should consider to at least implement basic counter-measures: an invisible trap field which must not be filled; this will stop a lot of the more primitive bots an IP address check against a spam blacklist (like Project Honey Pot); if the IP is fishy, make the visitor solve a CAPTCHA Calling htmlspecialchars() without the ENT_QUOTES flag and an encoding is risky, purposely omitting it is even riskier. The proper approach is to escape all output data, unless you explicitly want it to contain HTML. Write yourself a wrapper function: function html_escape($data, $encoding) { return htmlspecialchars($data, ENT_QUOTES | ENT_SUBSTITUTE, $encoding); }
-
I have no idea what you're doing there. You're supposed to replace the entire fopen/feof/fgets stuff with a single file_get_contents() call. Like this: $arquivo = file_get_contents('/path/to/file'); Note that accepting arbitrary files and moving them around on your server is dangerous. Anybody can upload malware this way. It's not even clear where you want to move the files, because you haven't provided a target path, just a filename. If you just want to read the content, don't move the file at all.
-
The file content is stored in the string $arquivo. Is this string complete? Then there is no problem with reading the file. If there's an issue in some other function, we need to see that function.
-
How do you know that only the first line is read? Where in your code do you check that? In any case, you should be using a high-level function like file_get_contents() instead of assembling the content yourself. What this problem has to do with the EDI format is unclear to me.