Jump to content

birbal

Members
  • Posts

    2,543
  • Joined

  • Last visited

Posts posted by birbal

  1. you need hash the password when you check for user credential ,in same way as you did the time of the registration. $password and md5($password) is not same. now the password is store as hashed of $password. BTW MD5 is not secure anymore you may like to check other alorithms like blowfish,whirlpool.

  2. when any site try to open your site it will get the html structure of the site. it will get the iframe literaly (html code), it wont get the iframe source automatically like browsers do , thus it wont make request the increase counter. But as already being said there is no full proof way to stop it. anyone can study your site structure and figure it out which iframe or img tag is making request and then can parse the source and make request to the source. As already being suggested it will be best way to keep track of IPs to figure out the unique users.

  3. It is not possible to have same email account for two user so if a user is already registered ans same credential is used to registered again you would ask them for "forgot password" instead of let them register again. even if you use nick as credential you would not want to have same name for two user that would be an identity problem. To avoid that you can set those as unique or primary key constraint.You dont have to check for existance of credential you can use normal INSERT if it is violating any constraint it would throw error. You can catch those error code (Each error type have different error code, see mysql error code page) to detect primary key/unique index violation and show user a error message. If you have more than one primary key or unique column which could be violated in the process of registration you could even parse the error message to detect the column name which is being violated. Error message in mysql follows one specific syntax eg "Some violation is occured in %s column". It would not be hard to catch those column name using regex or by any other way.

  4. you have to do it manually InnoDB does not know which id from parent table you are trying to referenced in child table. Though InnoDB will ensure every time that the id you have passed in child table have a reference of it in parent table.

  5. You can use cURL to fetch a page in web or you can even use domDocument to parse html files. But you need to cache the result, otherwise if you try to fetch multiple site on each request and update your page , your page will be slow. But as download counter is so dynamic it wont be much benificial to cache the data if you want something in real time.

  6. Though connection will be closed at the end of the script it is efficient and good practice to close the connection when you dont need it. if you have quite large processing php file which takes some time to process could make alive the connection. in traffic heavy site which could hit the connection limit provided by shared host.

  7. One part of PHP tend to make messier code than java counter part, is lack of function overloading. As PHP is loosly typed language so that it has not any method signature so overloading a function is not possible technically. (PHP has method overloading but it is conceptualy far away than c++/java overloading). Still you can make a function act in multiple way like checking the parameters and act upon it. but as the polymorphic feature of a function grows its become tedious to maintain. though it is possible to encapsulate the behaviour in seperate methods and call the methods depends on parameter condition. But it looses its polymorphic features (one name different behaviour). you need to modify the calling function as well as encapsulated function. Where as in java you can use same name of method with different signature to do different behaviour. all of the overloaded method then have one particular task at a time with same name. If you need to have do different task for same signature, probably there is something wrong and it needs a new method to handle the task. It is something unavoidable in php. Convenience comes at cost for loosly typed language.

  8. You need to set up table to store session data. you need to use session_set_save_handler() or sessionHandlerInterface to override default session handling. by default sessions are stored in files and they don't associate with any user id or time. you need to set up both refference to user id and timestamp so that you can get the logged in user list of certain time span.

  9. yes it may be non-beginer book but is not not either too advanced in the term of explanation of author. It did explained everything in depth and simpler way. I did not read the 'Beginer Javascript' book so i can hardly comment on that. If author is recommending this then probably it would be best suitable one for absolute beginer.. Though to quote the book

    This book is aimed at three groups of readers:Experienced developers familiar with object-oriented programming who are looking tolearn JavaScript as it relates to traditional OO languages such as Java and C++.Web application developers attempting to enhance the usability of their web sites and webapplications.Novice JavaScript developers aiming to better understand the language.In addition, familiarity with the following related technologies is a strong indicator that this book isfor you:JavaPHPASP.NETHTMLCSSXMLThis book is not aimed at beginners lacking a basic computer science background or those lookingto add some simple user interactions to web sites. These readers should instead refer to Wrox’sBeginning JavaScript, 4th Edition (Wiley, 2009).
  10. Every Programming languages almost capable of solving every problem. What you can do with php you can do it with java or any other programming language. Java is strictly Object oriented, as it is managed language the API of it consistent object oriented manner. One benifit with java is it is not limited to web programming. From the begining it is tend to evolve as OO language for multiple enviourment or platform. For example if you want to handle a file the api is same for applet,servlet,desktop (clientside) application,mobile application. Other than that java comes with lots of thing with core package which is very helpful. It is kind of one language for all purpose. It has larger scope and use context. Where as PHP was started as template engine which now evolves as OO language. The benifit with PHP is it is very convenient to use,it scales well, it has large community. Though recently PHP also coming up with GUI desktop development but the community is very little for now. I,myself fond of php and was using it past couple of years and i loved it alot. but recently i am leaning toward java. I have started with JAVA SE and doing some GUI stuff so i have not much knowledge of JSP (which comes withinh JAVA EE) itself for now. but soon i am going to catch it up. I had to do Java for my study and i am liking it. so if you are planing to go both desktop and web programming then going with Java would be good.You need to look into basic java se too to work with JSP. If you want to just start right away and/or only focused in web programming then php would be the good choice. Both language has similarity with c/c++

×
×
  • Create New...