-
Posts
15,262 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
If you're going to work with PHP then I suggest you learn the fundamentals of PHP. That's going to be really important for you to be able to write code that actually works. When you have a grasp on it, spend some time learning about how your MVC framework works. About how views work, and about this $data variable it apparently sets up in the view, and about how to use view classes to pass data. I say that because I can see (1) you did not make anything public, and (2) changing $data->mPaperId to just mPaperId actually made your problem worse. What you should (as far as I can see) be doing is leaving mPaper and mPaperId alone, make your mStudylevelId and friends public (and please rename them to not have an underscore), and then using $data in the view to reference those properties. But that could be hard to understand if you don't have a basic knowledge of PHP or of the framework you need to use.
-
Post the code you tried, both for the class and for the view.
-
You can't access $StudylevelId and such because those variables do not exist. You should use what's in $data. You can't access $data->_mStudylevelId because it's private. Either make the variables public, like mPaperId is, or find some other way to make those values available outside of the class.
-
That sure does look like the fundamentals of RDMSes. Plus a little more than what I would call fundamentals, but still important things that someone should know if you're looking to focus on SQL and databases specifically as a career. Are you asking whether this course looks like it would be beneficial to you? If you're not already familiar with most of these things and/or want a formal setting to learn them then sure, it looks beneficial.
-
If you don't need multiple user accounts then why do you need signup and password resets and such? Those features are for letting (multiple) users manage their own accounts - if you don't have multiple users, or if you don't mind managing their accounts for them, then you don't need those features. Partly. A library will give you the tools to build a bookcase, but you still have to build the bookcase yourself. My opinion of Laravel is primarily technical in nature: I don't believe it is a well-designed piece of software. Laravel provides a lot of features, but it will not be everything you need: you will have to do some work yourself. Which means you'll have to understand Laravel and deal with its... eccentricities. Spoiler alert: Laravel or Symfony or CakePHP or whatever runs on the backend has approximately 0% to do with what you see on the website itself. Those things are nails and screws and paint primer and are great at keeping the bookcase together and usable, but you are absolutely not going to be judging the bookcase based on whether it used nails or screws. Whatever system you choose, the frontend is what users see and interact with, and the frontend can be whatever you want regardless of what's happening in the backend. Frameworks like Laravel will give you a starting point to build from, but unless you want to keep the stock appearance they provide you with out of the box, you're going to need something separate. Maybe you make it yourself, maybe you buy it, whatever. The problem is that things like user authentication are tricky. It's easy to do, but it's not easy to do right. Learning how to do it right will take a long time and you'll be reinventing how shelves work. If you want to do that then great, and I even encourage it, but most people want shelves they can put their books on today. Professional, huh? So how much money are you willing to spend? You willing to help pay the salary of some "professional" developers? Those are rhetorical questions. Fact is, the best stuff you're going to find is what I've already said and you've already seen. Another fact is that there is rarely, rarely ever going to be a piece of software out there that does everything you want. Because you're the only one who knows what you want, and you're not out there writing it. So you have two choices: you can lower your expectations to find common denominators already available, or you can keep your desired set of features and functionality and accept that you'll have to do some amount of work yourself.
-
Laravel is dumb, but a thing that exists and is popular and is dumb and people do use it. It's primarily an entire framework, as in it provides a dumb foundation for an entire website/application, but there are dumb library aspects to it too. I wouldn't suggest it because it is really more of a dumb framework than a library, so using pieces of it may not work out. Not that I ever have done so myself, given that Laravel is dumb, though I have used Laravel (as a framework) before, so take that with a grain of salt. You should also consider that Laravel is dumb. I would put far more faith in an ecosystem like Symfony, which is pretty much the de-facto choice of libraries for PHP, than I would in random things you'll find across the internet. Especially things that haven't been touched in years, which means they haven't been maintained, and since no code is ever perfect this also means it has bugs that aren't getting fixed. Meanwhile Laravel, despite being dumb, actually uses some Symfony pieces internally, which isn't dumb. Using Symfony does require a little more effort on your part as it tends to try to be powerful and this can mean it sacrifices some ease of use, but this is a good thing as you're working with a - dare I say - not dumb library. But I wouldn't be a senior developer unless I gave you the standard reply: "it depends". The primary matter is going to be what kind of "auth" you're talking about. Do you mean a full user system, like with signups and password resets and an administration tool? Do you mean something to password-protect some files, or a section of your site? Do you need something that looks nice or can it be something super simple provided it can do the job? Do you need to deal with user accounts being added and disabled, or just something quick where you can give out a password to people you want to allow access?
-
Probably, yes. Like I said, get yourself the email and headers in your PHP code and see what you have to work with. If the headers include the results of your provider validating the email, like apparently it does, then that's all you need to do and there's no need for what ChatGPT said about verifying it yourself.
-
You don't have a filename for any of those files. Is there supposed to be a filename for all of those files? If so then you need to fix that. If not then you need to change your code so that it doesn't try to show a download button if there is no file to download.
-
None of those rows have a value for the "file".
-
A library for a one-line regular expression? One step at a time. Get the headers first, then see exactly what you have to work with.
-
It'll depend on your email provider. For example, Gmail adds headers to the message detailing its attempt to authenticate the sender. These are from an email from GitHub: ARC-Authentication-Results: i=1; mx.google.com; dkim=pass [email protected] header.s=pf2023 header.b=bHsZs+1u; spf=pass (google.com: domain of [email protected] designates 192.30.252.210 as permitted sender) [email protected]; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=github.com Received-SPF: pass (google.com: domain of [email protected] designates 192.30.252.210 as permitted sender) client-ip=192.30.252.210; Here, you'd retrieve the full message from Gmail and then look for those headers.
-
...Oh wait, you want to validate the sender? I completely misunderstood what you were asking for. Good news: validation of an email's sender is more or less a solved problem with SPF and DKIM records. It's up to the sender to opt-into those things, but if they do, emails passing validation can be pretty confidently attributed to that sender. So check if your emails are being validated like that - which they really ought to be, and I'd be surprised if they weren't. If so then you should be able to retrieve that validation information through PHP.
-
who is responsible to configure docker ?
requinix replied to Nolan81's topic in PHP Installation and Configuration
Totally depends on the organization. Generally, though, individual teams are going to be responsible for their own projects. -
No, there's no way to authenticate an email like that. Maybe if the protocol had been designed within the last decade or so they would have considered that, but right now, the identities behind email accounts are entirely unknowable. The best you can do is what I'm sure you've seen other sites do: send the email with a confirmation code or link and have the user enter/click that so you know they received it.
-
Develop a CMS with categories and subcategories in the database.
requinix replied to LeonLatex's topic in PHP Coding Help
You've never seen a tagging system before? Think of them as categories, except you can have as many as you want without restrictions. In a way, this thread is in the "PHP Coding Help" category, and that means it can't be part of the "MySQL Help" category at the same time. But if this forum used tags instead, this thread could be tagged as "php" as well as "mysql" and "database design" and "cms". (And actually it can, but people rarely use tags for their threads.) There's no way you haven't seen tags before. Maybe you just didn't realize what they were... Pick more or less any modern blog, look through its posts, and you'll probably see it using tags instead of (or maybe in addition to) categories. -
Develop a CMS with categories and subcategories in the database.
requinix replied to LeonLatex's topic in PHP Coding Help
Suggestion: forget categories and use tags. Same basic concept, but while categories are typically hierarchical in nature, tags are more free-form. Then you can tag each dish with whatever countries, cultures, ingredients, allergens, whatever you want. If you haven't seen them before, there's also the "booru" concept of tag namespaces that you can add on top. For example, "Norway" can be a plain tag, or you can namespace it to "country : Norway". "Scandanavian" could be "region: Scandanavia". Apply namespaces where it makes sense, don't where it doesn't. Namespaces would allow you to do things like require that each page be given a country/region tag more easily, too. -
I figured it was one of The Gospels but was too lazy to go find out which 😅
-
Oh, SOAP is terrible. Hate it. REST is so much easier to work with. And yeah, XHTML... I miss that. When it was still a thing, and for a while after, that was what I was using for all my stuff. Then they took all the weirdness of HTML 4 and doubled-down on it with 5. Sigh.
-
I actually use XSLT for some stuff at home: got a lot of data, I manage most it in XML with some in JSON because a real NoSQL database would be awkward to hand-edit like I need, and want to render it into a viewable form. Add XSLT and throw in PHP's function bindings and you can do just about anything. Downside: super inefficient, so complicated processing takes a while. Early 2000s, give or take, I even experimented with a XML-based website - as in the server responded with XML, not HTML. It worked very well. In fact, after getting back into it for the above project stuff, I'll very likely do it again for a couple smaller projects. Because the simplicity of editing data in XML lets me do whatever I want without having to run a database server or make table schema changes or build CRUD tools.
-
Not that anyone has been using it this decade - or century, even - but there's a technology that exists which is designed for transforming XML into HTML as you just did. It's called XSLT. You can do it fully within PHP, but here's a demo without. kjv.xml <?xml version="1.0"?> <?xml-stylesheet href="kjv.xslt" type="text/xsl"?> <root> <book num="I don't know"> <chapter num="17"> <verse num="1">And after six days Jesus taketh Peter, James, and John his brother, and bringeth them up into an high mountain apart,</verse> <verse num="2">And was transfigured before them: and his face did shine as the sun, and his raiment was white as the light.</verse> <verse num="3">And, behold, there appeared unto them Moses and Elias talking with him.</verse> <verse num="4">Then answered Peter, and said unto Jesus, Lord, it is good for us to be here: if thou wilt, let us make here three tabernacles; one for thee, and one for Moses, and one for Elias.</verse> <verse num="5">While he yet spake, behold, a bright cloud overshadowed them: and behold a voice out of the cloud, which said, This is my beloved Son, in whom I am well pleased; hear ye him.</verse> <verse num="6">And when the disciples heard <i>it,</i> they fell on their face, and were sore afraid.</verse> <verse num="7">And Jesus came and touched them, and said, <span class="j">Arise, and be not afraid. </span></verse> <verse num="8">And when they had lifted up their eyes, they saw no man, save Jesus only.</verse> <verse num="9">And as they came down from the mountain, Jesus charged them, saying, <span class="j">Tell the vision to no man, until the Son of man be risen again from the dead. </span></verse> <verse num="10">And his disciples asked him, saying, Why then say the scribes that Elias must first come?</verse> <verse num="11">And Jesus answered and said unto them, <span class="j">Elias truly shall first come, and restore all things. </span></verse> <verse num="12"><span class="j">But I say unto you, That Elias is come already, and they knew him not, but have done unto him whatsoever they listed. Likewise shall also the Son of man suffer of them. </span></verse> <verse num="13">Then the disciples understood that he spake unto them of John the Baptist.</verse> <verse num="14">And when they were come to the multitude, there came to him a <i>certain</i> man, kneeling down to him, and saying,</verse> <verse num="15">Lord, have mercy on my son: for he is lunatick, and sore vexed: for ofttimes he falleth into the fire, and oft into the water.</verse> <verse num="16">And I brought him to thy disciples, and they could not cure him.</verse> <verse num="17">Then Jesus answered and said, <span class="j">O faithless and perverse generation, how long shall I be with you? how long shall I suffer you? bring him hither to me. </span></verse> </chapter> </book> </root> kjv.xslt <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" /> <xsl:template match="/"> <html> <body> <xsl:apply-templates select="/root/book" /> </body> </html> </xsl:template> <xsl:template match="book"> <h1>Book <xsl:value-of select="@num" /></h1> <xsl:apply-templates select="chapter" /> </xsl:template> <xsl:template match="chapter"> <h2>Chapter <xsl:value-of select="@num" /></h2> <ol start="{verse[1]/@num}"> <xsl:apply-templates select="verse" /> </ol> </xsl:template> <xsl:template match="verse"> <li><xsl:apply-templates /></li> </xsl:template> <xsl:template match="b | i | span"> <xsl:copy-of select="." /> </xsl:template> </xsl:stylesheet> In a browser, which you might have to run through a webserver depending on your browser security settings, (you can see the italics in verses 6 and 14; the spans are invisible but they are present)
-
Choices.js cannot "re"setValue() via ajax
requinix replied to amirelgohary1990's topic in Javascript Help
Your setChoices creates a new Choices object every time. Evidently the API doesn't like that. You need to create your Choices just once, such as in its own variable (defined outside the function). Feel like you've got some slightly larger issues with design here, though...- 1 reply
-
- javascrip
- choices.js
-
(and 2 more)
Tagged with:
-
Reconcile what? If you output the message before the pause then you see the message before the pause, and if you output the message after the pause then you see the message after the pause...
-
Find the difference between two dates in non-standard format, mysql
requinix replied to oslon's topic in MySQL Help
...What are you using to view the CSV file? edit: Nevermind, looks like it does use a localized format after all. Stupid Jira. For PHP, use date_parse_from_format() or DateTime's createFromFormat, using the "d/M/y h:i a" format. https://3v4l.org/NPZvF