Jump to content

dkub

Members
  • Content count

    24
  • Joined

  • Last visited

Community Reputation

3 Neutral

About dkub

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  1. dkub

    Parse opengraph image tag problem

    Why do you have quotes around $url in your file_get_contents call? Any quotes are unnecessary here, and single quotes prevent string interpolation, meaning you're passing the literal string "$url" as your parameter.
  2. Use the i (case insensitive) modifier. http://php.net/manual/en/function.preg-replace.php http://php.net/manual/en/reference.pcre.pattern.modifiers.php http://www.phpliveregex.com/p/k1P
  3. dkub

    PDO ERROR

    What's the purpose of your dbConnection class? It simply wraps PDO, offering no new functionality, but having the disadvantage of hard-coded connection parameters with public visibility. You're likely better off simply using PDO directly. You're also better off inserting the dependency into ManageUsers rather than leaving it as a hidden dependency inside the constructor. $query = $this->link->prepare("INSERT INTO `users` (`username`,`password`,`ip_address`,`reg_time`,`reg_date`) VALUES('$username','$password','$ip_address','$time','$date')"); That's not how prepared statements work. http://php.net/manual/en/pdo.prepare.php A few additional things: function registerUsers($username,$password,$ip_address, $time, $date){ echo $users->registerusers('bob','bob','127.494.439.39.340','12:00','29:02:2017'); registerUsers !== registerusers Don't store passwords as plain text. Use password_hash. That's not how IP addresses are formatted. Why are you storing date and time separately? Why are you storing dates in a weird format?
  4. This is a much better solution.
  5. dkub

    Use last login as a condition - how?

    Sounds like your cron job is just executing some SQL query based on what little information you provided in your original post. If that's an incorrect assumption, can you flesh out what it is you're actually doing? If I'm right, then you could either use last login date/time as a constraint in your update, or use it to select the correct set of users and then perform whatever actions you need to individually.
  6. Looks about as succinct as you're going to get.
  7. Don't do this. Don't display connection errors to the user; they shouldn't need to care and you don't want to be exposing internal errors to the outside world. Log errors, throw exceptions, handle them gracefully. Don't ever trust user input. You're leaving yourself wide open to SQL injection here. Use prepared statements. While you're at it, look at PDO instead of mysqli. It's far more pleasant to use. More SQL injection and you're using GET requests for what should be a POST. Aside from the $row["Num_of_downtime"] not existing, you don't need PHP to increment this. SQL can do it just fine. $sqlupdate = "UPDATE `Test_downtime`.`Downtime` SET `Num_of_downtime` = `Num_of_downtime` + 1, `Last_downtime` = NOW() WHERE `Server_Name` = ?";
  8. Where are these values coming from? You're not selecting them. Honestly, though, there's so much wrong with that code I don't even know where to start.
  9. dkub

    Use last login as a condition - how?

    I assume you're storing logins somewhere. You could use that information to retrieve a list of "eligible" users on whom to perform whatever action your cron job is meant to perform.
  10. Oh wait. Composite keys. /api/bin/1/2 points to a single object. Disregard my earlier suggestion, then. I suspect resourceful controllers will fall short and you will need to be more declarative in your routing.
  11. dkub

    This script into table

    You have two fields called fileWrite...
  12. Looks like using dot notation will get you part of the way there. Route::resource('bin/foo.bar', 'RestBinController'); ❯ ./artisan route:list +--------+-----------+------------------------------+-----------------+------------------------------------------------+--------------+ | Domain | Method | URI | Name | Action | Middleware | +--------+-----------+------------------------------+-----------------+------------------------------------------------+--------------+ | | GET|HEAD | / | | Closure | web | | | GET|HEAD | api/user | | Closure | api,auth:api | | | GET|HEAD | bin/foo/{foo}/bar | foo.bar.index | App\Http\Controllers\RestBinController@index | web | | | POST | bin/foo/{foo}/bar | foo.bar.store | App\Http\Controllers\RestBinController@store | web | | | GET|HEAD | bin/foo/{foo}/bar/create | foo.bar.create | App\Http\Controllers\RestBinController@create | web | | | GET|HEAD | bin/foo/{foo}/bar/{bar} | foo.bar.show | App\Http\Controllers\RestBinController@show | web | | | PUT|PATCH | bin/foo/{foo}/bar/{bar} | foo.bar.update | App\Http\Controllers\RestBinController@update | web | | | DELETE | bin/foo/{foo}/bar/{bar} | foo.bar.destroy | App\Http\Controllers\RestBinController@destroy | web | | | GET|HEAD | bin/foo/{foo}/bar/{bar}/edit | foo.bar.edit | App\Http\Controllers\RestBinController@edit | web | +--------+-----------+------------------------------+-----------------+------------------------------------------------+--------------+ Not exactly the /api/bin/1/2 you were describing but close, and perhaps a little more descriptive.
  13. dkub

    WordPress plugin

    An image of some random JavaScript error in some random WordPress plugin and absolutely no description of what's going on. What exactly would you like us to do? Have you considered asking the creator of this plugin? If you want anyone here to help, you will certainly need to provide more details. Bumping a thread without offering any additional details seems unlikely to get you anywhere.
  14. dkub

    Half of my code doesn't work

    Should you leave what blank? It's not clear what you're even trying to accomplish here. You create a file resource but don't use it, you delete files and then do nothing. And, of course, you leave yourself open to directory traversal attacks.
  15. dkub

    Half of my code doesn't work

    Are $_GET['new'] and $_GET['del'] both going to be set at the same time? If $_GET['new'] is null, you exit, never getting to evaluate other conditions...
×

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.