scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
Make sure you have session_start(); at the top of each page. The general idea is to set a session flag when a user logs in. Something like, $_SESSION['logged_in'] = true; Once you do that you can load things based on whether a user is logged in or not like this if ($_SESSION['logged_in'] === true) { // user is logged in } else { // user is not logged in }
-
If the API class inherits the MySQL wrapper, that is to say the API class is a subclass of the MySQL wrapper. I don't think that's what you want.
-
I don't see anything standing out in your last snippet. Test it out and see if it works as expected. There isn't much in the way of security that you can mess up with database queries. Sure, there is SQL injection - but prepared statements eliminates that all together. So really, you have nothing to worry about.
-
You seem to always prefer to hack your code up in lieu of the proper way to do it. When you don't understand something in programming, it's better to stop what you're doing and learn about it instead of saying "nah that sounds too hard, I'll just do it this way for now and learn that later". That builds up a very bad habit and you will always look for the easy way out. So here's your options: - Use DATE_SUB() to only select rows that have a temp_reset_on older than 4 hours - Convert the temp_reset_on to a UNIX timestamp and do the math in PHP If you want to do the math in PHP, you can either convert the timestamp to a UNIX timestamp in the MySQL query (like I posted earlier) or you can do it in PHP with strtotime(). You seem to think prepared statements are altogether different from MySQL, but they are not. Any MySQL query will work exactly the same in prepared statements.
-
NOW() is a MySQL command, not a PHP command. NOW() gives the current timestamp in the DATETIME format, which is YYYY-DD-MM HH:MM:SS.
-
Under the query run echo mysql_error();
-
To test that theory, what does this give you? foreach($data as $key => $value) { echo 'Key: ' . htmlspecialchars($key) . ' Value: ' . htmlspecialchars($value) . '<br />'; }
-
If you want to do it in PHP, you'll first want to convert the time to a UNIX timestamp. You can do that like... SELECT UNIX_TIMESTAMP(temp_reset_on) AS temp_reset_on ... Then you'll want to subtract that from the current UNIX timestamp. $diff = time() - $row['temp_reset_on']; Lastly, you'll want to see if the difference is greater than 4 hours in seconds. if ($diff >= 14400) {}
-
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
-
I've installed Win7 on several boxes and have never had to do that. All I have to do is turn off that immensely annoying UAC. Ditto Turning off UAC only has the advantage of removing those highly annoying popup boxes. It does not give you full administrative access to the computer. Programs like Spybot Seach and Destroy, a malware program I use, needs full administrative access to alter the hosts files where it stores a database of malicious websites. I went a month, with UAC turned off, of having to right click and run as administrator to get the program to run properly. Whereas the admin account automatically runs everything as administrator To get that, you need to unlock the admin account. There are other methods to the one I posted, but this one is the most straightforward, just a line of text into the Command Prompt. Joe All I'm saying is with UAC off, I have never run into a situation where I have to explicitly run the program as administrator. Perhaps it was a discrete option during installation, I'm not sure.
-
Yeah, soon the internet will be like cable TV. We can use Facebook, Wikipedia and Youtube for $80/month.
-
I want you to put that code in your script and then post back what it outputs. It should contain all of the data associated with $_FILES.
-
Read my reply above...you need to send the POST data with the AJAX request.
-
Yes, but keep in mind you'll need to pass the form values to PHP with JSON. Refer to this example $.post("test.php", { name: "John", time: "2pm" }, function(data) { alert("Data Loaded: " + data); });
-
Then once again you need to learn the code you are using before you use it, or you won't know what is going on. $.load takes output from an AJAX request and puts it in a container. If you have no output, you can use $.post (or $.ajax) instead.
-
searching a array while selecting from mysql
scootstah replied to Shadowing's topic in PHP Coding Help
Haha, good eye. Yeah, it should be this: defender_planet IN ($implode) -
A couple good answers here for why this occurs.
-
If you don't want to disable UAC then you'll need to explicitly run the program as Administrator. Right click the shortcut, go to properties, go to compatibility, check "run this program as Administrator". Or for temporary, right click the shortcut and hit "run as administrator".
-
searching a array while selecting from mysql
scootstah replied to Shadowing's topic in PHP Coding Help
You forgot brackets. defender_planet = IN ($implode) -
Are you doing that with AJAX? If so it would be easier to get the position of each element and then send it to PHP already formatted.
-
Not really. Why would you want to do that?
-
Just so you know, as I said in your other post, if you stream the files then the users can freely download it in a matter of seconds. On soundowl.com (or any other streaming service) I can download all of the MP3's with no effort at all. That said, you'll first have to decide which platform you want to use (Flash, Silverlight, Java, Javascript+HTML5...). You should be able to find several open source options for each platform.
-
Because UAC is a piece of shit. Go to Control Panel > User Accounts > Change User Account Control Settings > turn the slider all the way down and restart your computer.
-
I've installed Win7 on several boxes and have never had to do that. All I have to do is turn off that immensely annoying UAC.
-
It is the container that will contain the output from the PHP script it is calling.