-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Community Answers
-
requinix's post in issue with a update query not updating was marked as the answer
I'm not talking about a column in a table. I'm talking about the PHP variable you have there called $voucher_code_in_transaction. Where is the line of PHP code that declares that variable?
-
requinix's post in Difference between an instance variable inside the class and one outside the class..? was marked as the answer
Forums are way better than StackOverflow for anything but the most trivial and straight-forward of questions. Forget trying to discuss anything on SO...
Yes: the first one allows one and only one instance of the class, while the second allows anyone to create as many as they want.
Which also means the first one's constructor should be private. Public could be okay but that means two paradigms for the class and that's one too many.
-
requinix's post in best forum site out there so far, i would like to see a tutorials section appear was marked as the answer
But what's to prevent us from having the same "deprecated stuff" problem in a couple years? What could we do to make the tutorial concept actually successful?
I'm not just making these questions up: I worked on a site that had the exact same idea, and we even got some people to write a few, but writing them is hard so nobody wanted to keep making more and soon the ones that had been made previously fell out of date.
It's a great idea on paper. It's a difficult idea in practice.
-
requinix's post in Reading binary (data structures) files help was marked as the answer
The one helpful part missing from your post is stating what the correct values are supposed to be. Because e484d857-00b7-4107-a58a-36ff29f6a3a5 looks like a correct GUID to me.
Typically, though, one deals with binary file data by reading an entire "block" of stuff at once and then unpacking it.
$data = fread($handle, 52); print_r(unpack("C4header/vversion/vlicense/v2flags/Vnames/Vnameoffset/Vfiles/Vfileoffset/Vtypes/Vtypeoffset/C16guid", $data)); Array ( [header1] => 193 [header2] => 131 [header3] => 42 [header4] => 158 [version] => 127 [license] => 29 [flags1] => 33 [flags2] => 0 [names] => 31 [nameoffset] => 72 [files] => 7 [fileoffset] => 753 [types] => 6 [typeoffset] => 711 [guid1] => 228 [guid2] => 132 [guid3] => 216 [guid4] => 87 [guid5] => 0 [guid6] => 183 [guid7] => 65 [guid8] => 7 [guid9] => 165 [guid10] => 138 [guid11] => 54 [guid12] => 255 [guid13] => 41 [guid14] => 246 [guid15] => 163 [guid16] => 165 )
-
requinix's post in How can you generate a sysid with PHP? was marked as the answer
I know an application with lots of database tables. Each record has a blargh identifier that is unique across all blarghs in the world. Do you think they're the same as sysids?
I can't tell you how to create a "sysid". I can tell you about things like UUIDs.
-
requinix's post in php install question was marked as the answer
Does Flywheel also have its own web server? Probably does.
"Correct" is highly subjective. If you want to run both at once then all you actually need to do is make them run on different ports, say 8000 for one of them and 8001 for the other.
-
requinix's post in Call function/PHP reload every 5 seconds was marked as the answer
Any errors in the browser console? Can you see in the developer console the browser making a network request to shipline.php?
-
requinix's post in SAML SSO php7 app vs Microsoft app eg Teams was marked as the answer
Single sign-on means one place that you use to log in. It does not necessarily mean that you use it to sign in once and then nothing has to ask for your account again. In fact it shouldn't: the place with your account should be asking you each time whether you want to allow $app access to your account.
If you coded the account stuff yourself and you're being asked multiple times then it means your app is not remembering you. If you wanted, you could have it remember you (like with a cookie) so that next time all you'd need to do is click a button to allow access.
One way or another, you really should make sure that you have to click a button or do something - don't make the authentication completely automatic when a different app wants you to sign in. For example, in addition to remembering you, your site can also remember which apps you've allowed access to: if the same app wants access then that could be automatic, but if a different app wants access then your site should tell you first.
-
requinix's post in Manage behaviour when comparing values. was marked as the answer
The general term is "CAPTCHA". Google's reCAPTCHA and whatever the non-Google alternative is, are the de-facto standards. It takes a little more work to implement but they're effective and reliable.
-
requinix's post in Implications of final classes and final constants was marked as the answer
private + final doesn't make sense: if it's private then nothing can override it anyway. Just make it private.
-
requinix's post in SQL syntax error (using SELECT FROM INNER JOIN ON WHERE) was marked as the answer
No it is not.
Look at the query in your code:
$query = "SELECT krs.id_thn_ak ,krs.kode_matakuliah ,matakuliah.nama_matakuliah ,matakuliah.sks ,krs.nilai FROM krs INNER JOIN matakuliah ON (krs.kode_matakuliah = matakuliah.kode_matakuliah) WHERE krs.nim = $nim AND krs.id_thn_ak = $thn_ak"; Look at the query in the error message:
SELECT krs.id_thn_ak ,krs.kode_matakuliah ,matakuliah.nama_matakuliah ,matakuliah.sks ,krs.nilai FROM krs WHERE krs.nim = 18024114 AND krs.id_thn_ak = INNER JOIN matakuliah ON (krs.kode_matakuliah = matakuliah.kode_matakuliah) They are not the same query.
Now look at this part of the query that was shown in the error message:
...FROM krs WHERE krs.nim = 18024114 AND krs.id_thn_ak = INNER JOIN matakuliah... See why the query does not work?
Now look at this part of your code:
$this->input->post('$id_thn_ak', TRUE); Look carefully. Are you sure that is correct?
-
requinix's post in creating an array list to become $variables was marked as the answer
PSA: I will remove any further posts which tell OP how to do the task as-asked. As well-intentioned as the question and its direct answer is, using variable variables is not a good thing.
-
requinix's post in How can I anchor to a <h1 id="title1"> tag of external url? was marked as the answer
I don't see any H2s with ids on the page. You can't link to one of them until they are given ids.
Why do you not have a page dedicated to showing a single article? You should be linking to that, not to some anchor buried deep on a paginated page.
-
requinix's post in PDO not working in my function (error: "Undefined variable '$pdo'.intelephense(1008)") was marked as the answer
Variables defined outside of functions are not available inside of functions.
If you need $pdo then pass it as an argument like you're already doing for $id.
-
requinix's post in Why drawing on canvas resizing/scaling with canvas size? was marked as the answer
The width and height of the canvas are different from the width and height of the canvas element. What you've done is resize the element, however it will remain at its default drawable dimensions of 300x150.
If you want to resize the canvas itself then you need to update its .width and .height.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
-
requinix's post in Null Safe Operator was marked as the answer
Fix what? A null will be coerced to false.
-
requinix's post in storing in SESSION vs dbTable was marked as the answer
No. The session is stored on the server so as long as the server isn't compromised then the session data won't be compromised.
It's like my refrigerator. There's no lock on it so anyone could take and leave what they wanted at any time, so in that sense it's insecure, however the doors to my home are locked so people can't get inside.
-
requinix's post in How to use namespace in PHP was marked as the answer
You'd use namespaces with your classes for the same reason that you'd use directories with your files: because giving each thing some long and complicated name just so that they all stay unique is a pain.
Practically speaking, if you use underscores in your class names then you're already using namespaces.
-
requinix's post in Profile status was marked as the answer
I've tweaked some permissions. Do you see editing options in your list of status updates now?
-
requinix's post in RecursiveIteratorIterator: exclude file was marked as the answer
...and?
Take a look at your output: the MD5 hash on the left and the value of $element on the right. If you want to skip the md5-container then that would be when $element is...?
For a more useful solution, if what you care about is when the filename is "md5-container" and not what directory it's in then use a function like basename to get just the filename portion of $element.
But perhaps a smarter solution would be to not put your md5-container inside the directory you're trying to inspect. Don't have to skip over something if it's not there in the first place.
-
requinix's post in Warning: hex2bin(): Input string must be hexadecimal string in was marked as the answer
You should find another tutorial: the code they've convinced you to use is... well, it's silly. It pointlessly uses encryption for something that doesn't need to use encryption.
If you want a remember me cookie then all you need is to store a long random token in your database and associate it with the user - preferably in one-to-many form so the user can have multiple tokens for multiple devices. Store it in the browser with the Secure and HttpOnly flags. Then, every time the token is used to log someone in, you generate a new token and replace the old one.
-
requinix's post in Differences between "#.exa" and only ".exa" was marked as the answer
* means any element.
div.font only applies to DIVs with a "font" class while .font applies to any type of element with a "font" class.
# is for IDs.
These are fairly basic CSS questions...