Jump to content

phdphd

Members
  • Posts

    248
  • Joined

  • Last visited

Everything posted by phdphd

  1. Hi PFMaBiSmAd, Let me put it simple in just four words : THANK YOU VERY MUCH ! Sometimes we search the universe while what we are looking for is at our fingertips. I cleared safari's cache, repeated the process and no error occurred. Thank you again. Have a great day. You deserve it.
  2. Hi All, While testing my PHP code on Firefox and Safari, I noticed that one error of type "Parse error: syntax error, unexpected ')'" would display on Safari, but not on FF. Very strange... (Actually there is no extra ')' anyway.) This error appears while clicking repeatedly the back button in the Safari toolbar, once the user has gone through the whole process one way. Doing the same in Firefox does not trigger any error. I thought "Is there really an error on Safari ? If so, it must be possible to record it in a log file". So, to simulate the user's environment, and record all the errors in a .log file, while preventing them to display, I inserted the following lines at the beginning of the script in the file that is mentioned in the error message : error_reporting(E_ALL | E_STRICT); ini_set('error_log', 'test.log'); ini_set('log_errors', 'On'); ini_set('display_errors', 'Off'); Unfortunately, not only I still get the error of type "Parse error: syntax error, unexpected ')'" , but also this error is not recorded into the log file, despite the fact that I did put the error managing code in the PHP file stated in the error message (and that file contains only one PHP script, so no risk to put the error managing code in a wrong script). To test whether that code is functional, I added 1/0; in order to test the division by zero. Now, the error related to the "division by zero" instruction does not display and it is recorded in the .log file, which means that the code is functional. However, the error of type "Parse error: syntax error, unexpected ')'" still displays and does not get recorded into the log file. Any idea of what is going wrong on Safari ? It would be annoying having error messages display in a browser (and possibly reveal some sensitive coding data) while there is actually no error. Thanks for your help.
  3. Thanks for your reply. I was afraid something was wrong in my approach.
  4. Hi All, I have a big problem with session variables getting lost when playing with back/next buttons. This leads to wrong data being displayed, and possibly PHP error messages. From the user's point of view, there is a series of forms to fill in, one form being allowed to display only if ALL previous ones have been correctly filled in. It all works perfectly. But the problem can appear when playing with back/next buttons. Basically, my files are organized as follows. There is a main php file that "drives" the whole structure, where each remaining file contains POST method and SERVER/PHP_SELF action as form settings. This main file contains 2 parts. The first part is where I test/analyse the existence and contents of the POST variables. The second part is where I call the correct form (through an "include" statement) according to the result of the POST test/analysis. For example, if form_1 is correctly filled in, form_2 is called, if not, form_1 is displayed again. In each POST testing, the part that runs if the form is correctly filled in contains two $_SESSION lines. Assuming form_1 POST variable is being analysed, these 2 lines would be something like $_SESSION[form_2_can_be_displayed]=1 and $_SESSION[user_went_through_form_1]=1. $_SESSION[form_2_can_be_displayed] is the variable that is tested for in the second part of the main php file and that will enable to trigger the display of form_2 through an include statement. $_SESSION[user_went_through_form_1] variable is tested for at the beginning of the analysis of POST variable for form_2. In other words, POST variable for form_2 will only be analysed if the user did successfully go through form_1. $_SESSION[user_went_through_form_1] is never unset except at the very beginning of the analysis of POST variable for form_1 in case form_1 had already been successfully submitted by the user. So, as the user moves from form to form, successive $_SESSION[user_went_through_form_XXX] variables get recorded into the global SESSION variable. With such data, I can safely test a POST if ALL previous forms have been passed through. If this condition is not met, a message appears prompting the user to return to the home page. Assuming form_3 POST variable is being parsed, the structure of the test would be something like this (with simplified ELSE details) : If (isset[post_for_form_3]) { If (isset($_SESSION[user_went_through_form_1]) && isset($_SESSION[user_went_through_form_2])) { If (isset($_SESSION([user_went_through_form_3])) { unset $_SESSION([user_went_through_form_3]) } //process the POST variable// If (user-entered data is OK) { $_SESSION([user_went_through_form_3])=1 $_SESSION[form_4_can_be_displayed]=1 } Else { $_SESSION[form_3_can_be_displayed]=1 } } Else { //Instructions to display the "return to home page" message } } As said at the beginning of my post, it all works perfect from the first form to the last one, but afterwards if I randomly play with back/next buttons I may suddenly get the " return to home page" message, meaning that the "isset($_SESSION[user_went_through_form_XXX])" line test has failed. I just do not understand why this happens, because there is no reason why the $_SESSION[user_went_through_form_XXX] should be missing. For example, when falling again on [post_for_form_3], why "isset($_SESSION[user_went_through_form_1])" or "isset($_SESSION[user_went_through_form_2])" should be missing ? These variables were initially set on successful testing of POST variables for form_1 and form_2 and never unset aftewards. Please help ! Thanks !
  5. Hi All, In one of the pages of my site, I extract a series of terms, classified by categories, from a database. Initially, all info was listed in a single column (category name, term list, other category name, other terms list), which left much unused room on the center & right sections of the page. From a CSS code available at http://www.inserthtml.com/2012/01/css3-multi-column-layout-implementation-change-website-design/, I successfully applied a formatting in order to use the whole width of the page. Now the problem is that one category of terms can start at the end of a column and continue at the top of the next one. To force a column break before each category, I associated a <span class="breakhere">category_name</span> tag to the categories and added .breakhere { color: blue; break-before: column; -webkit-column-break-before: column; -moz-column-break-before: column; -ms-column-break-before: column; -o-column-break-before: column; } to the CSS code. This tag is functional since the text does display in blue. However, no column break is applied before the category names. Any idea of what is going wrong ? Thanks !
  6. Hi, Let me rephrase my question. Imagine you developed a long time ago a website for a local audience, and that given its great success you decide to target it to other audiences in other countries. Is there a utility that enables to extract all translatable strings before sending them for translation ? "All" means extracting for example "My Website" from <title>My Website</title> but also from echo 'My Website'; of from echo $a .'My Website'. $b;
  7. Hi All, I want my site to be available in different languages and wonder whether there exists a utility that helps extract from HTML/PHP code all the strings that are likely to be displayed to the user. This will be very helpful when entering the translation process. Any idea or clue ? Thanks.
  8. Well so far I have no specific issue, I am just wondering how to get the best protection against any violation of the website, which is still under construction. There will be a lot of php coding and time spent on it. One of the issues could be redirecting the visitor to another website. I have read in another forum that a hacker can do this by editing a website file. This implies the hacker can access the file. Then other issues can happen : by accessing the php files that make up a website, the hacker can also steal php coding, get database credentials, make any change to the DB, etc, and eventually ruin all the webmaster's efforts, even if the webmaster regularly makes backups of the website and DB. Any suggestions/procedures that a webmaster should follow to implement the highest level of protection are welcome. Thanks. PhD
  9. Sorry, I am not an IT/Internet specialist. Let me try to rephrase again If a hacker just exploits a weakness of the configuration of the server that hosts the website, does this always give them access to the php files of your site and to their contents or do they also need to violate the security procedures set by the webmaster at the website level in order to access the php files? Regards PhD
  10. Thanks for your quick answer. In case of (b), can the hacker open/modify the php files without violating the procedures that the webmaster had set for the website ? Regards, PhD
  11. Let me try to rephrase it. Problem : imagine you own a website that is listed in a Google search results page when the user enters some key words. One day, it appears that when the user clicks the link, the homepage of another website appears instead of the homepage of your website. Questions : (a) can this be due ONLY to a violation of the security procedures implemented by the webmaster for the website (htaccess file, password/login settings, etc) or (b) can it be also achieved by exploiting a weakness of the configuration of the server that hosts your wbsite ? If answer is (b), does a dedicated server (i.e. a server that hosts only your website) offer a better protection ? Thanks. PhD
  12. Hi All, When one clicks a link in a search engine, they might be redirected to another site than the one they want to visit, due to a hacking issue. Let's suppose that the site is hosted on a shared server and that the webmaster of the site cannot be held responsable for this issue. Can there be an issue at server level ? Could the use of a dedicated server bring an additionnal protection ? Thanks for sharing your view. PhD
  13. Wow, very impressive ! Thanks a lot MMDE ! You deserve a gold medal.
  14. Hi, Sorry for being late.... The form will look as follows : <form method="post" action="target.php"><br /> </p>Category1:<br /><br /> <input type="checkbox" name="cat1[]" value="cat_1_val_1">Value 1 of category 1<br/> <input type="checkbox" name="cat1[]" value="cat_1_val_2">Value 2 of category 1<br/> <input type="checkbox" name="cat1[]" value="cat_1_val_3">Value 3 of category 1<br/> <input type="checkbox" name="cat1[]" value="cat_1_val_4">Value 4 of category 1<br/> <input type="checkbox" name="cat1[]" value="cat_1_val_5">Value 5 of category 1<br/> <br /> </p>Category2:<br /><br /> <input type="checkbox" name="cat2[]" value="cat_2_val_1">Value 1 of category 2<br/> <input type="checkbox" name="cat2[]" value="cat_2_val_2">Value 2 of category 2<br/> <input type="checkbox" name="cat2[]" value="cat_2_val_3">Value 3 of category 2<br/> <input type="checkbox" name="cat2[]" value="cat_2_val_4">Value 4 of category 2<br/> <input type="checkbox" name="cat2[]" value="cat_2_val_5">Value 5 of category 2<br/> <br /> </p>Category3:<br /><br /> <input type="checkbox" name="cat3[]" value="cat_3_val_1">Value 1 of category 3<br/> <input type="checkbox" name="cat3[]" value="cat_3_val_2">Value 2 of category 3<br/> <input type="checkbox" name="cat3[]" value="cat_3_val_3">Value 3 of category 3<br/> <input type="checkbox" name="cat3[]" value="cat_3_val_4">Value 4 of category 3<br/> <input type="checkbox" name="cat3[]" value="cat_3_val_5">Value 5 of category 3<br/> <br /> <input type="submit"/> <input type="reset" /></p> </form> Thanks for your help.
  15. Well, I am afraid not at first sight Let me give an example with simple data. The data collected in $_POST can be as follows Array ( [cat1] => Array ( [0] => house [1] => building ) [cat2] => Array ( [0] => cloud [1] => sun ) [cat3] => Array ( [0] => happy [1] => sad ) ) The generated list will then be : house _ cloud _ happy house _ cloud _ sad house _ sun _ happy house _ sun _ sad building_ cloud _ happy building_ cloud _ sad building _ sun _ happy building _ sun _ sad Should the user not select any options in cat2, the generated list would be : house _ happy house _ sad building _ happy building _ sad In other words, the PHP code that generates the list must adapt to whether or not the user did select options in the different categories (whatever the number of categories), because this will determine the number of foreach loops. Thanks in advance !
  16. Hi all, Using a form with check boxes divided into different categories, I collect data selected by the user. I now want to combine each choice in each category with each choice in the other categories and list the combinations to the user. If the user chooses one or more options in each category, it is relatively easy to nest foreach loops, since the number of categories will always be the same. For example, if the form contains three categories of options, the code will be: foreach ($form['cat_1'] as $k1 => $val1) { foreach ($form['cat_2'] as $k2 => $val2) { foreach ($form['cat_3'] as $k3 => $val3) { echo $val1.' _ '.$val2.' _ '.$val3.'<br/>'; } } } Things get complicated if the user does not select options within a given category. More generally, I want to be able to generate the list regardless of the number of categories in which the user selects options. Thank you in advance for your advice.
  17. Thanks a lot requinix for your quick and relevant answer ! It works perfect ! You are definitely the strongest
  18. Hi All, There is a very interesting solved topic here (http://www.phpfreaks.com/forums/index.php?topic=304966.0) about how to access elements in embedded _POST array. But before accessing an element, it might be appropriate to check whether the array it is supposed to be in exists. According to the solution given in the topic indicated above, $_POST['matType'] is an example of embedded array . Is there a way to check if this array exists? Thanks in advance for your help.
×
×
  • 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.