Basic questions
Scene:
You have entered a new company.
On the first day of work, the receptionist arranged a seat for you and then pulled over a new computer that was not unpacked.
After you have connected your computer, press the power ....
Well, this is really a new computer, inside actually built a DOS system!!
You got a colleague. Operating system CD/u disk (this doesn't matter). After half an hour, the operating system is installed.
-
The first thing to do is to set up the lamp environment so that it works well. Brief note on building the LAMP Environment in the process .
-
After the LMAP environment is set up, you get the first development task. Develop a general approval system inside the company. There is a DNS server inside the company, the top has been equipped with the domain name of this system, Called Approving.great-company.com, and pointed to the IP of your native computer. You tried to visit http://approving.great-company.com The Apache Classic It works page appears, and the domain name is in effect. You plan to create a new directory on the desktop called approving and complete the development of this system in this directory. How to configure Apache Make Access http://approving.great-company.com to open the approving/index.php
-
Apache configuration, you started the development work. At this time, My colleague gave you a code, and another person wrote half of the general approval system . This is much better, you don't have to write the code from scratch. You looked at his code and found that the logic was this: after users log in to the system using email and password, The program puts the user's ID in the SESSION. by $_session[' uid ', you can get the login user ID, and then go to the database to get the user's personal information (such as what name, which department) to get. And then you found this generic approval system. code for primary function points
<formAction= "new-approving.php"Method= "POST">Approval matters:<inputtype= "text"name= "title" />Detailed Description:<textareaname= "Details"></textarea> <inputtype= "Submit"value= "Submit" /></form>
<?PHPinclude__dir__. '/conndb.php ';$title=$_post[' title '];$details=$_post[' Details '];$access=MD5(uniqid());$db->query ("INSERT into approving (title, details) VALUES ('$title‘, ‘$details‘)");$insertId=$db-Getlastinsertid ();$db->query (INSERT into Access (approving_id, access) VALUES ($insertId,$access)");//notification [email protected] approval$to= ' [email protected] ';$subject= "Please approve$title";$body= "$details\n<a href=\ "approve.php?access=$access\ "> Quick approval Links </a>";include__dir__. '/lib/mail.php ';$mail=New Mail();$mail->addto ($to);$mail->setsubject ($subject);$mail->setbodyhtml (NL2BR($body));$mail-send ();Header(' Location:success.php ');
See here, you probably see. After the user logs in, submit a form, fill in the boss to approve what things and detailed description, the program received the submission of data, in addition to the approval items stored in the approving table, but also generated an access, sent to the boss, It should be boss in the mail click on the "Quick approval link" do not need to log in to the system to directly approve the matter. Then you find the code for approving.php:
<?PHPinclude__dir__. '/conndb.php ';$access=$_get[' Access '];$row=$db->query ("Select approving_id from Access WHERE access = '$access‘");if(!$row) { die(' No such access ');}$approvingId=$row[' approving_id '];$approvingRow=$db->query ("SELECT * from approving WHERE approving_id =$approvingId");Echo' $approvingRow[' title '], ' ;Echo' <p> detailed description:</p> ';Echo' <p> ',NL2BR($approvingRow[' Details ']), ' </p> ';Echo"<a href=\" pass.php?access=$access\ "> Through </a>";Echo"<a href=\" deny.php?access=$access\ "> Reject </a>";
Review The above three sections of code , point out problems in the code .
4. After you look through the most of the code, you find that there is a todo in it that is not yet complete.
//TODO: if it's two days. boss not yet approved , then the system sends another e-mail, please . .
How does this come true? ?
Advanced Questions
What are some of the most proud?
Have you ever practiced PHP coding specifications?
How to do quality control?
How do I test?
What is the function of the JS namespace?
Have you ever used jslint?
Have you ever written jquery plugin?
How long has Linux been used?
Common tools: Vim, grep, sed awk, wget, curl
What shell scripts have you written?
Have you done server management?
What is the maximum number of rows that are exposed to the MySQL database table?
What kind of storage engine is used?
How does a performance bottleneck locate the solution?
What is the difference between MyISAM and InnoDB indexes? What is the difference between InnoDB's primary index and secondary index?
Do you have a 300W resume working experience and education background? How to extract a school/professional/company from it?
How to get started with a new framework?
------------------------------------------------------------------------------------
Why did I update my face question?
Recruit research and development must real deal on the code, I did encounter some interview to answer the question is also good, a code to make people headache engineer.
So there are two levels of hiring:
1) Expect the interviewer to enter the job, the code written out, a day or two can be published to the online. (corresponding to the basic problem)
2) understand the breadth and depth of the interviewer's knowledge of programming. (corresponding to advanced questions)
Analysis of basic problems
1. In the process of building lamp environment, be sure to put the wrong alarm all open (after installing the Xdebug, the error alarm will be more conspicuous, track_errors is also very useful ...)
2. Virtual host is provided
3. Code Review.
First, these three pieces of code are missing permission judgments.
The problem with the 2nd piece of code:
1) There is no validation of the submitted data.
If the title field is not submitted, $_post[' title ' will be reported undefined index
If Title,details is empty, or if it is too long, there will be problems.
2) Database Operations section with SQL injection
An issue that requires consideration of a transaction when a single operation involves multiple tables
The problem with the 3rd piece of code:
1) Data validation
2) SQL injection
3) XSS
4. Write a PHP program that runs in the CLI and then put it into cronjob.
Familiar with the CLI environment is still needed, let a newcomer understand that the data is not necessarily from the table he wrote Dropdowns submitted, it is very laborious.
------------------------------------------------------------------------------------
I think that if a candidate can have their own practical experience on the following questions about LMAPJ (J-Reference JavaScript) or can propose a solution, they can be considered for hire. The following are just some of the most recent thoughts that may not be reasonable, but I would be happy to work with people who can clearly answer the following questions.
======================================
= = PHP = =
# Coding Specifications
What coding specifications did you use in previous projects?
# Regular
How familiar are you with the regular? Ever used in a previous project? Where is it used? Did you write it yourself, or did you find it on the Internet?
The following is an Apache access log from which to take out the site name visited, visitor IP (<del> access time, access page, visitor's client </del>)
http://www. fake.com:80 157.55.16.231--[25/dec/2011:06:44:08 +0800] "get/robots.txt http/1.1" 394 "-" "mozilla/5.0 (compatible; bingbot/2.0; +meet our crawlers) "
http/site1.fake.com:80 61.175.193.51--[25/dec/2011:07:02:28 +0800] "get/home/list http/1.0" 302 399 "http://www. a.com/ "" Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; trident/4.0; SLCC2;. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729; MASN) "
http/site2.fake.com:80 61.237.230.38--[25/dec/2011:09:55:55 +0800] "get/blog/archive/?year=2010 http/1.1" 8467 "-" "mozilla/4.0 (Compatib Le MSIE 7.0; Windows NT 6.1; trident/4.0; SLCC2;. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729; Media Center PC 6.0; CIBA; Tablet PC 2.0; infopath.3; MS-RTC LM 8; 360SE) "
# Have you ever developed a CLI program for PHP?
# Which of the things you do you think you're very NB?
# What are some good books to recommend?
# # Book List
= = Javascript = =
# How do you contact and learn JS?
# in the team, what mechanisms are used to resolve naming conflicts?
# What are the ways to ensure code quality?
Do you know jslint? Have you used it? How long has it been? How to combine with the daily development work?
# is jquery ripe? Did you write a plugin for jquery?
# What are some good books to recommend?
# # Book List
> JS Language essence
> [JavaScript Advanced Programming (2nd Edition)]. (US) Zecas
> High Performance Javascript-nicholas C. Zakas
= = Linux = =
# Linux cooked? How long have you been using it?
# Common tools: Vim,grep,sed,awk,wget,curl ... Are you familiar?
# Have you ever written a shell script?
# Have you managed a server?
# What are some good books to recommend?
# # Book List
> [sed and awk (second Edition)]. Doherty, (US) Robbins
= = Apache = =
# will the virtual host be configured? Are there several configuration methods? (IP-based, port-based, domain-based, mixed)
# How is the browser cache used? (mod expires)
= = MySQL = =
# How big is the largest MySQL database table you have access to? (What is the approximate number of rows of records?)
# What kind of storage engine is used (MyISAM, InnoDB, ...)
# How is the performance bottleneck resolved?
# have you created an index yourself? How did you decide to create an index on some columns?
# is there a clear distinction between MyISAM and InnoDB about the index? Is there a difference between MyISAM's primary key index and other indexes? Is there a difference between InnoDB's primary key index and other indexes?
# What are some good books to recommend?
# # Book List
> [MySQL technology insider InnoDB Storage engine]. Kang
> [High-Performance MySQL (2nd edition) Chinese version]. Schwartz
= = Other = =
# What about data structures and algorithms? Do you think it's useful? Where is the good book to recommend?
# In addition to PHP, which language is your strengths, can be used in production?
# Do you have any interesting projects in your spare parts?
# Do you have a good technical blog to recommend?
> Snow-laruence Blog
> Cool Shell –coolshell.cn
> Hacker Blog | Hacker's social etiquette and self-cultivation
# CSDN User name password leaked out a batch, there is more than 643W (its format is username # password # email), and now want to lead it into the database, you have what way?
Transfer from http://www.zhihu.com/question/19757909 (He Guangyu)
Go What questions can the PHP interview ask to accurately reflect the level of development of the candidate?