SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry :(( interview question did i answer right?

    hey guys,

    I was asked in one of the php interview...please tell em if i asnwered them right

    or atleast in the right way

    1. how would you acheive wizard forms?
    ans: i wud use sessions and session arrays to store info.

    2. what is the only draw back of session? (php session)


    ans: i am not sure but i think it is read able..

    3. where r sessions stored?

    ans: on the server if windows then winsows/temp

    4. what would you do so that a user does not access a file say x.php in any way

    ans: i would edit .htaccess

    5. if there are n number of pages , and when clicked will open a single main page, then how will you identify the page from where the click has come?


    ans: i would use a variable to be sent from that page to the single main page.
    or i would use a session to store a variable!

    6. suppose there is a data table in mysql, and there is text and you need to search from a particular text what would do?

    ans: use php and mysql match query to get the result
    ( I dont know does a match exsist ?)
    Yes sir match with query...

    Guys now please tell em if i had doen well? and which were much better answers?

    Thanx



    guys please tell me if i had done quite ok?

  2. #2
    SitePoint Evangelist LemoNade's Avatar
    Join Date
    Aug 2005
    Location
    Southampton, UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just had a brief look through them and I can't see anything wrong really.

  3. #3
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sigh phew well that was a sigh of relief but can others too help

  4. #4
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    reply giys(

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2005
    Location
    Bucharest, Romania
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe that is a job interview, and you are cheating.
    anyway here is my opinion:


    1. how would you acheive wizard forms?
    ans:
    - sessions to store data (small amount of data)
    - temp tables
    - hidden fields and carry them withing forms
    depends on the wizard type

    2. what is the only draw back of session? (php session)
    A:
    The session module cannot guarantee that the information you store in a session is only viewed by the user who created the session.

    3. where r sessions stored?
    A:
    defalut handler is the file system. You can also store the sessions in a database...
    php.ini's session.save_path can be used to set the path for session files (if file system is used to store sessions)

    4. what would you do so that a user does not access a file say x.php in any way
    A:
    1. delete it
    2. chmod it to, let's say 600
    actually the question is ambiguous... do it so the user cannot access it through a http request, or physical access?
    http access can be denied using mod_auth, or deny phisical access to the file for the webserver's user...


    5. if there are n number of pages ,
    and when clicked will open a single main page,
    then how will you identify the page from where the click has come?

    ans:
    $_SERVER['HTTP_REFERER'] - contains the url of the referring page, can be parsed and ifentify the page (if the page number is stored in $_GET)
    sessions can be used to store the current page, and can be checked before data is overwritten with current page info


    6. suppose there is a data table in mysql, and there is text and you need to search from a particular text what would do?
    - use a Full text index and use MATCH AGAINST
    - use sql's LIKE '%word%'
    etc...

  6. #6
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mannnnnnnnnnnn The Interview Is Over Man..i Am Verifying The Answers Buhhhhhhhhhhhh

  7. #7
    SitePoint Zealot
    Join Date
    Aug 2005
    Location
    Bucharest, Romania
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you say so...

  8. #8
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well hern how did the asnwers come? and hwop would i knwo the questions hand before?? anyways do you thnk i might have got through the way i replied?

  9. #9
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cflorinel
    I believe that is a job interview, and you are cheating.
    anyway here is my opinion:
    If you really felt it was cheating then why answer?

  10. #10
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am just tense and hope i get through the interview so i am just verifying my answers

  11. #11
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about I answer them myself and you can see how the answers differ from yours?

    1. how would you acheive wizard forms?

    The key issue with multi-part forms is to retain the information from prior stages as you move forward. The easiest way to accomplish this is using sessions. If this is not available for some reason, you can achieve similar effects by serializing the previous stages information and storing in a hidden input form element.

    2. what is the only draw back of session? (php session)

    The default session handler writes to the system temporary directory, and is created with permissions allowing the web server user to read and write the information. On a shared host, this means other users colocated on the server might be able to read the session information.

    Another issue is propigation of the session id, which requires either a cookie, or the propagation via request parameters.


    3. where r sessions stored?

    Depends of if you are using customer session handlers, in which case you can locate wherever you want. If you are using the default session handlers, the sessions are written as files to a directory specified in the php.ini file, typically the system temporary directory.

    4. what would you do so that a user does not access a file say x.php in any way

    Delete the file. Oh, you meant through the web server, then change the .htaccess file to deny access.

    5. if there are n number of pages , and when clicked will open a single main page, then how will you identify the page from where the click has come?

    You can check the $_SERVER['HTTP_REFERER'] variable, but this is not always guarenteed to be transmitted by the users browser agent. If you control all of the inbound links, you can add a $_GET parameter like from=old.php to all of the links which could then be parsed at the main page. Alternativly, you could enable a high level of logging on the web server and try to identify the information after the fact from the log files (depends on how you want the information to be user, offline analysis vs in the active pages code).

    6. suppose there is a data table in mysql, and there is text and you need to search from a particular text what would do?

    I do not use MySQL much in my PHP work, but I believe there is a full text search capability that MySQL is supposed to be very good at. I would review this functionality to see if it met the search requirements.

    HTH
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  12. #12
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for your detailed replies really very very thank full

  13. #13
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    though, on the other hand, I don't think the question
    what is the only draw back of session? (php session)
    is justified. The person asking it was either an idiot or a newbie or didn't know web-programming(not specifically PHP). there are more than 1 drawback of PHP Session.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  14. #14
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wll what is the rela answer then....the draw back of session wud be?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •