Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Seeing as AJAX isn't a language, one cannot be(come) better at it. AJAX is just when you use XmlHttpRequest (or some stupid ActiveX object because of Microsoft's "standards"). Learn Javascript and you'll "know" AJAX. Just a fancy acronym, nothing more than that.
  2. You need to enclose the value in single quotes. Otherwise it will be looking for a column name instead of a value. I.e. DELETE FROM gsubcat WHERE cName = '$cat'
  3. That would just give FF an unfair advantage to the other browsers just like IE has an unfair advantage now. The only reason why IE is the most used browser is because it is bundled with the most used OS. The thing is that there has to be some sort of browser pre-installed and therefore it would be most logical that they shipped it with their own instead of a competitors. Anyways, what's a millidollar? You cannot have 0.1ยข.
  4. Of the above languages my favorite is Python. I know a little of Perl, C and C++. Javascript would probably be the language I'm most proficient in on that list, but I still prefer Python to Javascript. Edit: Seeing as the poll has been edited Javascript is no longer the language I'm most proficient in of the listed languages. My proficiency is as following: PHP > Javascript > Python > Java > C = C++ > Perl.
  5. Then it should work with in_array()
  6. It will continue on all non-fatal errors. You cannot catch fatal errors and therefore you cannot continue script execution.
  7. When loading the file like $owners = file('owners.txt'); try to add print_r($owners); below it and post the output here.
  8. What do you mean? The command is whatever you can run from the terminal, so if you want to run /home/username/public_html/crontabs/mytab.php make it php /home/username/public_html/crontabs/mytab.php
  9. You can also get the newline depending on the system (UNIX: \n - Windows: \r\n - Mac: \r) from the constant PHP_EOL. <?php echo 'Something' . PHP_EOL; ?>
  10. Isn't the problem just that you have duplicate entries? Check that the owner is not already in the list before adding him/her and optionally display a message to the user stating that the owner is already in the owner list.
  11. $date = substr($row['Expiredate'], 0, 10); Will get the date part of string. You could also use strtotime() to convert it to a UNIX timestamp.
  12. You could use a switch: <?php switch($_GET['per']) { case 'a': // do something break; case 'b': // do something else break; default: // if nothing else matches break; } ?> Or you could define an array of pages: <?php $pages = array('a', 'b', 'home', 'something', 'test'); if(isset($_GET['per']) && !in_array($_GET['per'], $pages)) { echo 'invalid page'; } else { echo 'valid page'; } ?>
  13. Assign an id to an entry in a table. That would be the best option. You still need to store the file so have a column called filename or something like that. mkdir()
  14. Try to use trim() when adding the user to the file.
  15. To elaborate on what wildteen said, using the curly braces is also known as complex syntax, not complex because of the syntax itself but because you can make complex expressions. Here is another instance where you'd want to use curly braces around the variable name: <?php $fruit = 'banana'; echo "John has two $fruits"; // won't work, PHP will look for a variable called $fruits echo "John has two {$fruit}s"; // works, PHP will look for a variable called $fruit ?> Like roopurt I generally use curly braces around ALL variables which are inside strings for two reasons: 1) I think it looks nicer. 2) It ensures that it will always work (see wildteen's and my example).
  16. Again, whats the point in storing images if they're not used anywhere. The point im trying to make is that you'll probably show someone the files at some point, who might link to them etc. As roopurt said, if you wish a limited audience, password protect it.
  17. Alexa provides information about web traffic. Here are the stats for PHP Freaks: http://alexa.com/data/details/main/phpfreaks.com PHP Freaks is ranked number 11,680.
  18. Do you load the owners file on each `test command? You'll have to or you'll have to load it at the start and then reload it when if you change it while the script is running.
  19. I do this: <?php // LIB_PATH being defined to hold the path to the library folder function __autoload($class) { $path = LIB_PATH . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; if(file_exists($path)) { require $path; } } ?> In that way I don't have to include any class files. Database would be in /path/to/lib/Database.php, Database_MySQL would be in /path/to/lib/Database/MySQL.php etc.
  20. Well, then don't use the new line. Do you reload the the owners list after running your addowner command?
  21. You might want to add a newline before the name, i.e. "\n$owner". Try to check if it has the correct format after you ran the command.
  22. I didn't take a look at the source of your script, but can have multiple recipients by separating the recipients with a comma. More information is available here: http://php.net/manual/en/function.mail.php
  23. Change if(in_array(Kingy, $owners)) { to if(in_array('Kingy', $owners)) {
  24. <?php $im = imagecreatefrompng('test.png'); $color_red = imagecolorallocate($im, 255, 0 , 0); imagestring($im, 2, 5, 5, 'From: http://localhost/', $color_red); header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> Will write a string to the image and output it. Note: This is only for PNG files, you'll have to adjust it for GIF and JPEG files as well. Oh, and regarding your signature: http://www.google.com/search?q=php+write+string+to+image
  25. Daniel0

    Forums

    I'd probably go with something which is already created, unless you want to program it for the experience though.
×
×
  • Create New...

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.