وبلاگ بلیان

Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5)

معرفی کتاب «Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5)» نوشتهٔ Robin Nixon, Robin Nixon، منتشرشده توسط نشر O'Reilly Media; O'Reilly Media در سال 2014. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5)» در دستهٔ بدون دسته‌بندی قرار دارد.

Annotation Build interactive, data-driven websites with the potent combination of open-source technologies and web standards, even if you have only basic HTML knowledge. With this popular hands-on guide, youll tackle dynamic web programming with the help of todays core technologies: PHP, MySQL, JavaScript, jQuery, CSS, and HTML5. Explore each technology separately, learn how to use them together, and pick up valuable web programming practices along the way. At the end of the book, youll put everything together to build a fully functional social networking site, using XAMPP or any development stack you choose. Learn PHP in-depth, along with the basics of object-oriented programmingExplore MySQL, from database structure to complex queriesUse the MySQLi Extension, PHPs improved MySQL interfaceCreate dynamic PHP web pages that tailor themselves to the userManage cookies and sessions, and maintain a high level of securityMaster the JavaScript languageand enhance it with jQueryUse Ajax calls for background browser/server communicationAcquire CSS2 and CSS3 skills for professionally styling your web pagesImplement all of the new HTML5 features, including geolocation, audio, video, and the canvas Table of Contents 7 Preface 25 Audience 25 Assumptions This Book Makes 25 Organization of This Book 26 Supporting Books 26 Conventions Used in This Book 27 Using Code Examples 27 Safari® Books Online 28 How to Contact Us 29 Acknowledgments 29 Chapter 1. Introduction to Dynamic Web Content 31 HTTP and HTML: Berners-Lee’s Basics 32 The Request/Response Procedure 32 The Benefits of PHP, MySQL, JavaScript, CSS, and HTML5 35 Using PHP 36 Using MySQL 37 Using JavaScript 38 Using CSS 39 And Then There’s HTML5 40 The Apache Web Server 41 About Open Source 42 Bringing It All Together 42 Questions 44 Chapter 2. Setting Up a Development Server 45 What Is a WAMP, MAMP, or LAMP? 46 Installing XAMPP on Windows 46 Testing the Installation 54 Installing XAMPP on Mac OS X 57 Accessing the Document Root 57 Installing a LAMP on Linux 58 Working Remotely 58 Logging In 58 Using FTP 59 Using a Program Editor 60 Using an IDE 61 Questions 63 Chapter 3. Introduction to PHP 65 Incorporating PHP Within HTML 65 This Book’s Examples 67 The Structure of PHP 68 Using Comments 68 Basic Syntax 69 Variables 70 Operators 75 Variable Assignment 78 Multiple-Line Commands 80 Variable Typing 82 Constants 83 Predefined Constants 84 The Difference Between the echo and print Commands 85 Functions 85 Variable Scope 86 Questions 92 Chapter 4. Expressions and Control Flow in PHP 93 Expressions 93 TRUE or FALSE? 93 Literals and Variables 95 Operators 96 Operator Precedence 97 Associativity 99 Relational Operators 100 Conditionals 104 The if Statement 105 The else Statement 106 The elseif Statement 108 The switch Statement 109 The ? Operator 112 Looping 113 while Loops 114 do...while Loops 116 for Loops 116 Breaking Out of a Loop 118 The continue Statement 119 Implicit and Explicit Casting 120 PHP Dynamic Linking 121 Dynamic Linking in Action 122 Questions 123 Chapter 5. PHP Functions and Objects 125 PHP Functions 126 Defining a Function 128 Returning a Value 128 Returning an Array 130 Do Not Pass Arguments by Reference 130 Returning Global Variables 132 Recap of Variable Scope 133 Including and Requiring Files 133 The include Statement 134 Using include_once 134 Using require and require_once 135 PHP Version Compatibility 135 PHP Objects 136 Terminology 136 Declaring a Class 137 Creating an Object 138 Accessing Objects 139 Cloning Objects 140 Constructors 141 PHP 5 Destructors 142 Writing Methods 142 Static Methods in PHP 5 143 Declaring Properties 144 Declaring Constants 145 Property and Method Scope in PHP 5 145 Static Properties and Methods 146 Inheritance 148 Questions 151 Chapter 6. PHP Arrays 153 Basic Access 153 Numerically Indexed Arrays 153 Associative Arrays 155 Assignment Using the array Keyword 156 The foreach...as Loop 157 Multidimensional Arrays 159 Using Array Functions 162 is_array 162 count 162 sort 163 shuffle 163 explode 163 extract 164 compact 165 reset 166 end 166 Questions 167 Chapter 7. Practical PHP 169 Using printf 169 Precision Setting 170 String Padding 172 Using sprintf 173 Date and Time Functions 173 Date Constants 176 Using checkdate 176 File Handling 177 Checking Whether a File Exists 177 Creating a File 177 Reading from Files 179 Copying Files 180 Moving a File 180 Deleting a File 181 Updating Files 181 Locking Files for Multiple Accesses 182 Reading an Entire File 184 Uploading Files 185 System Calls 190 XHTML or HTML5? 192 Questions 192 Chapter 8. Introduction to MySQL 195 MySQL Basics 195 Summary of Database Terms 196 Accessing MySQL via the Command Line 196 Starting the Command-Line Interface 197 Using the Command-Line Interface 201 MySQL Commands 202 Data Types 207 Indexes 216 Creating an Index 216 Querying a MySQL Database 222 Joining Tables Together 232 Using Logical Operators 234 MySQL Functions 234 Accessing MySQL via phpMyAdmin 235 Questions 236 Chapter 9. Mastering MySQL 239 Database Design 239 Primary Keys: The Keys to Relational Databases 240 Normalization 241 First Normal Form 242 Second Normal Form 244 Third Normal Form 247 When Not to Use Normalization 249 Relationships 249 One-to-One 249 One-to-Many 250 Many-to-Many 251 Databases and Anonymity 252 Transactions 253 Transaction Storage Engines 253 Using BEGIN 254 Using COMMIT 255 Using ROLLBACK 255 Using EXPLAIN 256 Backing Up and Restoring 257 Using mysqldump 257 Creating a Backup File 259 Restoring from a Backup File 261 Dumping Data in CSV Format 261 Planning Your Backups 262 Questions 262 Chapter 10. Accessing MySQL Using PHP 263 Querying a MySQL Database with PHP 263 The Process 263 Creating a Login File 264 Connecting to a MySQL Database 265 A Practical Example 270 The $_POST Array 273 Deleting a Record 274 Displaying the Form 275 Querying the Database 276 Running the Program 277 Practical MySQL 278 Creating a Table 278 Describing a Table 279 Dropping a Table 280 Adding Data 280 Retrieving Data 281 Updating Data 281 Deleting Data 282 Using AUTO_INCREMENT 282 Performing Additional Queries 284 Preventing Hacking Attempts 285 Steps You Can Take 286 Using Placeholders 287 Preventing HTML Injection 289 Using mysqli Procedurally 291 Questions 293 Chapter 11. Form Handling 295 Building Forms 295 Retrieving Submitted Data 297 register_globals: An Old Solution Hangs On 298 Default Values 299 Input Types 300 Sanitizing Input 307 An Example Program 309 What’s New in HTML5? 311 The autocomplete Attribute 312 The autofocus Attribute 312 The placeholder Attribute 312 The required Attribute 312 Override Attributes 313 The width and height Attributes 313 Features Awaiting Full Implementation 313 The form Attribute 313 The list Attribute 314 The min and max Attributes 314 The step Attribute 314 The color Input Type 315 The number and range Input Types 315 Date and Time Pickers 315 Questions 315 Chapter 12. Cookies, Sessions, and Authentication 317 Using Cookies in PHP 317 Setting a Cookie 319 Accessing a Cookie 320 Destroying a Cookie 320 HTTP Authentication 320 Storing Usernames and Passwords 324 Salting 324 Using Sessions 328 Starting a Session 329 Ending a Session 332 Setting a Time-Out 333 Session Security 333 Questions 337 Chapter 13. Exploring JavaScript 339 JavaScript and HTML Text 340 Using Scripts Within a Document Head 341 Older and Nonstandard Browsers 341 Including JavaScript Files 342 Debugging JavaScript Errors 343 Using Comments 345 Semicolons 345 Variables 346 String Variables 346 Numeric Variables 347 Arrays 347 Operators 348 Arithmetic Operators 348 Assignment Operators 348 Comparison Operators 349 Logical Operators 349 Variable Incrementing and Decrementing 350 String Concatenation 350 Escaping Characters 350 Variable Typing 351 Functions 352 Global Variables 352 Local Variables 353 The Document Object Model 354 But It’s Not That Simple 356 Using the DOM 357 About document.write 358 Using console.log 358 Using alert 358 Writing into Elements 359 Using document.write 359 Questions 359 Chapter 14. Expressions and Control Flow in JavaScript 361 Expressions 361 Literals and Variables 362 Operators 363 Operator Precedence 364 Associativity 364 Relational Operators 365 The with Statement 368 Using onerror 369 Using try...catch 370 Conditionals 371 The if Statement 371 The else Statement 371 The switch Statement 372 The ? Operator 374 Looping 374 while Loops 374 do...while Loops 375 for Loops 376 Breaking Out of a Loop 376 The continue Statement 377 Explicit Casting 378 Questions 378 Chapter 15. JavaScript Functions, Objects, and Arrays 381 JavaScript Functions 381 Defining a Function 381 Returning a Value 383 Returning an Array 385 JavaScript Objects 386 Declaring a Class 386 Creating an Object 387 Accessing Objects 388 The prototype Keyword 388 JavaScript Arrays 391 Numeric Arrays 391 Associative Arrays 392 Multidimensional Arrays 393 Using Array Methods 394 Questions 399 Chapter 16. JavaScript and PHP Validation and Error Handling 401 Validating User Input with JavaScript 401 The validate.html Document (Part 1) 402 The validate.html Document (Part 2) 404 Regular Expressions 407 Matching Through Metacharacters 408 Fuzzy Character Matching 408 Grouping Through Parentheses 409 Character Classes 410 Indicating a Range 410 Negation 410 Some More-Complicated Examples 411 Summary of Metacharacters 413 General Modifiers 415 Using Regular Expressions in JavaScript 416 Using Regular Expressions in PHP 416 Redisplaying a Form After PHP Validation 417 Questions 423 Chapter 17. Using Ajax 425 What Is Ajax? 425 Using XMLHttpRequest 426 Your First Ajax Program 428 Using Get Instead of Post 433 Sending XML Requests 436 Using Frameworks for Ajax 441 Questions 441 Chapter 18. Introduction to CSS 443 Importing a Style Sheet 444 Importing CSS from Within HTML 444 Embedded Style Settings 445 Using IDs 445 Using Classes 445 Using Semicolons 446 CSS Rules 446 Multiple Assignments 446 Using Comments 447 Style Types 448 Default Styles 448 User Styles 448 External Style Sheets 449 Internal Styles 449 Inline Styles 450 CSS Selectors 450 The Type Selector 450 The Descendant Selector 450 The Child Selector 451 The ID Selector 452 The Class Selector 453 The Attribute Selector 453 The Universal Selector 454 Selecting by Group 455 The CSS Cascade 455 Style Sheet Creators 456 Style Sheet Methods 456 Style Sheet Selectors 456 Calculating Specificity 457 The Difference Between Div and Span Elements 459 Measurements 461 Fonts and Typography 462 font-family 463 font-style 463 font-size 464 font-weight 464 Managing Text Styles 465 Decoration 465 Spacing 465 Alignment 466 Transformation 466 Indenting 466 CSS Colors 467 Short Color Strings 468 Gradients 468 Positioning Elements 469 Absolute Positioning 470 Relative Positioning 470 Fixed Positioning 470 Pseudoclasses 472 Shorthand Rules 474 The Box Model and Layout 475 Setting Margins 475 Applying Borders 477 Adjusting Padding 478 Object Contents 480 Questions 480 Chapter 19. Advanced CSS with CSS3 481 Attribute Selectors 481 Matching Parts of Strings 482 The box-sizing Property 483 CSS3 Backgrounds 483 The background-clip Property 484 The background-origin Property 486 The background-size Property 486 Using the auto Value 487 Multiple Backgrounds 487 CSS3 Borders 489 The border-color Property 489 The border-radius Property 489 Box Shadows 492 Element Overflow 493 Multicolumn Layout 493 Colors and Opacity 495 HSL Colors 495 HSLA Colors 496 RGB Colors 496 RGBA Colors 497 The opacity Property 497 Text Effects 497 The text-shadow Property 497 The text-overflow Property 498 The word-wrap Property 499 Web Fonts 499 Google Web Fonts 500 Transformations 502 3D Transformations 503 Transitions 504 Properties to Transition 504 Transition Duration 505 Transition Delay 505 Transition Timing 505 Shorthand Syntax 506 Questions 507 Chapter 20. Accessing CSS from JavaScript 509 Revisiting the getElementById Function 509 The O function 509 The S Function 510 The C Function 511 Including the Functions 512 Accessing CSS Properties from JavaScript 512 Some Common Properties 513 Other Properties 514 Inline JavaScript 516 The this Keyword 516 Attaching Events to Objects in a Script 517 Attaching to Other Events 518 Adding New Elements 519 Removing Elements 520 Alternatives to Adding and Removing Elements 521 Using Interrupts 522 Using setTimeout 522 Cancelling a Time-Out 523 Using setInterval 523 Using Interrupts for Animation 525 Questions 527 Chapter 21. Introduction to jQuery 529 Why jQuery? 530 Including jQuery 530 Choosing the Right Version 530 Downloading 531 Using a Content Delivery Network 532 Always Using the Latest Version 533 Customizing jQuery 533 jQuery Syntax 533 A Simple Example 534 Avoiding Library Conflict 535 Selectors 535 The css Method 536 The Element Selector 536 The ID Selector 537 The Class Selector 537 Combining Selectors 537 Handling Events 538 Waiting Until the Document Is Ready 539 Event Functions and Properties 540 The blur and focus Events 541 The this Keyword 542 The click and dblclick Events 542 The keypress Event 543 Considerate Programming 545 The mousemove Event 545 Other Mouse Events 548 Alternative Mouse Methods 549 The submit Event 550 Special Effects 551 Hiding and Showing 552 The toggle Method 553 Fading In and Out 554 Sliding Elements Up and Down 555 Animations 556 Stopping Animations 559 Manipulating the DOM 560 The Difference Between The text and html Methods 561 The val and attr Methods 561 Adding and Removing Elements 563 Dynamically Applying Classes 565 Modifying Dimensions 565 The width and height Methods 566 The innerWidth and innerHeight Methods 568 The outerWidth and OuterHeight Methods 568 DOM Traversal 569 Parent Elements 569 Child Elements 573 Sibling Elements 573 Selecting the Next and Previous Elements 575 Traversing jQuery Selections 576 The is Method 578 Using jQuery Without Selectors 579 The $.each Method 580 The $.map Method 581 Using Ajax 581 Using the Post Method 581 Using the Get Method 582 Plug-Ins 583 The jQuery User Interface 583 Other Plug-Ins 583 jQuery Mobile 584 Questions 585 Chapter 22. Introduction to HTML5 587 The Canvas 588 Geolocation 589 Audio and Video 591 Forms 592 Local Storage 593 Web Workers 593 Web Applications 593 Microdata 594 Summary 594 Questions 594 Chapter 23. The HTML5 Canvas 595 Creating and Accessing a Canvas 595 The toDataURL Function 597 Specifying an Image Type 599 The fillRect Method 599 The clearRect Method 599 The strokeRect Method 600 Combining These Commands 600 The createLinearGradient Method 601 The addColorStop Method in Detail 603 The createRadialGradient Method 604 Using Patterns for Fills 606 Writing Text to the Canvas 608 The strokeText Method 608 The textBaseLine Property 609 The font Property 609 The textAlign Property 609 The fillText Method 610 The measureText Method 611 Drawing Lines 611 The lineWidth Property 611 The lineCap and lineJoin Properties 611 The miterLimit Property 614 Using Paths 614 The moveTo and LineTo Methods 614 The stroke Method 615 The rect Method 615 Filling Areas 616 The clip Method 617 The isPointInPath Method 620 Working with Curves 621 The arc Method 621 The arcTo Method 624 The quadraticCurveTo Method 625 The bezierCurveTo Method 626 Manipulating Images 627 The drawImage Method 627 Resizing an Image 628 Selecting an Image Area 628 Copying from a Canvas 630 Adding Shadows 630 Editing at the Pixel Level 632 The getImageData Method 632 The data Array 633 The putImageData Method 635 The createImageData Method 635 Advanced Graphical Effects 636 The globalCompositeOperation Property 636 The globalAlpha Property 639 Transformations 639 The scale Method 639 The save and restore Methods 640 The rotate Method 641 The translate Method 642 The transform Method 643 The setTransform Method 645 Summary 645 Questions 646 Chapter 24. HTML5 Audio and Video 647 About Codecs 648 The Element 649 Supporting Non-HTML5 Browsers 651 The Element 653 The Video Codecs 653 Supporting Older Browsers 657 Summary 659 Questions 659 Chapter 25. Other HTML5 Features 661 Geolocation and the GPS Service 661 Other Location Methods 662 Geolocation and HTML5 662 Local Storage 666 Using Local Storage 667 The localStorage Object 667 Web Workers 669 Offline Web Applications 671 Drag and Drop 673 Cross-Document Messaging 675 Microdata 678 Other HTML5 Tags 681 Summary 682 Questions 682 Chapter 26. Bringing It All Together 683 Designing a Social Networking Site 683 On the Website 684 functions.php 684 The Functions 684 header.php 686 setup.php 688 index.php 690 signup.php 691 Checking for Username Availability 691 Logging In 692 checkuser.php 695 login.php 695 profile.php 697 Adding the “About Me” Text 698 Adding a Profile Image 698 Processing the Image 698 Displaying the Current Profile 699 members.php 702 Viewing a User’s Profile 702 Adding and Dropping Friends 702 Listing All Members 702 friends.php 705 messages.php 708 logout.php 711 styles.css 712 javascript.js 715 Appendix A. Solutions to the Chapter Questions 717 Chapter 1 Answers 717 Chapter 2 Answers 718 Chapter 3 Answers 718 Chapter 4 Answers 719 Chapter 5 Answers 720 Chapter 6 Answers 721 Chapter 7 Answers 721 Chapter 8 Answers 722 Chapter 9 Answers 723 Chapter 10 Answers 724 Chapter 11 Answers 725 Chapter 12 Answers 725 Chapter 13 Answers 726 Chapter 14 Answers 727 Chapter 15 Answers 728 Chapter 16 Answers 728 Chapter 17 Answers 729 Chapter 18 Answers 730 Chapter 19 Answers 731 Chapter 20 Answers 732 Chapter 21 Answers 733 Chapter 22 Answers 733 Chapter 23 Answers 734 Chapter 24 Answers 735 Chapter 25 Answers 735 Appendix B. Online Resources 737 PHP Resource Sites 737 MySQL Resource Sites 738 JavaScript Resource Sites 738 CSS Resource Sites 738 HTML5 Resource Sites 738 AJAX Resource Sites 739 Miscellaneous Resource Sites 739 O’Reilly Resource Sites 740 Appendix C. MySQL’s FULLTEXT Stopwords 741 Appendix D. MySQL Functions 745 String Functions 745 Date Functions 748 Time Functions 753 Appendix E. jQuery Selectors, Objects, and Methods 755 jQuery Selectors 755 jQuery Objects 759 jQuery Methods 761 Index 777 About the Author 805 www.it-ebooks.info Learning PHP, MySQL & JavaScript will teach you how to create responsive, data-driven websites with the three central technologies of PHP, MySQL and JavaScript - whether or not you know how to program. This simple, streamlined guide explains how the powerful combination of PHP and MySQL provides a painless way to build modern websites with dynamic data and user interaction. You'll also learn how to add JavaScript to create rich Internet websites and applications, and how to use Ajax to handle background communication with a web server. This book explains each technology separately, shows you how to combine them, and introduces valuable concepts in modern web programming, including objects, XHTML, cookies, regular expressions and session management.
دانلود کتاب Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning Php, Mysql, Javascript, Css & Html5)