Jump to content

ajoo

Members
  • Content Count

    777
  • Joined

  • Last visited

Everything posted by ajoo

  1. ajoo

    GHOST message !

    Well I moved the ajax.php outside the root simply because I think that would be a safer place for the code or at least as much as can be moved there. I may be wrong. There are some mixed responses on this on the net. What would you suggest ? See I am unsure and so I am asking. Thanks.
  2. ajoo

    GHOST message !

    HI Requinix, I meant a pointer in the right direction. Since the get variable tactic is returning the wrong result and I have no clue, as of now, how to proceed maybe you can tell me what else I could try. Thanks !
  3. ajoo

    GHOST message !

    Hi requinix, Thanks for clarifying that. In my previous reply I have mentioned that I am able to access the ajax file in includes (outside the root) using a get variable. If I was just to go by the success or failure message returned by the ajax function, I would be good because the ajax call does what it's supposed to do and works great. However the issue is that the return value received by this method is the complete index.html while I just wanted a custom message to be returned signalling failure or success. I have no clue how I may be able to return just the message and not the whole index.html. I was hoping you would be able to show me how that could be done or not. ( my custom messages are also returned embedded in the index.html) Thanks.
  4. ajoo

    GHOST message !

    Hi Requinix, What's that supposed to mean please! ? πŸ˜ƒ Ok So I know somewhat the issue that is. It's happening because I had to change the action value of my form to pass through a GET value as variable to my index file where as earlier it was the ajax.php itself. To be more clear, earlier I had action = "ajax.php ", but now with the file in the includes folder outside the root, it's index.php?page=ajax. But with the file outside the root, i need this. Correct? So please enlighten me how may I fix this to get only the desired output returned? You think i am worrying too much about security ? Like it's ok to let the files be in the root and not move them outside it? Thanks !
  5. Hi all ! I have an ajax page which is working great when it is in the root folder. It is triggered when a certain values dips below a predefined value while a valid user is logged in. The page is simply a form with a drop down and a text box and a message bar at the bottom. The message displays appropriate success or false messages. Everything works good. However I wanted to move the ajax.php into the includes folder outside of the webroot and I did so. The form still works great but the message bar returns my messages embedded somewhere inside entire index.html loaded so far. There are no errors or access errors. The message returned is equated to an empty string at the beginning inside the ajax.php and then populated with the appropriate message which is echoed back. I simply cannot make out where it is picking up the entire index.HTML from and more importantly why ? Please help. Thanks.
  6. Hi Requinix, I found and read https://css-tricks.com/specifics-on-css-specificity/ and was able to resolve my issue. I too thought that putting a class within the <td > or <th > element , would cause the defaults to be overridden. I still applied the class to each <th> and <td> element but that's ok. Thanks Requinix for putting up with my slow grasping !πŸ™ƒ
  7. This I understand !! So if this destroys the inheritance, then shouldn't the text-align: center set by the class within td work as intended ? The thing is that this same table css values works great for many of my tables and don't wish to alter those. In this case since all values of data are numeric I want them right aligned ( there is another class = trow2 { text-align : right}) but there are two values SNo and the Action that I wanted center aligned. So instead of changing the <tr> which affects all other tables i decided to change the <td> values in this particular table. Can you please show me how would you rectify this !? Thanks loads !
  8. Hi, Shouldn't the class trow1's text-align : center override the default td text-align :left ? Doesn't seem to be doing so. I do believe that the class has a higher specificity than the <td> element of the table? CSS .TFtable td{ padding:6px; border:#4e95f4 1px solid; text-align: left; } .trow1{ text-align: center; } HTML <tr> <td class='trow1'>{$din}</td> <td class='trow2'>{$wrt1}</td> <td class='trow2'>{$wrt2}</td> <td class='trow2'>{$wrt3}</td> . . . </tr> Please advise. Thanks !
  9. Hi Requinix, I was not aware that I could use classes inside the <th>, <tr> etc. elements of the tables πŸ€”. Thanks for the clarification. I should be able to sort this then. Thanks loads !
  10. Hi ! Since I am using CSP, it does not allow this to be used without the complication of adding a nonce for these. I was hoping to avoid that. Could you please explain cos I am not sure I understand what you mean by this. What classes ? You mean like classes in divs ? Is something like <th class = "someclass" permitted? Haven't seen that for tables. Thanks !
  11. Yes that's correct ! But the thing is that this would still be an inline styling and I want to remove that altogether and move it into css because this gives me CSP errors !! So is there a way to move the styling into CSS and target the text align property of the <tr>s or <th>s from there. Thanks !
  12. Hi requinix ! Thanks for the response. There are two <tr><th> .... </th></tr> blocks, one for each of the rows. While the first row should have a centered text, the second row should have it right aligned. How would it differentiate which tr is being referred to ? Or am I missing something in your answer? Here's how the HTML goes ! <tr> <th style='text-align: center' rowspan=2> S.No.</th> <th style='text-align:center' colspan=3> COL A </th> . . <th style='text-align:center' rowspan = 2> Action </th> </tr> <tr> <th style='text-align:right'> WS </th> <th style='text-align:right'> WS1 </th> . . <th style='text-align:right'> VS </th> <th style='text-align:right'> VS1 </th> . . . <th style='text-align:right'> XS2 </th> <tr> Kindly clarify, Thanks loads !
  13. Hi all !. I have a table as shown below: S.No, COL A, COL B, COL C, COL D and Actions are the <th> fields in one row and and WSes, VSes, TSes and XSes are in the <th> in the next row. The table is exactly as I want but I have to use inline styling to set the text alignment property of the <th>es in the two rows. The first one being center aligned and the 2nd ones right aligned as seen. I wish to do the styling using css and remove the inline styling. Is there a was for me to target the <th>es of the two rows separately and change their text-align properties. Thanks all !
  14. Hi ! I have a query select @rownum:=@rownum+1 as row, tbl_country.Level, tbl_country.TimeOfLogin, register.email, tbl_country.SessionStatus FROM tbl_country, register,(SELECT @rownum:=0) r WHERE tbl_country.UserLogin = ? AND (tbl_country.UserLogin = register.Username) order by row desc limit 1; that works great but I want to change this to use JOINS. Please can someone show me if and how that can be done. I am not sure how and where to place (SELECT @rownum:=0) r in the query with joins. I have tried but it fails each time. Thanks all !
  15. Hi Benanamen ! Thanks for the response. Please bear with me for a day or so while I am doing a quick run through of my code. I'll come back and revert shortly. Meanwhile, here's a link, in case you would like to check out the near same discussion earlier on this topic. https://forums.phpfreaks.com/topic/301981-query-woes-confused/ Sorry for this delay. Thanks.
  16. SIr, The following query however fails to give the number of affected rows. SELECT table_A.uid, table_A.pole, table_A.act as Status FROM table_A UNION SELECT table_B.uid, table_B.pole, table_B.confirm_A as status FROM table_B UNION SELECT table_C.uid, 'User' as pole, (table_C.confirm_A + table_C.confirm_B) as status FROM table_C; There are about 9 rows that are actually formed so I wonder if that is the same as rows affected. Is there a way to find the number of rows formed from the above query ? Presently I encompass the above query with an additional SELECT COUNT(uid) FROM { }bb; which provides the rows that are available as 9. Running the 1st query is faster in this case. I was wondering if I could do without the COUNT(uid) thingy ! Thank you.
  17. Hi all ! Just nudging this once again in hope of some more replies and thus some more information on this , I think, rather critical issue, which I am sure lots of coders become aware of rather late in the day !! Thank you all !
  18. No sir, I hadn't. πŸ™Thank you Guru Barand !!
  19. Hi all, Does the statement "CREATE TEMPORARY TABLE temptab as SELECT ... " provide some sort of a return value to check the null/number of rows in that table? Running the same in phpadmin definitely gives the number of rows affected but i don't know how to tap into that value. I tried using the $stmt->bind_result($count); after executing the query thinking it might be the same as the Select query but that returns no value while my table has about 7 rows generated. If someone can show how, if the value can be retrieved. Thanks.
  20. Sorry, My suggestion is incorrect. I did not take a closer look. Kindly discard the previous reply.
  21. You are using $item_Annual at one place and $itemAnnual at another.
  22. A simple for loop would do the trick.
  23. Hi NotionCommotion, The code analyzer I used is codacy. It's a static code analyzer. I do not think it is using any framework and I am not using any framework for my code either. I have never used any autoloader ever & have no idea about it. I have also never tried composer either. Are these not to be used with frameworks ? Or can I use them in my project which uses no framework or OOPS? If so , then a small example of their usage would be great and get me going. $_POST = array(); $_SESSION() = array(); I have used these just before destroying a session and logging out a user out. mysqli_close. I have used prepared statements throughout. Thanks for the response. I hope some more inputs on this will follow till something concrete can be used to replace the faulty code or it be proved that some of the errors may be superfluous & the code may be used safely as is. Thanks !
  24. Hi all ! I just passed my code through an analyzer and it showed that a lot of it was not following best practices. Some examples are below: 1.Direct use of $_SERVER Superglobal detected. if($_SERVER['REQUEST_METHOD']==="POST"){ if(!isset($_SESSION)) sess_start(); if(isset($_SESSION['timeout'])){ $_SESSION['user']=$user; 2. Direct use of $_POST Superglobal detected. if(isset($_POST['submit']) && $_POST['submit'] ==='Logoff'){ $_POST = array(); $usertype = fcheckRecruiter($_POST['usertype']); and many more like these concerning the use of SUPERGLOBALS. 3. Discouraged functions : header(), session_unset(), mysqli_close(), session destroy() & require_once to name a few besides a lot of other common php functions. header ("Location: donepage.php"); session_unset(); mysqli_close($link); session_destroy(); Well the question is obviously how to tackle these. The surprising part though is that prior to checking the code by an analyzer, I had no clue, like many other coders on this forum perhaps, especially the newbies, that my code was flawed or at least not following the best practices. I never found a single piece of code on the net, in examples, even in examples in the PHP manual that showed the correct usage of these as per best practices. The most surprising of these were of course the SUPERGLOBALS since they are used everywhere and by almost everybody. Googling the internet shows that hardly anyone is clear about these. People are debating on the direct usage of suberglobals where they are used for checking the existence of the variable. So it's all very moot and very grey it seems. Then there are common functions some of which i mentioned above. For example how would I reset the super global $_POST if not by setting it to a blank array? $_POST = array(); Why are these functions, enlisted above, being discouraged from use and what and how should the alternate functions be used ? How to achieve the same functionality in an alternate way? For the use of superglobals I found that it's proposed to use the filters or filter functions to sanatise or validate the input. If i recall correct, Guru Jacques strongly advised against sanitizing any user input. While I can understand validation of user input, sanitization of it seems to be wrong ?? I would be very grateful if someone can shed some light on these very basic and important questions and provide, if possible, some examples of the correct method of using these in code. Thanks all !
×
×
  • 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.