Postado Novembro 29, 2012 12 anos Olá. Vejo que alguns por ainda têm dúvidas com questões de sites em PHP e problemas nos bancos MySQL, principalmente quando utilizados para Otservers. Trago este livro da minha "biblioteca de pdfs" ( ) por ser um excelente livro para aprender todo o conteúdo necessário para dar início na linguagem PHP e sua utilização com bancos MySQL. Este livro foi, o qual mais aprendi PHP e pude dar início ao desenvolvimento nesta linguagem, e com muita facilidade. Sumário do Livro: Introduction: ix What Are Dynamic Web Sites? . . . . . . . . . . . . . . . . x What You’ll Need . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Companion Web Site . . . . . . . . . . . . . . . . . . . . . . . . xix Chapter 1: Introduction to PHP Basic Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Sending Data to the Web Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Writing Comments . . . . . . . . . . . . . . . . . . . . . . . . . . 10 What Are Variables? . . . . . . . . . . . . . . . . . . . . . . . . . 14 Introducing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Concatenating Strings . . . . . . . . . . . . . . . . . . . . . . . 21 Introducing Numbers . . . . . . . . . . . . . . . . . . . . . . . . 23 Introducing Constants . . . . . . . . . . . . . . . . . . . . . . . 27 Single vs. Double Quotation Marks . . . . . . . . . . . . 30 Chapter 2: Programming with PHP Creating an HTML Form . . . . . . . . . . . . . . . . . . . . . 34 Handling an HTML Form . . . . . . . . . . . . . . . . . . . . 38 Conditionals and Operators . . . . . . . . . . . . . . . . . . 42 Validating Form Data . . . . . . . . . . . . . . . . . . . . . . . . 46 Introducing Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 52 For and While Loops . . . . . . . . . . . . . . . . . . . . . . . . 70 Chapter 3: Creating Dynamic Web Sites Including Multiple Files . . . . . . . . . . . . . . . . . . . . . . 74 Handling HTML Forms, Revisited . . . . . . . . . . . . . 84 Making Sticky Forms . . . . . . . . . . . . . . . . . . . . . . . . 89 Creating Your Own Functions . . . . . . . . . . . . . . . . 92 Chapter 4: Introduction to MySQL Naming Database Elements . . . . . . . . . . . . . . . . . 108 Choosing Your Column Types . . . . . . . . . . . . . . . 110 Choosing Other Column Properties . . . . . . . . . . 114 Accessing MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . 116 v Table of Contents Table of Contents Chapter 5: Introduction to SQL Creating Databases and Tables . . . . . . . . . . . . . . . 124 Inserting Records . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Selecting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Using Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . 133 Using LIKE and NOT LIKE . . . . . . . . . . . . . . . . . . 136 Sorting Query Results . . . . . . . . . . . . . . . . . . . . . . . 138 Limiting Query Results . . . . . . . . . . . . . . . . . . . . . 140 Updating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Deleting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Chapter 6: Advanced SQL and MySQL Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 Performing Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Grouping Selected Results . . . . . . . . . . . . . . . . . . . 178 Creating Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 Using Different Table Types . . . . . . . . . . . . . . . . . 185 Performing FULLTEXT Searches . . . . . . . . . . . . 188 Performing Transactions . . . . . . . . . . . . . . . . . . . . 194 Chapter 7: Error Handling and Debugging Error Types and Basic Debugging . . . . . . . . . . . . 200 Displaying PHP Errors . . . . . . . . . . . . . . . . . . . . . . 206 Adjusting Error Reporting in PHP . . . . . . . . . . . . 208 Creating Custom Error Handlers . . . . . . . . . . . . . 211 PHP Debugging Techniques . . . . . . . . . . . . . . . . . 216 SQL and MySQL Debugging Techniques . . . . . . 220 Chapter 8: Using PHP with MySQL Modifying the Template . . . . . . . . . . . . . . . . . . . . . 224 Connecting to MySQL . . . . . . . . . . . . . . . . . . . . . . 226 Executing Simple Queries . . . . . . . . . . . . . . . . . . . 230 Retrieving Query Results . . . . . . . . . . . . . . . . . . . . 239 Ensuring Secure SQL . . . . . . . . . . . . . . . . . . . . . . . 243 Counting Returned Records . . . . . . . . . . . . . . . . . 249 Updating Records with PHP . . . . . . . . . . . . . . . . . 251 Chapter 9: Common Programming Techniques Sending Values to a Script . . . . . . . . . . . . . . . . . . . 260 Using Hidden Form Inputs . . . . . . . . . . . . . . . . . . 264 Editing Existing Records . . . . . . . . . . . . . . . . . . . . 270 Paginating Query Results . . . . . . . . . . . . . . . . . . . . 277 Making Sortable Displays . . . . . . . . . . . . . . . . . . . 285 vi Table of Contents Table of Contents Chapter 10: Web Application Development Sending Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Date and Time Functions . . . . . . . . . . . . . . . . . . . 298 Handling File Uploads . . . . . . . . . . . . . . . . . . . . . . 302 PHP and Javascript . . . . . . . . . . . . . . . . . . . . . . . . . 315 Understanding HTTP Headers . . . . . . . . . . . . . . . 322 Chapter 11: Cookies and Sessions Making a Login Page . . . . . . . . . . . . . . . . . . . . . . . 328 Making the Login Functions . . . . . . . . . . . . . . . . 331 Using Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 Using Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Improving Session Security . . . . . . . . . . . . . . . . . . 358 Chapter 12: Security Methods Preventing Spam . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 Validating Data by Type . . . . . . . . . . . . . . . . . . . . . 369 Preventing XSS Attacks . . . . . . . . . . . . . . . . . . . . . 374 Preventing SQL Injection Attacks . . . . . . . . . . . . 377 Database Encryption . . . . . . . . . . . . . . . . . . . . . . . 383 Chapter 13: Perl-Compatible Regular Expressions Creating a Test Script . . . . . . . . . . . . . . . . . . . . . . . 390 Defining Simple Patterns . . . . . . . . . . . . . . . . . . . . 394 Using Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 Using Character Classes . . . . . . . . . . . . . . . . . . . . . 400 Finding All Matches . . . . . . . . . . . . . . . . . . . . . . . . 403 Using Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 Matching and Replacing Patterns . . . . . . . . . . . . 409 Chapter 14: Making Universal Sites Character Sets and Encoding . . . . . . . . . . . . . . . . 414 Creating Multilingual Web Pages . . . . . . . . . . . . . 416 Unicode in PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 Collation in PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Transliteration in PHP . . . . . . . . . . . . . . . . . . . . . . 427 Languages and MySQL . . . . . . . . . . . . . . . . . . . . . 430 Time Zones and MySQL . . . . . . . . . . . . . . . . . . . . 434 Working with Locales . . . . . . . . . . . . . . . . . . . . . . . 437 vii Table of Contents Table of Contents Chapter 15: Example—Message Board Making the Database . . . . . . . . . . . . . . . . . . . . . . . 442 Writing the Templates . . . . . . . . . . . . . . . . . . . . . . 451 Creating the Index Page . . . . . . . . . . . . . . . . . . . . . 460 Creating the Forum Page . . . . . . . . . . . . . . . . . . . . 461 Creating the Thread Page . . . . . . . . . . . . . . . . . . . 466 Posting Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 Chapter 16: Example—User Registration Creating the Templates . . . . . . . . . . . . . . . . . . . . . 484 Writing the Configuration Scripts . . . . . . . . . . . . 490 Creating the Home Page . . . . . . . . . . . . . . . . . . . . 498 Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Activating an Account . . . . . . . . . . . . . . . . . . . . . . 509 Logging In and Logging Out . . . . . . . . . . . . . . . . . 513 Password Management . . . . . . . . . . . . . . . . . . . . . 519 Chapter 17: Example—E-Commerce Creating the Database . . . . . . . . . . . . . . . . . . . . . . 530 The Administrative Side . . . . . . . . . . . . . . . . . . . . 536 Creating the Public Template . . . . . . . . . . . . . . . . 553 The Product Catalog . . . . . . . . . . . . . . . . . . . . . . . . 557 The Shopping Cart . . . . . . . . . . . . . . . . . . . . . . . . . 569 Recording the Orders . . . . . . . . . . . . . . . . . . . . . . . 579 Link para download: http://d01.megashares.com/dl/X9p9Gb7/p6am5fdws.pdf Link para download dos exemplos de cada capítulo: http://d01.megashares.com/dl/Ljddnjo/bookscripts.rar Aproveitem! PS: Sim, o livro está em Inglês, porém não é utilizado nenhum vocabulário rebuscado, se tornando fácil de entender até pelos exemplos. Acho que vale o esforço para quem consegue ler algumas palavras em Inglês. Editado Janeiro 20, 2013 12 anos por Flamer (veja o histórico de edições)
Postado Novembro 29, 2012 12 anos Muito obrigado pela contribuição Ramon, nas minhas férias vou dar uma lida, ver se aprendo MESMO php
Postado Novembro 29, 2012 12 anos Irei ler o livro todo. Estava estudando pelo w3...só que lá as coisas são muito "superficiais"
Postado Novembro 29, 2012 12 anos Autor Muito obrigado pela contribuição Ramon, nas minhas férias vou dar uma lida, ver se aprendo MESMO php De nada! A leitura do livro é bastante facilitada com os exemplos, deixando de ser uma coisa monótona com muita parte teórica como costumam ser alguns. Por isso acabei lendo-o muito mais rápido do que imaginava. Espero que goste Adicionei o link para os exemplos de cada capítulo no post inicial. Editado Novembro 29, 2012 12 anos por Flamer (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.