-
Content Count
24 -
Joined
-
Last visited
Community Reputation
3 NeutralAbout dkub
-
Rank
Member
Profile Information
-
Gender
Not Telling
-
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.
-
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
-
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.
-
Search a database for user input and updating the row
dkub replied to Nasher99's topic in PHP Coding Help
This is a much better solution. -
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.
-
Capture string after period and before whitespace using regex
dkub replied to NotionCommotion's topic in Regex Help
Looks about as succinct as you're going to get. -
Search a database for user input and updating the row
dkub replied to Nasher99's topic in PHP Coding Help
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. -
Search a database for user input and updating the row
dkub replied to Nasher99's topic in PHP Coding Help
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. -
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.
-
Laravel 5.4 rest controller with composite key table
dkub replied to NigelRel3's topic in Frameworks
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. -
You have two fields called fileWrite...
-
Laravel 5.4 rest controller with composite key table
dkub replied to NigelRel3's topic in Frameworks
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 | / -
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.
-
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.
-
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...