Jump to content

AncientSage

Members
  • Posts

    56
  • Joined

  • Last visited

    Never

Everything posted by AncientSage

  1. Possible, yes. ftp_connect(); http://us3.php.net/ftp_connect ftp_get(); http://us3.php.net/manual/en/function.ftp-get.php ftp_close(); http://us3.php.net/manual/en/function.ftp-close.php file_get_contents(); http://us2.php.net/function.file_get_contents Of course, you'll need to write it to a file, but you can unlink the file after you're done. Or just let it be overwritten each time. You can also create a file, connect to ftp, download file, write to that file, close ftp, then unlink the file after writting to a db. There are a few other functions needed, but those are a good portion of the ones that you can use. You can also read a file into an array using file();
  2. [code]Warning: implode() [function.implode]: Bad arguments. in /admincp/index.php on line 128[/code] There is my error. The line is as follows: [code]$vbulletin->GPC['navprefs'] = implode(',', $vbulletin->GPC['navprefs']);[/code] The implode function should be working, given that it is an official vBulletin release. However, there seems to be something wrong with it (PHP version IS above required by vBulletin). [code] $groups = explode(',', $vbulletin->GPC['groups']); foreach ($groups AS $group) { if (empty($group)) { continue; } $vbulletin->input->clean_gpc('r', "num$group", TYPE_UINT); for ($i = 0; $i < $vbulletin->GPC["num$group"]; $i++) { $vbulletin->GPC['navprefs'][] = $group . "_$i"; } } $vbulletin->GPC['navprefs'] = implode(',', $vbulletin->GPC['navprefs']);[/code] Help appreciated.
  3. Meh, I suck with the where clause. >_> Yeah, I intend to add some error checks here soon enough, hopefully I'll be able to comprehend the errors better then. Thanks for the help.
  4. Currently, I'm working on a forum script, using PEAR DBAL. The error I get is in the title, the code works fine in any other file, except this one. So I would guess it's code problems, the code: [code]      $sql = "SELECT id, name FROM threads WHERE forum = " . '$id';       $result = $dbh->query($sql);       $topics = array();       while($row = $result->fetchRow(DB_FETCHMODE_ASSOC))       {       $topics[] = $row;       }      [/code] However, I don't see anything wrong with it...it's working on my index.php page, which is built the same, except this one has an if statement surrounding it. Possibly a query problem?
  5. Cancel that... Seems I needed to set a mode for fetchRow(DB_FETCHMODE_OBJECT). Then foreach through the rows.
  6. Currently, I'm messing around with DBAL (Database Abstraction Layer), so I can't use MySQL functions and such. Anyway, I have this: [code] $sql = "SELECT id, name, info FROM forums"; $result = $dbh->query($sql); $forums = array(); while($row = $result->fetchRow()) { $forums[] = $row; } [/code] 'k, that works. Now, I don't want to access the id field by going like this: $forums[0][0] ...which returns the first row and the first field. I want to be able to go and do this: $forums[id] However, I'm not sure if it's possible or not, and again, I'm using a DBAL. Thanks.
  7. Server specs: [code]cPanel 10.8.2-S120 Apache 1.3.37 Spam Assasin 3.1 phpMyAdmin 2.8.0.2 PHP 5.1.6 PERL 5.8.7 MySQL 5.0.24-standard Processor Name: AMD Opteron 170 [2GHz] (Dual core) Operating System: CentOS 4.4 i686 Memory Information: ECC Registered 1024 MB RAM[/code] The server load is usually around 0.1 through 0.8, I know I have a ton of mods on the forum, I'll probably be ditching quite a few on a switch to phpBB3. And thanks, I'll look into SMF, I'll just need to find out how to add on to them and such, though.
  8. Trying to find a forum software that is fast in the way of server-sided scripts, however, I'm having a hard time doing so. I don't want to pay for the software, but I don't want slow software either. Currently using phpBB 2.21, however, it's slow with how many modifications are on it. Luckly phpBB 3 seems a bit faster than my current version of phpBB 2.21. So yeah, what is the fastest GNU forum with a good variety of features?
  9. I always miss something so simple. >.< Anyway, thanks for the help.
  10. I'm attempting to use this query via PHP: [code]"SELECT song_name, song_author, song_genre  FROM jukebox WHERE " . $song_selected . " = song_filename"; //Note, this line.[/code] All good up 'till that last line, I tried switching it around (where the variable is) and such, but it keeps telling me unknown column, or SQL Error 1054. Now, I'm not too familiar with the WHERE clause, but if I want to tell SQL only to select results based on a row in song_filename, how would I do that with the WHERE clause? 'cause my method doesn't appear to be working.
  11. Thanks, that works. I wasn't sure if GET vars could be passed via an image. However, rather than make it call to an undefined function, I put the check around the function call, and let the function be defined.
  12. Hello, If I create an image, using this script: [code] function dbar($status) {   $bar = ImageCreate(100, 5);   $red = ImageColorAllocate($bar, 255, 0, 0);   $green = ImageColorAllocate($bar, 0, 255, 0);   ImageFilledRectangle($bar, 0, 0, $status, 4, $green);     header("Content-type: image/png");   ImagePng($bar);   ImageDestroy($bar); } $status = '10'; //Ignore the status var... dbar($status); [/code] Then, I go and save it to a php file, is it possible, instead of saving it into a seperate file, and then including it into an <img> tag, that I could have it included via an HTTP var? Like... <img src="script.php?img=phpimage"> Instead of... <img src="image.php"> That way, I am able to get the $status var (as it will be defined by a database, probably). But the image is only displayed if included in an <img> tag as script.php?img=phpimage. Thanks.
  13. Yup, I do. And I should note it's a linux server, so .dll won't be found.
  14. First, I know my code is fine, I ran it on another server. But when I switched the server, I'm getting an error trying to use ImageCreate(), the paths and such are defined, but the function just isn't working. Could anyone tell me what to do about it? I'm guessing it involves editing of the php.ini file.
  15. Meh. So there is no easier way to force it to use names instead of numbers when drawing from a database? Then I guess I'll have to make sure I do this all very carefully.
  16. Hello, I'm getting results from a database, and it's doing as I expect, however, if I do something like this... $row['config_name']['file_size'] ...where config_name is the column, and file_size is the row, I cannot access it. Instead, I have to do this: $row[0]['config_name'] To access it, then, I have a $row[0]['config_value'] column/values, however, I don't want to be fetching a number and guess around with what I have, so I'd like the name in replacement of 0 to be as well, the name of config_name. So yes, I want to be able to access a part of that array, by the name of a row in in config_name. Thanks. [i]Sorry if I didn't explain that well, I'll explain it better, if needed.[/i]
  17. [code] INSERT INTO config (config_name, config_value) VALUES ('allowed_file_ext', '{\.mid, \.mp3, \.wav, \.aiff}'); [/code] Where {\.mid, \.mp3, \.wav, \.aiff} is supposed to be the array (each item in the array seperated by a comma), but I don't believe it is working as I want it to.
  18. Hello, What is the SQL syntax for an array? I've been searching Google for the past hour, and other has turned up. Additionally, if someone could tell me how to put like...more than one string into that array, thanks.
  19. Well, it's returning my error now, but if I upload a file within the allowed extensions, it still returns in error.  Probably an SQL error now, that or what it is getting from the database is not what I intend it to, I should be able to fix that. Anyway, thanks for the help.
  20. Hello, This code, is supposed to read the name of the uploaded file, and if it doesn't match an extension, then it returns error. However, it just loads, and NOTHING is returned... (not my success script, which is not included here, and does work, or my error script) [code]         //Begin query, and this is working, it's a database abstraction layer.       $sql = "SELECT config_value                   FROM config                   WHERE config_name='allowed_file_ext'";         $extensions = $db->sql_fetchrow($sql);         //End Database Query...         $read_extensions = '(' . unserialize($extensions) . ')';   if(preg_match("#$read_extensions$#", $_FILES['file']['name']))   {       $is_songfile = $_FILES['file']['name'];   } else {     //error goes here } [/code] The SQL inserted earlier... [code] INSERT INTO phpbb_jukebox_config (config_name, config_value) VALUES ('allowed_file_ext', '{.mid, .mp3, .wav, .aiff}'); [/code] Any ideas at to what I am doing wrong here?
  21. Hello, Quick question, does the mysql_real_escape_string function have the ability to be used for other databases and such? Or perhaps not even a database at all, or is it a MySQL only function? If not, then I guess I'll be using addslashes, which is an older less recommended function, is it not? Thanks.
  22. Hello, I'm attempting to put variables into a column, but it appears to be giving me problems: [code] INSERT INTO file (id, song_filename, song_name, song_author, song_genre) VALUES ('', $file, $name, $type, $description); [/code] Yeah, it's telling me "unknown column *putvalueof$filehere* in" It's thinking the variables are columns, how would I get around this?
  23. Ah, thanks, that will get what I want from the database.
  24. Well, so yes, it appears this would be fine after doing a bit more research (config_name and config_value...values, were submitted into the same row. So I'd guess it draws the value of that row (max_file_size, as well). Now, if this syntax isn't correct, please do, find my problem in it. Anyway, I need to put the information into this: $hidden_field = "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"" . $maxfilesize . "\" />"; So yes, $maxfilesize is probably not putting what I want, as I want the config_value put into value, and not config_name. But I want the config_name to get me the value of the row, and then put it in $maxfilesize.
×
×
  • 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.