Jump to content

j.silver

Members
  • Posts

    142
  • Joined

  • Last visited

Everything posted by j.silver

  1. j.silver

    Error Reporting

    Hi all, I want to eliminate any possibility of error reporting to users as it hinders a risk of displaying valuable data to potentially dangerous people, so I am setting the error reporting to false (as shown below). I want to disallow error reporting on every page, including same in one location applicable to all pages, e.g. the config file. <?php error_reporting(0); require 'db/connect.php'; But at the same time, I want to see errors reported to me, e.g. via email. If instead of setting error reporting to false as above I only set the error reporting function to report to the email, is there any chance that some errors would still be seen by users?
  2. Any idea how loading speed of js (and speed in general) compares with the speed of PHP7?
  3. Hi all, Why do we hear and read that js is one of three programming languages a web programmer must learn besides html and css when there are also other widely used server-side languages, such as PHP? Is it because browsers are designed to mainly understand html, css, and js? If there are other reasons, kindly them spell out?
  4. Hi all, How is the performance and speed compare between a website that is coded with html 5, CSS 3, MySQL, and PHP 7 only and the same website but added to it js, jQuery, and JSON?
  5. Hi all, In one website, I read the following note: "You should also think about storing files locations on disk. Using MySQL for storing images is thought to be Bad Idea™. Handling SQL table with big data like images can be problematic." Do you agree? If not, why? What is the best practice in storing and displaying on a website a big number of images?
  6. Dear all, I have the following code for storing an image in and fetching it from a MySQL DB: <html> <body> <form action="index.php" method="POST" enctype="multipart/form-data"> File: <input type="file" name="image"> <input type="submit" value="upload"> </form> <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("code_new") or die(mysql_error()); $file = $_FILES['image']['tmp_name']; if(!isset($file)) { echo 'Please select a file'; } else { $image = addslashes(file_get_contents($_FILES['image']['tmp_name'])); $image_name = addslashes($_FILES['image']['name']); $image_size = getimagesize($_FILES['image']['tmp_name']); if ($image_size == FALSE) echo 'This is not an image.'; else { if(!$insert = mysql_query("INSERT INTO lash VALUES ('', '$image_name', '$image')")) { echo 'Problem uploading the image.'; } else { $lastid = mysql_insert_id(); echo "Image uploaded.<p />Your Image:<p /><img src=get.php?id=$lastid>"; } } } ?> </body> </html> No need to include get.php and the DB. To test the if statement in red, I attempted to upload a pdf file and it functioned well. It also uploaded various images. But when I attempted to upload a docx file (word), the following occurred: Warning: POST Content-Length of 9069583 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 What is the meaning of this warning and what are the Unknown and line 0?
  7. j.silver

    utf8 VS utf8mb4

    Dear all, I came across the following statement on one website: "Note: Since MySQL 5.5.3 you should use utf8mb4 rather than utf8. They both refer to the UTF-8 encoding, but the older utf8 had a MySQL-specific limitation preventing use of characters numbered above 0xFFFD." 1) Is there any drawbacks in using utf8mb4, or it is recommended for use from now on?
  8. Dear all, I thought all tutorial scripts are perfectly functioning without any need for amendments. However, codes of the following tutorial have been used exactly as they are written but did not work: http://www.w3schools.com/php/php_file_upload.asp It reports the following: Notice: Undefined index: fileToUpload in C:\xampp\htdocs\Jadeed\upload.php on line 5 Sorry, file already exists. Notice: Undefined index: fileToUpload in C:\xampp\htdocs\Jadeed\upload.php on line 25 Sorry, only JPG, JPEG, PNG & GIF files are allowed.Sorry, your file was not uploaded. Pls. note that PHP is configured to allow file uploads, and the form, upload.php, and uploads directly are in the same directory.
  9. Any precautions or recommendations in using NULL itself?
  10. Having NULL type as an object to be a bug in js, is there any harm to code this could result in, and what precautions should we take to avoid such harm?
  11. <body> hello all <script> document.write(5+7); document.write(4); </script> </body> Above basic js code outputs: hello all 124 There is no concatenation between "hello all" and "12", yet space is there. I'd appreciate an explanation.
  12. j.silver

    Vague Notice

    Hi, This block code is from W3schools tutorials: <?php $cars = array("Volvo", "BMW", "Toyota"); $arrlength = count($cars); for($x = 0; $x <= $arrlength; $x++) { echo $cars[$x]; echo "<br>"; } ?> The original block was without the equal sign in $x <= $arrlength; I have added the equal sign to see what would happen. I got the same result but followed with: Notice: Undefined offset: 3 in C:\xampp\htdocs\Testing\testing.php on line 14 I would appreciate it if someone would explain why I am getting this notice and its meaning. I thought the loop will stop and give the same result without any notice when it hits no value for the equal sign.
  13. Many thanks, jusomeguy. When should we use utf8_general_mysql500_ci and is it better to use it or use utf8_general_ci? Which of the two provides better security for DB to avoid hacker's attack?
  14. I am creating a table using phpMyAdmin. I would appreciate if someone would explain: In the collation, I am selecting utf8_general_ci. Is this OK? For indexing, when should I use ''unique and when would I use 'index'?
  15. Wouldn't the use of charset=utf-8 in each page of html, php, js, DB give that needed SEO friendliness or the impact is limited to file content only, without extension to file and folder name?
  16. Paid editors are usually equipped with some basic validation capabilities, but I am using Notepad++ in which I am not seeing such capabilities. Is there a setting change in Notepad++ that might make it more capable, or is there a better free editor?
  17. Validation of a block of code to see if it is written properly. You copy your block of code and paste it inside the validator, which comes up with a statement that the code is good or lists suggestions of improving the code to be in line with standards.
  18. Hi, As you know, there is W3C markup validation service. Is there a reliable validation service for PHP, MySQL, JS (other than Chrome's console), and CSS?
  19. Hi, I am considering to have two tables related to investments: 1) investors 2)invested money, with a link between the two. For the second table, besides own id and id linking to the first table, there are: investment received, paid money (e.g. profits, paid capital etc.), and dates associated with investment and paid money. There is also some money deductible which is relevant to tax, exchange rate, expenses, etc. I have two options: having those deductions as part of the second table with proper formulas, or keep the table simple and have deductions not in the table but rather as part of the accounting work in accountants' books. I would appreciate if someone knows what could be the best/advisable professional practice.
  20. Hi, As you all know, it is recommended to give folders, files, and the DB less obvious names for extra security. For the above, as well as for username and password associated with website access, I am thinking of giving each name a mix of letters and numbers of multiple languages, hoping to face no problems using charset=utf-8 in all pages, css, js, and DB. Do you consider this to be an acceptable approach or there could be drawbacks I am not aware of?
  21. The html code, js, and flags are provided in post 3 above. css is below. @charset "UTF-8"; * { margin: 0; padding: 0; } #country-select { position: absolute; top: 13px; right: 0; width: 180px; } /* rought form styles for when JS is disabled */ #country-select form { width: 180px; padding: 0; } #country-select select, #country-select input { display: inline; padding: 0; margin: 0; } /* JS-created definition list */ .dropdown dd { position: relative; } .dropdown a { text-decoration: none; outline: 0; font: 12px Arial, Helvetica, sans-serif; display: block; width: 130px; overflow: hidden; } .dropdown dt a { background: /*#c45618;*/#575c7a; border: 1px solid #964315; padding: 3px 10px 4px 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #fff; } .dropdown dt a.active { background: #db5e18; -webkit-border-bottom-left-radius: 0; -webkit-border-bottom-right-radius: 0; -moz-border-radius-bottomleft: 0; -moz-border-radius-bottomright: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px dotted #676768; -moz-box-shadow: 0 3px 7px rgba(0,0,0,.5); -webkit-box-shadow: 0 3px 7px rgba(0,0,0,.5); box-shadow: 0 3px 7px rgba(0,0,0,.5); color: #fff; } .dropdown dd ul { background: #814f33; border: 1px solid #676768; color: #C5C0B0; display: none; position: absolute; z-index: 999; top: 0; left: 0; padding: 2px 0 5px 0; list-style: none; border-top: none; margin: 0; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -moz-border-radius-bottomleft: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; -moz-box-shadow: 0 3px 7px rgba(0,0,0,.5); -webkit-box-shadow: 0 3px 7px rgba(0,0,0,.5); box-shadow: 0 3px 7px rgba(0,0,0,.5); } .dropdown dd ul li a { padding: 2px 10px; } .dropdown dd ul li a span, .dropdown dt a span { float: left; width: 16px; height: 11px; margin: 2px 6px 0 0; background-image: url(../images/flags.png); /*flags are included here*/ background-repeat: no-repeat; cursor: pointer; } .us a span { background-position: 0 0 } .uk a span { background-position: -16px 0 } .fr a span { background-position: -32px 0 } .de a span { background-position: -48px 0 } .nl a span { background-position: -64px 0 } .dropdown dd ul li a em, .dropdown dt a em { font-style: normal; float: left; width: 100px; cursor: pointer; } .dropdown dd ul li a em { color: #dbc3b5; } .dropdown dd ul li a:hover { background-color: rgba(255,255,255,.1); } .dropdown dd ul li a:hover em { color: #fff; }
  22. Thanks again, dsonesuk. I will play with some codes of the provided link and see what I can come up with.
  23. I am considering an addition of 1-2px of the same color to cover the gap created. I am wondering, however, if there is a better permanent solution, but having the comment of justomeguy that html is not a pixel-perfect medium might suggest the lack of such desired better solution.
  24. The matter we have addresses before, dsonesuk, and the link you supplied was not on a similar issue, it was on how to separate css and/or jQuery links between the head and bottom of the body tags. On this matter, I think there should be a way of having just one most recent link to jQuery library but which enables both required functions to take place: collapsible/uncollapsible text and language links (flags beside language name), both of which would not affect the other anchor links in the header.
  25. The second jQuery link did not override the functionality of the first--clapping/uncollapsing, which is the function of the first link, is still working fine.
×
×
  • Create New...