Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by CroNiX

  1. Well, if you want an actual PDF, then you have a lot more work to do, probably more than you've done thus far. It's complex, even with a good library to use.

     

    I'd suggest looking at FPDF and TCPDF, or google "php pdf library" for more.

     

    If you just want to bring up the browsers native print dialog, which is the same as just choosing "print" from your browser, then you'd just change your button slightly and add an onclick event and have it trigger window.print():

    <input type="submit" id="Button1" name="" value="print" style="position:absolute;left:129px;top:295px;width:96px;height:25px;z-index:20;" onclick="window.print();">
  2. $columns = array();
    $fields = array();
    foreach($this->getColumnNames("table") as $columnName)  //cycle through the valid columns
    {
      //see if there was a posted field with this key
      if (array_key_exists($columnName, $_POST)) 
      {
        $columns[] = $columnName; //store the column name
        $fields[] = $_POST[$columnName]; //store the field value from POST
      }
    }

    Now you can use your implode on $columns and $fields to build $columnList and $paramList

  3. It will continue through empty lines. The best way to learn is to look up the functions being used in the php manual, and also to try them out with test data to see.

     

    If you don't want it to store an empty line in the final output, then just check for it and don't add it to the array in the while() loop.

    if ($ar[0] != '') $users[] = $ar[0]; //only store line in new array if it contains something

    It *may* work retrieving the file from a different host using fopen(), but that relies on allow_url_fopen being enabled in your php.ini. Again, see the manual for fopen() for more details. You can always use CURL to retrieve from another site, which will work all of the time.

    • Like 1
  4. Most likely you are using the mysql extension, and are using PHP >= 5.3. PHP has deprecated the mysql driver, which means it's going to be totally removed from PHP in an upcoming version. You should be using the PDO (1st choice) or MYSQLi extension and forget that the original MYSQL extension exists if you want to better future proof your code.

     

    See the PHP notes: http://php.net/manual/en/migration55.deprecated.php

    More here: http://php.net/manual/en/intro.mysql.php

  5. Are all of your db tables prefixed with 'smf_'?

     

    You might also try changing the driver to "mysqli" instead of "mysql".

     

    It looks like you should be receiving emails about the db errors ($db_error_send = 1;)...are you?

     

    You might contact the host then if db_server, db_name, db_user and db_passwd are all correct, and everything else.

     

    In the future when reinstalling or upgrading something, make a copy of the original so you have the original files to compare to.

  6. Is it your application that determines whether it's a 404 page, or the webserver itself? Like for your /143/test.php example, is there an actual directory named 143 with a test.php file in it, or does your app take the request, translate it and look it up in a db for routing or something? If it's the app making the determination, then those ErrorDocument  directives will never be used as those are for "native" errors to the webserver.

     

    This might be a language problem around the term "redirect", but you should never "redirect" to a 404 page. Redirects change the url and actually take the visitor to a different page. You should just throw a 404 status header and display a custom not found message, but the URL should still be the actual page that is missing and not redirected (a new request) to /errors.php. Otherwise, you are telling browsers and search engines that "http://yoursite.com/errors.php" doesn't exist instead of the actual missing page, which in fact it does.

  7. Are you sure you need to do this? What's the goal here? Default form behavior is to submit the form when enter is pressed. Altering that behavior could lead to a bad user experience since most are used to the default behavior for forms.

     

    The only way to do what you are asking is to use javascript. Are you using a library such as jQuery? Depending on what you're using, the answer would look different.

  8. The first 2 notices are probably causing the rest of the errors. The 2 variables, $boarddir and $sourcedir, don't exist in your code. Those look like they're supposed to be defined as a path. Then the rest of the code (require's) try to use those variables to load more code, but it can't since the paths aren't defined.

     

    So you need to find why those 2 variables aren't defined (should be further up your code), and define them with the correct paths.

×
×
  • 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.