Jump to content

requinix

Administrators
  • Posts

    15,290
  • Joined

  • Last visited

  • Days Won

    436

Everything posted by requinix

  1. https://www.google.com/search?q=site%3Aforums.phpfreaks.com+css+wrapper+container+width+height ?
  2. is_subclass_of, which continues the tradition of some things using the word "class" to represent interfaces too.
  3. I'm not really sure what the complexity is here, but I'm also not sure quite what it is you're trying to get. So you have an image with pixel dimensions WxH. You want to place circles on there, but I guess you don't want to place them on individual pixels but rather on grid "cells" to reduce the number of locations. So like a 100x100 image could be split into 10x5 cells (each is 10x20 pixels), reducing the number of locations from 100*100=10000 center points to 10*5=50 center points. Easy answer? Generate the set of cells you want to choose from, shuffle the set, then go through the first <?> of them and draw the circle appropriately. $cells = []; for ($x = 1; $x <= CELL_COUNT_X; $x++) { for ($y = 1; $y <= CELL_COUNT_Y; $y++) { $cells[] = [$x, $y]; } } shuffle($cells); for ($i = 0; $i < NUMBER_OF_CIRCLES; $i++) { list($x, $y) = $cells[$i]; // draw circle on the cell at ($x,$y) }
  4. The output is technically correct. It isn't actually empty - it just isn't outputting all of what is in there. And I think you were making progress. Did you fix your code according to my previous reply? What is your code after you did that (the full thing, please, not just the piece you showed earlier) and what is it doing now?
  5. Then don't create an ORM. You don't need that for an ecommerce thing. It's too complex and you're going to get it wrong - which I don't say because "lol you're an intern" or "I don't think you're smart enough" but because ORMs can get very, very complicated. If they want you to use MVC then that's fine. You should ask if you can use libraries like Doctrine or Symfony or something to speed up the work, and if they say no then that's troubling. Honestly, I'm rather concerned that they're giving an intern (no offense) the project of "make an ecommerce website". It's a big can of worms they're asking you to open.
  6. If their system (1) logs the user into their site during the OAuth process, assuming the user is not already logged in, and (2) do not provide a way for you to end that session, then that's a security risk and it has to be mitigated by the other site. They could do so by not logging the user in during the process (only validating the credentials) and/or by giving the user the standard "Remember me; not recommended for shared computers" checkbox (which creates a short-lived session that expires when the browser is closed). Providing a method to sign someone out given credentials is actually rather uncommon. It's giving a remote site control over something that they don't need control, considering that there are alternatives.
  7. It's possible you're running into some sort of browser bug. Maybe that some positioning is reliant on such tiny fractional numbers that a tiny difference after the recalculation caused by resizing matters. My solution would be the same as most other CSS solutions: find a way to do what you want with fewer attributes. Such as by not having both boxes fixed.
  8. Couple typos in what I wrote: $ip = ->children("http://schemas.xmlsoap.org/soap/envelope/") // <env:*> There's a variable missing before the ->. What do you think it might be? Also ->body // <env:body> the element is actually "Body", not "body".
  9. If you pull all the content out of the normal flow then there won't be any normal flow anymore. You don't have to make the content_box fixed. All you have to do is constrain the height so it never goes beyond the bottom of the viewport. Then there won't be anything to scroll.
  10. What code have you tried so far and what happened when you used it?
  11. Use ->xpath to go directly to the right <text>. /kendisplay/data/SText[@id="ken1"]/text Keep in mind that XPath queries are like SQL and HTML: if you put user-provided data into them (like if "ken1" came from the form instead of your own fingers) then it needs to be escaped first, such as with sprintf('/kendisplay/data/SText[@id="%s"]/text', htmlspecialchars($id))
  12. Soon you're going to discover that making an ORM is not a simple or quick process. People use things that already exist for a reason. You do know that you don't need an entire "framework" just for database stuff, right? Libraries like Doctrine can be used just for their own features without you having to adopt all of Symfony too. There's... honestly, there's so much that needs to be said about what little you've posted that I don't even know where to start. Why can't you use an existing system for this?
  13. If $response is that XML then $xml = simplexml_load_string($response); $ip = ->children("http://schemas.xmlsoap.org/soap/envelope/") // <env:*> ->body // <env:body> ->children("http://webServices.server.ifce.fr/") // <ns2:*> ->getInformationPreleveurResponse // <ns2:getInformationPreleveurResponse> ->children("") // <*> ->informationPreleveur; // <informationPreleveur> echo (string)$ip->adresse1; // 4 PLACE DE L'EGLISE
  14. And what I'm saying is, since your website cannot control the user's phone or the information the Vipps site stored in their browser, you can't log the user out. You being able to log out of Vipps does not mean that your site can make it happen for you.
  15. Unless they provide a way to revoke an access token, the only thing you can do is make sure the user is logged out of your system - you simply can't log someone out of some other website (not unless you can find an security weakness in their site to do so). But a secure OAuth login prompt should not have the side effect of signing the user into that site in the first place... This isn't just an issue for your two sites: anyone on a shared computer needs to know that if they log into anything, be that Google or Facebook or Amazon, then they have to log out again before they leave. I don't know all the details of what's going on but it doesn't sound like there's anything you can do.
  16. This would be easier to explain if I could see what $response contains. Because it is XML, if you "echo $response" then all the <tags> in it will be invisible, but any <tag>123</tag> will show up as "123". To see the XML and the <tags>, either "htmlspecialchars($response)" like I showed before, or View Source in your browser. Here is an example of how you can read a SOAP response using SimpleXML. If you want to see the "u:month" value inside the <dimension>, 1. The first element is the Envelope. You need to be in the "soapenv" namespace to access it, so call children() with the URI noted in the xmlns attribute. You do not need ->Envelope because $xml is already the root node. 2. The second element is the Body. You need to be in the "soapenv" namespace, but you are already so you do not need to call children() again. Then ->Body. 3. The third element is the getDataResponse. That is the "tns" namespace so call children() again, then ->getDataResponse. 4. Next is the record. It is not in any namespace, which means it is in in the default namespace, but there is no default "xmlns" attribute anywhere to tell you a special URI so use just "". Then ->record. There are multiple "record"s so add [0] for the first item. 5. Next is dimensions, which is also in the default namespace, so ->dimensions. 6. Next is dimension, so ->dimension. Finally you can use ["name"] to get the attribute, but only because it is also in the default namespace. If you can show the XML response you are receiving, with the XML <tags>, then I can show you the exact PHP code to get the information you need.
  17. $response will be XML. What is the output of // var_dump($response);// affiche string (676) + la chaine de caractère // echo $response; // affiche la chaine de caractère echo "<pre>", htmlspecialchars($response), "</pre>"; // <soapenv:Envelope ...???... </soapenv:Envelope>
  18. The nature of OAuth is that you do not control the user's session with the remote site. You can't log the user out like you want to do, and arguably you should not either: it's not your concern. Why do you think you need to be able to log the user out of that other site?
  19. https://www.google.com/search?q=mysql+sum+returning+null
  20. I'd just not bother and do the same thing I do when NPM and Cargo (Rust) have problems: delete the lock file and reinstall. That should fix any "partial" thing that put you into a weird state.
  21. Sounds like you've decided on a solution. What was the problem?
  22. Don't worry about whether you have the "right" code. Everyone can arrive at the right code eventually. What's more important is the process you use to arrive at that code. There's a lot to PHP, and all programming languages, but ultimately they all act like a recipe: you use particular ingredients in a particular sequence to achieve a particular result. Sometimes you can substitute one ingredient for another, and sometimes you can adjust the sequence to work better, but most of the time you can't throw things into a pot and expect something edible. Being a good cook is about understanding each part and combining them successfully. Here we have a few ingredients to work with, such as databases, math, arrays, for loops, and foreach loops. Each of those is made up even more ingredients, such as the mysqli library, SQL queries, integer division, array brackets, and ternary expressions. It's a lot of moving parts but understanding what each does and means is crucial to being able to use them correctly. And when you understand them, it's easier to arrange them in an order to achieve the result you want. The best piece of advice is something I said earlier: don't always copy and paste code but spend some time to learn what it represents so that you can extract the relevant parts and apply them to your own code. On the more factual side of things, I'll pick the one that stands out: $items = $codes; $count = $codeCount; You start with the $codes and $codeCount variables and then copy them into the $items and $count variables. So you now have two pairs of variables that mean the same things. There's no need to have duplicates like that, so you could keep the two you started with and forget the two new ones - all you have to do then is adjust the later code to use the correct variables.
  23. Looks like you're kinda throwing syntax at the problem and hoping it goes away. That very, very rarely ever works. I will say that I wrote the wrong variable name a couple times in my previous post. $chunks is the one that has the chunks of the array, not $chunk. If you fix that with columns 2-4 then they should work equally correctly, but the only reason they work at all now is because you stumbled into some code that is wrong but accidentally makes the other parts do what you want. With the three columns working, compare your code for those with the code for the first one.
  24. My reply was a bit late so I did assume you were still working on it. Not everyone does, when they're waiting for replies, but you seemed more responsible than that. You're much closer. $chunks will be an array with a chunk for each column: $chunk[0] for the first, $chunk[1] for the second, and so on. That means each column doesn't need an additional foreach on $chunks itself. You only need the one foreach, and you run it on the appropriate $chunk[X] directly. No worries. I've been doing this long enough that I'm pretty good at spotting which people want help to work through the problem and which people want help so they don't have to do the work at all.
  25. The code I posted was a sample of how the process can work. You should spend some time to read through it, maybe look up what unfamiliar parts are doing (or ask), then adapt it to suit your own specific needs. The end result should be something that is part what I wrote and part what you had before.
×
×
  • 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.