Jump to content

requinix

Administrators
  • Content count

    10,491
  • Joined

  • Last visited

  • Days Won

    180

Everything posted by requinix

  1. No sarcastic comments about reading the documentation yet, so consider me to be saying that.
  2. requinix

    Ajax Live Search

    Well you haven't posted a whole lot to work with... Seems like $excerpt is empty. Where is that coming from?
  3. requinix

    Undefined index repeating error

    Are you sure those four/five error messages are all referring to the same file and line? If that's the case then there's not much of a reason why fixing the code would only remove one message.
  4. requinix

    help with charge formula

    Should be simple enough: $video_cost is the default price, ->video_play_price is the uploader's price, compare them to see which is highest. Or cheat.
  5. Yes, you do have $charid and $submit coming from $_POST, but what about the other two?
  6. Those $event_id and $charid and $userid and $submit variables... Where do you think they're coming from? Where should they be coming from?
  7. requinix

    Why Sha1 Needs To Be TypeCasted To String ?

    The correct way to avoid collisions is to not use hashes or randomness. Encryption and/or clever application of math can get you something unique that looks random, if you know how. Anything else you come up with will be bad. And use regular IDs internally. If you want to present something different to the user then you present something different. Real example: my job uses a scheme that derives a unique alphanumeric identifier from our IDs, and those can be presented to the user and even reversed.
  8. requinix

    Grabbing User's Geo Ip

    GeoIP is the best you can get in general. For mobile users you can ask them to allow your site to read their GPS location. With Javascript.
  9. requinix

    Grabbing User's Geo Ip

    You can't. Don't ask questions you already know the answers to.
  10. 1. You would be the proxy's visitor. google.com would see the proxy claiming to act as the user. 2. No comment.
  11. requinix

    ^= means what in PHP language?

    Basically every "$x symbol= $y" means "$x = $x symbol $y". So the question is really more about what ^ means. Convenient list of operators
  12. requinix

    Undefined index repeating error

    When you added the ?? in, what did you end up with? If the error went away at all then you probably did the correct thing $productpage = mysqli_real_escape_string($con, $_REQUEST['productpage'] ?? 'some reasonable default'); which means the return of the error message means either (a) the change got somehow reverted, or more likely (b) the server is running old code because of a cache. Assuming you're running php-fpm, try restarting it.
  13. requinix

    help with charge formula

    Have you tried any other changes, more than what you had initially attempted?
  14. requinix

    help with charge formula

    Earlier there is code that looks up each video to play and adds the amounts (or defaults) to get the total cost to the user to play the videos. You see it and how it works? It grabs each video according to the ID. Then you have code that credits the uploaders of the videos. It also grabs each video according to the ID. And just like how the earlier code was getting the value from it, you can get the value. And you can use that value (or the default) to calculate how much the uploader should get. Very much like how the earlier code did it. Give it a shot and post what you came up with if you have problems.
  15. requinix

    help with charge formula

    That's the thing. Currently that would not be the case. Because the amount they are credited is calculated as half of $video_cost which is the default price. If they set a higher amount, they still only get half of the default and the site gets the rest. If they set their video with a custom price of half the default price, they would get 100% of the cost and the site would get nothing. Again, half of the default price. You already have an example: the earlier code that was calculating the total for all the videos to play.
  16. requinix

    help with charge formula

    Yes, if you want to use a $video_play_price variable then it has to be defined somewhere. But don't. Remember how the "video get data" code got the price from $video if set or the default if not? You do the same thing when crediting the uploader. Which means that $uploader_amount variable isn't useful, as it doesn't account for the video price. To be clear, either (a) your existing code has a bug that the uploader only gets half the default video price and your site keeps the rest, or (b) it's not a bug because that's what is supposed to happen... but I doubt this because that would mean the uploader is setting a price for you that doesn't affect what they get. Anyways, if $video->video_play_price is set then it's the price set by the uploader, and if it's not set then the video amount is $video_cost. Do whatever you want with that value, like *0.5 if the uploader gets 50%.
  17. requinix

    help with charge formula

    Maybe it'll help if you can understand what the variables all represent. * $video_cost is the default price for videos, because some videos might have a different amount * $amout is the total cost to play the videos requested, and will use the video amount if there is one instead of the default $video_cost * $charge is how much the site makes (?) per video * $uploader_amount is supposed to be how much the uploader of each video to view gets for the view, and originally is the default video amount minus $charge Like Barand said, the next question is what you want the site to do, and that's a business question not a coding question.
  18. requinix

    Update MySQL table from 2 or 3 other tables

    Your description would probably make a lot more sense if we could see the table structures and some sample data.
  19. requinix

    fatal error: call to a member function

    It's the title: call to a member function on a non-object. The sad thing is that it should even point out the exact line where the problem is, which is just about as far as anyone can go to saying what the problem is without actually stating it.
  20. requinix

    fatal error: call to a member function

    I don't suppose you mis-copied the bit of code about where the error message comes from?
  21. requinix

    Setting deep object properties

    Oh, so the problem is that you don't know if ->a, ->b, or ->c are defined. I would deal with the data as an array and not an object, and array_replace_recursive.
  22. requinix

    Setting deep object properties

    Something cleaner? isset($config->a->b->c->x) || $config->a->b->c->x = 321; isset($config->a->b->c->y) || $config->a->b->c->y = 321; Remember that isset() also covers the case where the value exists but is null. It's cool to have something that can arbitrarily set properties, but make sure what you have to give up in return is worth it. Here, I don't think you're gaining nearly enough for the sacrifice in readability.
  23. requinix

    JS for radio button TEXT content

    Start by understanding what the code I posted is supposed to do. Then you need to change one place in it so that it works for you. Then you need to use it correctly.
  24. requinix

    JS for radio button TEXT content

    You can search the document for the corresponding label using document.querySelector("label[for='" + this.id + "']")
×

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.