Jump to content

JasonLewis

Members
  • Posts

    3,347
  • Joined

  • Last visited

Everything posted by JasonLewis

  1. This isn't PHP related my friend. And you haven't added the class to the second piece of code there. You need class="email" so that the jQuery will work.
  2. I wouldn't say it's wrong, because it's not really. It's just not the preferred way of doing things.
  3. I created a quick test and it's not doing that for me. What should it be outputting?
  4. You're using 'userfile' in one and 'uploadedfile' in the other. Apart from that it should work okay, have you tested it to see what the results are?
  5. When people point me to the manual my general reaction is.. "Do'h!" Sure you're young, but don't get used to being spoon fed answers. Seek them out, read the manual. That is what helps you learn a lot more.
  6. I don't believe in random. But... a suggestion is to create a session that stores selected videos. You could then come up with some kind of formula to determine when a video is chosen based on if it has already been shown or not.
  7. Change it yourself? Go to Settings > Style Configurator and look for Javascript and change the colors there.
  8. Wrong section my friend, I've notified the moderators.
  9. Google should have quite a sufficient amount of information on using flat file. In regards to your last point, obviously these files aren't going to be as secure as a database. Best bet is to place the files outside of the main directory structure of your website (not in public_html or www) to prevent users from accessing them.
  10. The sorting functions return true or false, depending on success or failure. So instead of returning an array you are now either returning true or false, hence why it is throwing the error at you. You simply call asort() then return the variable normally. asort($org); return $org; Always make sure you check the manual my friend.
  11. What is in the PHP file? From that list of extensions, the only one that I recognise as a valid font format is .ttf The other files may be language files or something that imports the font to be allowed use in the application.
  12. Mmm, throwing heaps of code down and stating an error that could be anything is kind of hard. Debug the code, that's the best bet. Also what Pikachu2000 said, see if it is the correct path. That will help with the debugging.
  13. Can't you select all the records from the database? Or you could remove the extension and use just the number, either by using pathinfo (the constant to use requires PHP 5.2) or you could manually remove it. Example: $file = '12.jpg'; $id = array_shift(explode('.', $file)); Then you just need to create the link. foreach($files as $file) { if($colCtr %$cols == 0) $id = array_shift(explode('.', $file)); echo '</tr><tr><td colspan="2"></td></tr><tr>'; echo '<td wdith=50% align="center"><a href="products.php?id=' . $id . '"><img border="0" class="gradualfader" src="' . $images . $file . '" /></a></td>'; $colCtr++; }
  14. You're using it incorrectly, the destination should also include $_FILES['uploadedfile']['name'] after the folder. See the example on the manual. Once the file has been uploaded using file_get_contents() should be fine, just point it to the destination address you specify in move_uploaded_file(). For your 3rd query I'd recommend putting this upload code in a separate file, otherwise yes you could just echo the PHP_SELF server variable.
  15. Except that the config file is set up differently. There are a few ways you could do it TLG, the way your doing it or you could use regular expressions. Which ever works best for you is how you should approach it. Here is an example using regular expressions: <?php // Just an example line taken from your config. $lines = array( '$settings[\'db\'][\'host\'] = \'xxxx\';', '$settings[\'db\'][\'username\'] = \'xxxx\';' ); // Test post data. $post = array( 'host' => 'localhost', 'username' => 'ProjectFear' ); // The new replaced values array. $replaced = array(); // Loop over each post value. foreach($post as $key => $val){ // Use regular expressions. Replacing the correct key with value. $replaced[] = preg_replace("/settings['db']['{$key}'] = '(.*?)';/", array_search('\\0', $lines), '$settings[\'db\'][\'' . $key . '\'] = \'' . $val . '\';'); } print_r($replaced); ?> Of course the only requirement of that solution is that you need to name your form fields the same as what they are in the config. Or have another array which has the names of the fields and names of the config variables as the values, shouldn't be too hard to modify.
  16. Because you declare the variables at the bottom. And you're not including them in your message. As $msg is coming from the form as well. Is this your code or is it someone elses?
  17. The notice's are essentially telling you that you're upload form isn't working as you are expecting it to. The index you are requesting from the array does not exist. So either the file input field in your form isn't called indeximage or you don't have the multipart on the form tag. The warning will be a result from the notices, no doubt. Also ensure you have correct permissions. First step I would take is to print_r($_FILES); to see if anything is being posted correctly. Could be something to do with file size limits as well. Hard to tell. You just need to debug it at the moment.
  18. Show some code. Are you echo'ing the variable, or using die. Because it won't show if you use die, you have to do something like: die("ID: " . $ClientID);
  19. You named your file field 'image', however you're referencing 'file' in the $_FILES array. Change all occurrences of $_FILES["file"] to $_FILES['image'], then see how you go.
  20. You'd probably need to use regular expressions, to make it easier. Try something like this: $string = '<li><a href="../index.php" title="school summary">Summary</a></li>'; preg_match('/title="(.*?)"/', $string, $matches); $title = $matches[1]; echo $title;
  21. Have you tried doing print_r($_GET); to see if there is anything in the array? What's different with this page and other pages?
  22. Just store it in a PHP file, and perhaps at the top make sure that a variable is defined that you can easily define prior to including this file. If the variable isn't defined, alert the user of the direct access. You could even log direct access. But yeah, just use a PHP file to store. Make use of functions like file, read over the lines and change them if applicable.
  23. You'd need to split the string using str_split. Then loop over each letter and add it to another array, then remove it from that array again if there is another of the same letter. If there is anything in the array at the end, then there were odd leters. Like this: $string = 'abcabc'; $odds = array(); foreach(str_split($string) as $letter){ if(($pos = array_search($letter, $odds)) !== false){ array_splice($odds, $pos, 1); }else{ $odds[] = $letter; } } if(empty($odds)){ echo "String is even."; }else{ echo "String is odd."; } Good luck.
  24. That's how I would've suggested to do it. As really, that's what fetch_all() is doing.
×
×
  • 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.