-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
createimagefromjpeg() takes up too much memory???
requinix replied to bausman480's topic in PHP Coding Help
The GD extension has two notable problems: image quality and memory usage. Switching to something else is probably your best option. -
If it actually doesn't work then there's something else wrong. But I think by "doesn't work" you really mean "it does work but I get a warning message". explode("|", $line, 5) explode("_", $ID, 3) explode("|", $line, 5)
-
Convert the times to seconds, do the math, and convert back. Using addition as a better example, 0 * 3600 + 1 * 60 + 8.035 = 68.035 0 * 3600 + 2 * 60 + 3.054 = 123.054 123.054 + 68.035 = 191.089 191.089 / 3600 = 0 remainder 191.089 191.089 / 60 = 3 remainder 11.089 so 00:01:08,035 + 00:02:03,054 = 00:03:11,089
-
Speaking of, you could put ads in the item description, but odds are that any code you put in there would not be executed. Simple links+images would work. With that in mind, you could generate the ad markup yourself (or via your ad provider) - at worst you could replicate the JavaScript in your PHP (which would be totally possible).
-
Are you trying to order the results in a certain way? What way?
-
It may sound weird, but in the JOIN condition put that the team ID must be that $team_id(). SELECT * FROM users LEFT OUTER JOIN users_teams ON users_teams.user_id = users.id AND users_teams.team_id = $team_id() WHERE users_teams.team_id != $team_id() If that does sound weird then consider changing the WHERE into the functionally equivalent WHERE users_teams.team_id IS NULL Make sense now?
-
Don't put the full content in there - just a snippet. Then people have to go to your website to see everything, and that's where they get the ads. And are you sure it's the most viewed and not the most downloaded? FYI Google Reader's bot includes the number of subscribers in its user agent string.
-
You are: a slash.
-
Eh... Use something like DOMDocument to navigate through the HTML, pulling out the bits you want from it. If you've done DOM stuff with JavaScript before then you'll be right at home doing it with PHP.
-
The manual page I linked you to has a very simple example of how.
-
Execute Function but not make the browser wait for a return
requinix replied to sanchez77's topic in PHP Coding Help
Oh, so the code you posted is bkupdate.php. What's the current version of test.php? -
Execute Function but not make the browser wait for a return
requinix replied to sanchez77's topic in PHP Coding Help
It probably depends on what "the rest of the script" is. -
Are there any errors? Make sure your php.ini has display_errors = on error_reporting = -1
-
Wouldn't it be easier to just use the form as a form? Submit it normally? Otherwise you can go through the document.forms collection to find the value: document.forms[id or name or index].EndReasonCodeType.value
-
Since you're just starting out, this is an excellent chance for someone like me to point out all the things you should be doing right. That way you don't have to relearn (and rewrite) things later when you discover you've been doing something wrong. // root is the admin user for mysql. do not use it to connect to your database in your scripts // create a restrictive user just for the things you need it to do. for example, "simpleuser" $con = mysql_connect("localhost", "simpleuser", "simplepassword"); // to create this user, use whatever tool you have available (like phpMyAdmin or CPanel) // you can create one using a query too. temporarily connect as root and run // GRANT SELECT,INSERT,UPDATE,DELETE ON users.* TO simpleuser@localhost IDENTIFIED BY 'simplepassword' // - SELECT, INSERT, UPDATE, and DELETE are the operations you want to allow simpleuser to do // (as a simple user it shouldn't be able to alter tables or delete databases) // - "users.*" means all the tables in the `users` database // and be sure to change the username and password to something relevant if (!$con) { // do not reveal mysql errors. for now, just show a simple message die("Could not connect to the database"); // later you can learn to log these errors someplace and show a better message // (without having to kill the script to do so) } mysql_select_db("users", $con); // if you ever use anything from $_GET or $_POST in a query, you need to make sure it's safe to use first // for string values use mysql_real_escape_string() right when you put the string into the query $query = "SELECT * FROM user WHERE username = '" . mysql_real_escape_string($_POST["username"]) . "'"; // there are other tools like PDO and mysqli which are "better" to use. when you understand how SQL works // then you should use those, but I do recommend starting off with just the mysql_* functions so you // learn about concepts like SQL injection // now execute the query $resultset = mysql_query($query, $con); // and try to get a row $user = mysql_fetch_array($resultset); // if you were able to get a row then that must mean there's some user with username=$_POST[username] if ($user) { ?> Site Content Back To Login. } else { ?> Wrong Username Back To Login. }
-
And you're absolutely sure that you're going to http://www.example.com/example-1.html? Because I don't see anything else that could be the problem. How about using a RedirectMatch then?
-
Register(); reserved word? Very strange behavoir please help!
requinix replied to Chud37's topic in Javascript Help
You didn't happen to look at Chrome's error console, did you? -
Can I assume the .htaccess is being interpreted? In what folder is the file and what URL are you trying?
-
Try RewriteRule ^/?example-(\d+)\.html$ /$1.html [L,R] And remove the second RewriteEngine directive - one is enough.
-
Execute Function but not make the browser wait for a return
requinix replied to sanchez77's topic in PHP Coding Help
1. Windows's CLI doesn't support & for running in the background. That's a Linux thing. Use `start` like in the example I posted. 2. The -- is for php.exe so it doesn't think that whatever comes after is an argument for itself. 3. Your batch file has to pass its arguments to the script. 4. Variables don't work inside singly-quoted strings. 5. bkupdate.php will not get the $argv1 variable. You can only use the $argv array. Like in the example I posted. shell_exec('start test.bat ' . escapeshellarg($argv1)); @echo off "C:\Program Files (x86)\PHP\php.exe" -f C:\inetpub\test\bkupdate.php -- %1 -
Execute Function but not make the browser wait for a return
requinix replied to sanchez77's topic in PHP Coding Help
On Windows you'd use start, like shell_exec('start test.bat'); But are you using batch files? Not PHP? In PHP you'd look at $argv as in if ($argc >= 2) { // script name always comes first, so $argc=2 means 1 argument echo "argv[1] = {$argv[1]}\n"; } -
Ads in your RSS? Please no.
-
Percentages only work in CSS rules. document.getElementById(id).style.width = va;
-
is_numeric() will accept real and negative numbers. Try ctype_digit instead. Your regex needed start-of-string and end-of-string anchors, otherwise it only checked if the input contained a 10-digit number. /^[0-9]{10}$/