100% found this document useful (7 votes)
19 views

Learning PHP MySQL JavaScript 4th Edition Robin Nixon instant download

The document provides information about the fourth edition of 'Learning PHP, MySQL & JavaScript' by Robin Nixon, which teaches readers to build interactive, data-driven websites using core technologies. It covers PHP, MySQL, JavaScript, jQuery, CSS, and HTML5, and includes practical examples and exercises. The book is designed for beginners and aims to equip them with the skills to create dynamic web applications.

Uploaded by

apuadahoraeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (7 votes)
19 views

Learning PHP MySQL JavaScript 4th Edition Robin Nixon instant download

The document provides information about the fourth edition of 'Learning PHP, MySQL & JavaScript' by Robin Nixon, which teaches readers to build interactive, data-driven websites using core technologies. It covers PHP, MySQL, JavaScript, jQuery, CSS, and HTML5, and includes practical examples and exercises. The book is designed for beginners and aims to equip them with the skills to create dynamic web applications.

Uploaded by

apuadahoraeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Learning PHP MySQL JavaScript 4th Edition Robin

Nixon pdf download

https://ebookname.com/product/learning-php-mysql-javascript-4th-
edition-robin-nixon/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Expert PHP and MySQL 1st Edition Andrew Curioso

https://ebookname.com/product/expert-php-and-mysql-1st-edition-
andrew-curioso/

Beginning PHP Apache MySQL web development Michael K.


Glass

https://ebookname.com/product/beginning-php-apache-mysql-web-
development-michael-k-glass/

PHP and MySQL Create Modify Reuse 1st Edition Timothy


Boronczyk

https://ebookname.com/product/php-and-mysql-create-modify-
reuse-1st-edition-timothy-boronczyk/

Chemical Structure and Reactivity An Integrated


Approach 1st Edition James Keeler

https://ebookname.com/product/chemical-structure-and-reactivity-
an-integrated-approach-1st-edition-james-keeler/
Adding It Up Helping Children Learn Mathematics 1st
Edition Mathematics Learning Study Committee

https://ebookname.com/product/adding-it-up-helping-children-
learn-mathematics-1st-edition-mathematics-learning-study-
committee/

Of Sand or Soil Genealogy and Tribal Belonging in Saudi


Arabia Princeton Studies in Muslim Politics Book 59
Samin

https://ebookname.com/product/of-sand-or-soil-genealogy-and-
tribal-belonging-in-saudi-arabia-princeton-studies-in-muslim-
politics-book-59-samin/

Aquanomics Water Markets and the Environment 1st


Edition Randy Simmons (Editor)

https://ebookname.com/product/aquanomics-water-markets-and-the-
environment-1st-edition-randy-simmons-editor/

BNF for Children 2011 2012 British National Formulary


for Children 1 Pap/Crds Edition Pharmaceutical Press

https://ebookname.com/product/bnf-for-children-2011-2012-british-
national-formulary-for-children-1-pap-crds-edition-
pharmaceutical-press/

The Atmosphere and Ocean A Physical Introduction Third


Edition Neil C. Wells(Auth.)

https://ebookname.com/product/the-atmosphere-and-ocean-a-
physical-introduction-third-edition-neil-c-wellsauth/
Structural Shielding Design for Medical X Ray Imaging
Facilities 1st Edition National Council On Radiation
Protection And Measurements

https://ebookname.com/product/structural-shielding-design-for-
medical-x-ray-imaging-facilities-1st-edition-national-council-on-
radiation-protection-and-measurements/
4t
h
wi
Ed jQue
th
Learning PHP, MySQL & JavaScript

iti r y
on
FOURTH EDITION
Build interactive, data-driven websites with the potent combination of
open-source technologies and web standards, even if you have only basic bookisthata great
“This beginner's
introduces 

MySQL & JavaScript


Learning PHP,
HTML knowledge. With this popular hands-on guide, you’ll tackle dynamic
web programming with the help of today’s core technologies: PHP, MySQL, several crucial web
JavaScript, jQuery, CSS, and HTML5. developer languages. 
Explore each technology separately, learn how to use them together, and It's a quick-paced, easy-
pick up valuable web programming practices along the way. At the end of to-read, information-
the book, you’ll put everything together to build a fully functional social packed book that will
networking site, using XAMPP or any development stack you choose.
soon have you creating
Learn PHP in-depth, along with the basics of object-oriented dynamically driven web-

Learning
■■
programming sites, including a basic
■■ Explore MySQL, from database structure to complex queries social networking site. ”

PHP, MySQL
■■ Use the MySQLi Extension, PHP’s improved MySQL interface —Albert Wiersch
developer of CSE HTML Validator
■■ Create dynamic PHP web pages that tailor themselves to
the user
■■ Manage cookies and sessions, and maintain a high level
of security

& JavaScript
■■ Master the JavaScript language—and enhance it with jQuery
■■ Use Ajax calls for background browser/server communication
■■ Acquire CSS2 & CSS3 skills for professionally styling your
web pages
■■ Implement all of the new HTML5 features, including
geolocation, audio, video, and the canvas
WITH JQUERY, CSS & HTML5
Robin Nixon, an IT journalist who has written hundreds of articles and several
books on computing, has developed numerous websites using open source tools,
specializing in the technologies featured in this book. Robin has worked with and
written about computers since the early 1980s.

WEB DEVELOPMENT
Twitter: @oreillymedia Nixon
facebook.com/oreilly
US $49.99 CAN $52.99
ISBN: 978-1-491-91866-1

Robin Nixon
4t
h
wi
Ed jQue
th
Learning PHP, MySQL & JavaScript

iti r y
on
FOURTH EDITION
Build interactive, data-driven websites with the potent combination of
open-source technologies and web standards, even if you have only basic bookisthata great
“This beginner's
introduces 

MySQL & JavaScript


Learning PHP,
HTML knowledge. With this popular hands-on guide, you’ll tackle dynamic
web programming with the help of today’s core technologies: PHP, MySQL, several crucial web
JavaScript, jQuery, CSS, and HTML5. developer languages. 
Explore each technology separately, learn how to use them together, and It's a quick-paced, easy-
pick up valuable web programming practices along the way. At the end of to-read, information-
the book, you’ll put everything together to build a fully functional social packed book that will
networking site, using XAMPP or any development stack you choose.
soon have you creating
Learn PHP in-depth, along with the basics of object-oriented dynamically driven web-

Learning
■■
programming sites, including a basic
■■ Explore MySQL, from database structure to complex queries social networking site. ”

PHP, MySQL
■■ Use the MySQLi Extension, PHP’s improved MySQL interface —Albert Wiersch
developer of CSE HTML Validator
■■ Create dynamic PHP web pages that tailor themselves to
the user
■■ Manage cookies and sessions, and maintain a high level
of security

& JavaScript
■■ Master the JavaScript language—and enhance it with jQuery
■■ Use Ajax calls for background browser/server communication
■■ Acquire CSS2 & CSS3 skills for professionally styling your
web pages
■■ Implement all of the new HTML5 features, including
geolocation, audio, video, and the canvas
WITH JQUERY, CSS & HTML5
Robin Nixon, an IT journalist who has written hundreds of articles and several
books on computing, has developed numerous websites using open source tools,
specializing in the technologies featured in this book. Robin has worked with and
written about computers since the early 1980s.

WEB DEVELOPMENT
Twitter: @oreillymedia Nixon
facebook.com/oreilly
US $49.99 CAN $52.99
ISBN: 978-1-491-91866-1

Robin Nixon
FOURTH EDITION

Learning PHP, MySQL & JavaScript


With jQuery, CSS & HTML5

Robin Nixon
Learning PHP, MySQL & JavaScript
With jQuery, CSS & HTML5
by Robin Nixon
Copyright © 2015 Robin Nixon. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].

Editor: Andy Oram Indexer: Ellen Troutman


Production Editor: Nicole Shelby Interior Designer: David Futato
Copyeditor: Rachel Monaghan Cover Designer: Randy Comer
Proofreader: Sharon Wilkey Illustrator: Rebecca Demarest

December 2014: Fourth Edition

Revision History for the Fourth Edition


2014-11-21: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781491918661 for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learning PHP, MySQL & JavaScript, the
cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.

978-1-491-91866-1
[LSI]
For Julie
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

1. Introduction to Dynamic Web Content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


HTTP and HTML: Berners-Lee’s Basics 2
The Request/Response Procedure 2
The Benefits of PHP, MySQL, JavaScript, CSS, and HTML5 5
Using PHP 6
Using MySQL 7
Using JavaScript 8
Using CSS 9
And Then There’s HTML5 10
The Apache Web Server 11
About Open Source 12
Bringing It All Together 12
Questions 14

2. Setting Up a Development Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


What Is a WAMP, MAMP, or LAMP? 16
Installing XAMPP on Windows 16
Testing the Installation 24
Installing XAMPP on Mac OS X 27
Accessing the Document Root 27
Installing a LAMP on Linux 28
Working Remotely 28
Logging In 28
Using FTP 29
Using a Program Editor 30
Using an IDE 31

v
Questions 33

3. Introduction to PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Incorporating PHP Within HTML 35
This Book’s Examples 37
The Structure of PHP 38
Using Comments 38
Basic Syntax 39
Variables 40
Operators 45
Variable Assignment 48
Multiple-Line Commands 50
Variable Typing 52
Constants 53
Predefined Constants 54
The Difference Between the echo and print Commands 55
Functions 55
Variable Scope 56
Questions 62

4. Expressions and Control Flow in PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63


Expressions 63
TRUE or FALSE? 63
Literals and Variables 65
Operators 66
Operator Precedence 67
Associativity 69
Relational Operators 70
Conditionals 74
The if Statement 75
The else Statement 76
The elseif Statement 78
The switch Statement 79
The ? Operator 82
Looping 83
while Loops 84
do...while Loops 86
for Loops 86
Breaking Out of a Loop 88
The continue Statement 89
Implicit and Explicit Casting 90
PHP Dynamic Linking 91

vi | Table of Contents
Dynamic Linking in Action 92
Questions 93

5. PHP Functions and Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95


PHP Functions 96
Defining a Function 98
Returning a Value 98
Returning an Array 100
Do Not Pass Arguments by Reference 100
Returning Global Variables 102
Recap of Variable Scope 103
Including and Requiring Files 103
The include Statement 104
Using include_once 104
Using require and require_once 105
PHP Version Compatibility 105
PHP Objects 106
Terminology 106
Declaring a Class 107
Creating an Object 108
Accessing Objects 109
Cloning Objects 110
Constructors 111
PHP 5 Destructors 112
Writing Methods 112
Static Methods in PHP 5 113
Declaring Properties 114
Declaring Constants 115
Property and Method Scope in PHP 5 115
Static Properties and Methods 116
Inheritance 118
Questions 121

6. PHP Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123


Basic Access 123
Numerically Indexed Arrays 123
Associative Arrays 125
Assignment Using the array Keyword 126
The foreach...as Loop 127
Multidimensional Arrays 129
Using Array Functions 132
is_array 132

Table of Contents | vii


count 132
sort 133
shuffle 133
explode 133
extract 134
compact 135
reset 136
end 136
Questions 137

7. Practical PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139


Using printf 139
Precision Setting 140
String Padding 142
Using sprintf 143
Date and Time Functions 143
Date Constants 146
Using checkdate 146
File Handling 147
Checking Whether a File Exists 147
Creating a File 147
Reading from Files 149
Copying Files 150
Moving a File 150
Deleting a File 151
Updating Files 151
Locking Files for Multiple Accesses 152
Reading an Entire File 154
Uploading Files 155
System Calls 160
XHTML or HTML5? 162
Questions 162

8. Introduction to MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165


MySQL Basics 165
Summary of Database Terms 166
Accessing MySQL via the Command Line 166
Starting the Command-Line Interface 167
Using the Command-Line Interface 171
MySQL Commands 172
Data Types 177
Indexes 186

viii | Table of Contents


Creating an Index 186
Querying a MySQL Database 192
Joining Tables Together 202
Using Logical Operators 204
MySQL Functions 204
Accessing MySQL via phpMyAdmin 205
Questions 206

9. Mastering MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209


Database Design 209
Primary Keys: The Keys to Relational Databases 210
Normalization 211
First Normal Form 212
Second Normal Form 214
Third Normal Form 217
When Not to Use Normalization 219
Relationships 219
One-to-One 219
One-to-Many 220
Many-to-Many 221
Databases and Anonymity 222
Transactions 223
Transaction Storage Engines 223
Using BEGIN 224
Using COMMIT 225
Using ROLLBACK 225
Using EXPLAIN 226
Backing Up and Restoring 227
Using mysqldump 227
Creating a Backup File 229
Restoring from a Backup File 231
Dumping Data in CSV Format 231
Planning Your Backups 232
Questions 232

10. Accessing MySQL Using PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233


Querying a MySQL Database with PHP 233
The Process 233
Creating a Login File 234
Connecting to a MySQL Database 235
A Practical Example 240
The $_POST Array 243

Table of Contents | ix
Deleting a Record 244
Displaying the Form 245
Querying the Database 246
Running the Program 247
Practical MySQL 248
Creating a Table 248
Describing a Table 249
Dropping a Table 250
Adding Data 250
Retrieving Data 251
Updating Data 251
Deleting Data 252
Using AUTO_INCREMENT 252
Performing Additional Queries 254
Preventing Hacking Attempts 255
Steps You Can Take 256
Using Placeholders 257
Preventing HTML Injection 259
Using mysqli Procedurally 261
Questions 263

11. Form Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265


Building Forms 265
Retrieving Submitted Data 267
register_globals: An Old Solution Hangs On 268
Default Values 269
Input Types 270
Sanitizing Input 277
An Example Program 279
What’s New in HTML5? 281
The autocomplete Attribute 282
The autofocus Attribute 282
The placeholder Attribute 282
The required Attribute 282
Override Attributes 283
The width and height Attributes 283
Features Awaiting Full Implementation 283
The form Attribute 283
The list Attribute 284
The min and max Attributes 284
The step Attribute 284
The color Input Type 285

x | Table of Contents
The number and range Input Types 285
Date and Time Pickers 285
Questions 285

12. Cookies, Sessions, and Authentication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287


Using Cookies in PHP 287
Setting a Cookie 289
Accessing a Cookie 290
Destroying a Cookie 290
HTTP Authentication 290
Storing Usernames and Passwords 294
Salting 294
Using Sessions 298
Starting a Session 299
Ending a Session 302
Setting a Time-Out 303
Session Security 303
Questions 307

13. Exploring JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309


JavaScript and HTML Text 310
Using Scripts Within a Document Head 311
Older and Nonstandard Browsers 311
Including JavaScript Files 312
Debugging JavaScript Errors 313
Using Comments 315
Semicolons 315
Variables 316
String Variables 316
Numeric Variables 317
Arrays 317
Operators 318
Arithmetic Operators 318
Assignment Operators 318
Comparison Operators 319
Logical Operators 319
Variable Incrementing and Decrementing 320
String Concatenation 320
Escaping Characters 320
Variable Typing 321
Functions 322
Global Variables 322

Table of Contents | xi
Local Variables 323
The Document Object Model 324
But It’s Not That Simple 326
Using the DOM 327
About document.write 328
Using console.log 328
Using alert 328
Writing into Elements 329
Using document.write 329
Questions 329

14. Expressions and Control Flow in JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331


Expressions 331
Literals and Variables 332
Operators 333
Operator Precedence 334
Associativity 334
Relational Operators 335
The with Statement 338
Using onerror 339
Using try...catch 340
Conditionals 341
The if Statement 341
The else Statement 341
The switch Statement 342
The ? Operator 344
Looping 344
while Loops 344
do...while Loops 345
for Loops 346
Breaking Out of a Loop 346
The continue Statement 347
Explicit Casting 348
Questions 348

15. JavaScript Functions, Objects, and Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351


JavaScript Functions 351
Defining a Function 351
Returning a Value 353
Returning an Array 355
JavaScript Objects 356
Declaring a Class 356

xii | Table of Contents


Creating an Object 357
Accessing Objects 358
The prototype Keyword 358
JavaScript Arrays 361
Numeric Arrays 361
Associative Arrays 362
Multidimensional Arrays 363
Using Array Methods 364
Questions 369

16. JavaScript and PHP Validation and Error Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371


Validating User Input with JavaScript 371
The validate.html Document (Part 1) 372
The validate.html Document (Part 2) 374
Regular Expressions 377
Matching Through Metacharacters 378
Fuzzy Character Matching 378
Grouping Through Parentheses 379
Character Classes 380
Indicating a Range 380
Negation 380
Some More-Complicated Examples 381
Summary of Metacharacters 383
General Modifiers 385
Using Regular Expressions in JavaScript 386
Using Regular Expressions in PHP 386
Redisplaying a Form After PHP Validation 387
Questions 393

17. Using Ajax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395


What Is Ajax? 395
Using XMLHttpRequest 396
Your First Ajax Program 398
Using Get Instead of Post 403
Sending XML Requests 406
Using Frameworks for Ajax 411
Questions 411

18. Introduction to CSS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413


Importing a Style Sheet 414
Importing CSS from Within HTML 414
Embedded Style Settings 415

Table of Contents | xiii


Using IDs 415
Using Classes 415
Using Semicolons 416
CSS Rules 416
Multiple Assignments 416
Using Comments 417
Style Types 418
Default Styles 418
User Styles 418
External Style Sheets 419
Internal Styles 419
Inline Styles 420
CSS Selectors 420
The Type Selector 420
The Descendant Selector 420
The Child Selector 421
The ID Selector 422
The Class Selector 423
The Attribute Selector 423
The Universal Selector 424
Selecting by Group 425
The CSS Cascade 425
Style Sheet Creators 426
Style Sheet Methods 426
Style Sheet Selectors 426
Calculating Specificity 427
The Difference Between Div and Span Elements 429
Measurements 431
Fonts and Typography 432
font-family 433
font-style 433
font-size 434
font-weight 434
Managing Text Styles 435
Decoration 435
Spacing 435
Alignment 436
Transformation 436
Indenting 436
CSS Colors 437
Short Color Strings 438
Gradients 438

xiv | Table of Contents


Positioning Elements 439
Absolute Positioning 440
Relative Positioning 440
Fixed Positioning 440
Pseudoclasses 442
Shorthand Rules 444
The Box Model and Layout 445
Setting Margins 445
Applying Borders 447
Adjusting Padding 448
Object Contents 450
Questions 450

19. Advanced CSS with CSS3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451


Attribute Selectors 451
Matching Parts of Strings 452
The box-sizing Property 453
CSS3 Backgrounds 453
The background-clip Property 454
The background-origin Property 456
The background-size Property 456
Using the auto Value 457
Multiple Backgrounds 457
CSS3 Borders 459
The border-color Property 459
The border-radius Property 459
Box Shadows 462
Element Overflow 463
Multicolumn Layout 463
Colors and Opacity 465
HSL Colors 465
HSLA Colors 466
RGB Colors 466
RGBA Colors 467
The opacity Property 467
Text Effects 467
The text-shadow Property 467
The text-overflow Property 468
The word-wrap Property 469
Web Fonts 469
Google Web Fonts 470
Transformations 472

Table of Contents | xv
3D Transformations 473
Transitions 474
Properties to Transition 474
Transition Duration 475
Transition Delay 475
Transition Timing 475
Shorthand Syntax 476
Questions 477

20. Accessing CSS from JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479


Revisiting the getElementById Function 479
The O function 479
The S Function 480
The C Function 481
Including the Functions 482
Accessing CSS Properties from JavaScript 482
Some Common Properties 483
Other Properties 484
Inline JavaScript 486
The this Keyword 486
Attaching Events to Objects in a Script 487
Attaching to Other Events 488
Adding New Elements 489
Removing Elements 490
Alternatives to Adding and Removing Elements 491
Using Interrupts 492
Using setTimeout 492
Cancelling a Time-Out 493
Using setInterval 493
Using Interrupts for Animation 495
Questions 497

21. Introduction to jQuery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499


Why jQuery? 500
Including jQuery 500
Choosing the Right Version 500
Downloading 501
Using a Content Delivery Network 502
Always Using the Latest Version 503
Customizing jQuery 503
jQuery Syntax 503
A Simple Example 504

xvi | Table of Contents


Avoiding Library Conflict 505
Selectors 505
The css Method 506
The Element Selector 506
The ID Selector 507
The Class Selector 507
Combining Selectors 507
Handling Events 508
Waiting Until the Document Is Ready 509
Event Functions and Properties 510
The blur and focus Events 511
The this Keyword 512
The click and dblclick Events 512
The keypress Event 513
Considerate Programming 515
The mousemove Event 515
Other Mouse Events 518
Alternative Mouse Methods 519
The submit Event 520
Special Effects 521
Hiding and Showing 522
The toggle Method 523
Fading In and Out 524
Sliding Elements Up and Down 525
Animations 526
Stopping Animations 529
Manipulating the DOM 530
The Difference Between The text and html Methods 531
The val and attr Methods 531
Adding and Removing Elements 533
Dynamically Applying Classes 535
Modifying Dimensions 535
The width and height Methods 536
The innerWidth and innerHeight Methods 538
The outerWidth and OuterHeight Methods 538
DOM Traversal 539
Parent Elements 539
Child Elements 543
Sibling Elements 543
Selecting the Next and Previous Elements 545
Traversing jQuery Selections 546
The is Method 548

Table of Contents | xvii


Using jQuery Without Selectors 549
The $.each Method 550
The $.map Method 551
Using Ajax 551
Using the Post Method 551
Using the Get Method 552
Plug-Ins 553
The jQuery User Interface 553
Other Plug-Ins 553
jQuery Mobile 554
Questions 555

22. Introduction to HTML5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557


The Canvas 558
Geolocation 559
Audio and Video 561
Forms 562
Local Storage 563
Web Workers 563
Web Applications 563
Microdata 564
Summary 564
Questions 564

23. The HTML5 Canvas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565


Creating and Accessing a Canvas 565
The toDataURL Function 567
Specifying an Image Type 569
The fillRect Method 569
The clearRect Method 569
The strokeRect Method 570
Combining These Commands 570
The createLinearGradient Method 571
The addColorStop Method in Detail 573
The createRadialGradient Method 574
Using Patterns for Fills 576
Writing Text to the Canvas 578
The strokeText Method 578
The textBaseLine Property 579
The font Property 579
The textAlign Property 579
The fillText Method 580

xviii | Table of Contents


The measureText Method 581
Drawing Lines 581
The lineWidth Property 581
The lineCap and lineJoin Properties 581
The miterLimit Property 584
Using Paths 584
The moveTo and LineTo Methods 584
The stroke Method 585
The rect Method 585
Filling Areas 586
The clip Method 587
The isPointInPath Method 590
Working with Curves 591
The arc Method 591
The arcTo Method 594
The quadraticCurveTo Method 595
The bezierCurveTo Method 596
Manipulating Images 597
The drawImage Method 597
Resizing an Image 598
Selecting an Image Area 598
Copying from a Canvas 600
Adding Shadows 600
Editing at the Pixel Level 602
The getImageData Method 602
The data Array 603
The putImageData Method 605
The createImageData Method 605
Advanced Graphical Effects 606
The globalCompositeOperation Property 606
The globalAlpha Property 609
Transformations 609
The scale Method 609
The save and restore Methods 610
The rotate Method 611
The translate Method 612
The transform Method 613
The setTransform Method 615
Summary 615
Questions 616

Table of Contents | xix


24. HTML5 Audio and Video. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
About Codecs 618
The <audio> Element 619
Supporting Non-HTML5 Browsers 621
The <video> Element 623
The Video Codecs 623
Supporting Older Browsers 627
Summary 629
Questions 629

25. Other HTML5 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631


Geolocation and the GPS Service 631
Other Location Methods 632
Geolocation and HTML5 632
Local Storage 636
Using Local Storage 637
The localStorage Object 637
Web Workers 639
Offline Web Applications 641
Drag and Drop 643
Cross-Document Messaging 645
Microdata 648
Other HTML5 Tags 651
Summary 652
Questions 652

26. Bringing It All Together. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653


Designing a Social Networking Site 653
On the Website 654
functions.php 654
The Functions 654
header.php 656
setup.php 658
index.php 660
signup.php 661
Checking for Username Availability 661
Logging In 662
checkuser.php 665
login.php 665
profile.php 667
Adding the “About Me” Text 668
Adding a Profile Image 668

xx | Table of Contents
Processing the Image 668
Displaying the Current Profile 669
members.php 672
Viewing a User’s Profile 672
Adding and Dropping Friends 672
Listing All Members 672
friends.php 675
messages.php 678
logout.php 681
styles.css 682
javascript.js 685

A. Solutions to the Chapter Questions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

B. Online Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707

C. MySQL’s FULLTEXT Stopwords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711

D. MySQL Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715

E. jQuery Selectors, Objects, and Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747

Table of Contents | xxi


Preface

The combination of PHP and MySQL is the most convenient approach to dynamic,
database-driven web design, holding its own in the face of challenges from integrated
frameworks—such as Ruby on Rails—that are harder to learn. Due to its open source
roots (unlike the competing Microsoft .NET Framework), it is free to implement and
is therefore an extremely popular option for web development.
Any would-be developer on a Unix/Linux or even a Windows/Apache platform will
need to master these technologies. And, combined with the partner technologies of
JavaScript, jQuery, CSS, and HTML5, you will be able to create websites of the caliber
of industry standards like Facebook, Twitter, and Gmail.

Audience
This book is for people who wish to learn how to create effective and dynamic web‐
sites. This may include webmasters or graphic designers who are already creating
static websites but wish to take their skills to the next level, as well as high school and
college students, recent graduates, and self-taught individuals.
In fact, anyone ready to learn the fundamentals behind the Web 2.0 technology
known as Ajax will obtain a thorough grounding in all of these core technologies:
PHP, MySQL, JavaScript, CSS, and HTML5, and learn the basics of the jQuery library
too.

Assumptions This Book Makes


This book assumes that you have a basic understanding of HTML and can at least put
together a simple, static website, but does not assume that you have any prior knowl‐
edge of PHP, MySQL, JavaScript, CSS, or HTML5—although if you do, your progress
through the book will be even quicker.

xxiii
Other documents randomly have
different content
Der Alkohol verleitet tatsächlich zu den leichtsinnigsten
Geschlechtsverbindungen und gefährlichsten Abenteuern. Tausende
von jungen Männern erwerben ihre Geschlechtskrankheit, wenn sie
angeheitert zum Haus der Dirne gehen. Ja, die meisten haben wohl
die Bekanntschaft der Prostitution erst mit erleichternder Hilfe des
Alkohols gemacht. F o r e l machte unter seinen geschlechtskranken
Patienten eine Statistik und fand, daß 75% davon sich unter dem
Einfluß des Alkohols angesteckt hatten.

Je höher der Alkoholgehalt eines Getränkes, desto stärker auch


seine Wirkung. Aber von den Getränken mit geringem Alkoholgehalt,
wie z. B. Bier, werden oft solche Mengen getrunken, daß trotzdem
stärkste Wirkungen, Trunkenheit, leichtsinnige
Geschlechtsverbindung, venerische Ansteckung, geschlechtliche
Verirrungen u. dergl. zustande kommen. Und die Statistik lehrt, daß
die Zahl der unehelichen Geburten mit dem Bierverbrauch in den
einzelnen Städten steigt und sinkt.

Von den Sittlichkeitsdelikten kommt ein sehr hoher Prozentsatz


aus dem Alkoholgenuß. Und was diesen vielen und vielerlei
Ausschreitungen, Fehlern, Unbesonnenheiten und Vergehen an
Unglück, Familienjammer und sozialem Elend folgt, das ist kaum zu
übersehen. Hier gibt's für den einsichtsvollen Menschen nur einen
Weg, den der Enthaltsamkeit vom Alkohol.

Wie Schreck fährt's manchem durch die Glieder, wenn es heißt, er


soll kein Bier mehr trinken. So fest sitzt es in seinen Lebensbegriffen,
daß ihn der Verzicht ungeheuerlich anmutet. Und doch gibt's nicht
den kleinsten Vorteil, der im Alkohol wohnt, sondern nur Nachteil,
unbedingten, unbegrenzbaren Schaden. Was schädlich ist, geht
wider die menschliche Vernunft. Darum räumen wir etwas aus dem
Weg, was die Menschen in ihrer gesamten Entwicklung hindert, und
verzichten auf den Alkohol. In diesem Verzicht liegt Selbstachtung,
Stolz, Würde. Gute Entschlüsse machen den Menschen reifer,
willenskräftiger, sittlich freier. Und der Verzicht auf den Alkohol ist ein
guter Entschluß!
Meidest du den Alkohol, so meidest du von selbst jene häßlichen
Stätten, wo der Alkohol bewußt und planmäßig zur sinnlichen
Anreizung gebraucht wird, die Animierkneipen und alle anderen
Kneipen „mit Damenbedienung“. Es liegt etwas unsäglich Häßliches
und Niedriges, etwas namenlos Gemeines in diesen Kneipen, und es
ist mir völlig unverständlich, wie ein junger Mann in der Dunstwolke
dieser alkoholischen Geilheit auch nur einen einzigen Atemzug tun
kann.

Hier stehen wir auf der Grenze, wo die körperlichen Anreize der
Geschlechtlichkeit in die geistigen übergehen. Und so, wie du den
Körper freihalten mußt von unsauberen Dingen, so gib auch dem
Geist nur und ausschließlich gute Nahrung. Leicht mag das nicht
sein. Denn die erotische Hochspannung der Kultur hat auch in die
Literatur und in die Kunst einen erotisch-neurasthenischen Ton
hineingetragen. Die Betonung des Sexuell-Sinnlichen kommt dem
Interesse der Menge entgegen. Sexuelle Dinge werden breit, mit
zynischer Behaglichkeit oder mit geschickt und elegant verborgener
Lüsternheit geschildert oder gemalt. Vor nichts scheut man zurück,
und die Schamlosigkeit macht sich breit unter dem Deckmantel des
„Realismus“.

Wir wollen ganz absehen von Kolportageromanen, die auf die


niedrigsten Instinkte spekulieren. Nein, auch fähige Schriftsteller,
begabte Bildhauer und Maler haben sich der Erotik verschrieben und
prostituieren ihre Kunst, um den billigen Beifall der Menge zu
erhaschen.

Wieviel Unheil richten sie in jugendlichen Köpfen an! Unruhige


sinnliche Wünsche werden geweckt, sittliche Begriffe gestürzt; denn
das, was ohne Zweifel schlecht ist, wird durch diese erotische
Literatur „interessant“ gemacht. Wieviel schlechte Handlungen
entsteigen der durch schlechte Lektüre verwilderten Phantasie! Wie
oft erfährt der Richter, daß ein schlechtes Buch den Antrieb zu einer
sittlichen oder strafrechtlichen Entgleisung gab!

Die Zahl der scheußlichen Witzblätter ist groß, und selbst


Witzblätter, denen manch ernstes Wort eine Bedeutung gab, haben
sich dem erotischen Zynismus mit Haut und Haaren verschrieben.
Die Inseratenseiten wimmeln von Anzeigen erotischer Literatur, von
Anpreisungen von „Aktzeichnungen“, die angeblich nur für „Kenner“
oder „Künstler“ bestimmt sind. Aller Schmutz kann in solchen
Inseratteilen abgeladen werden, und die vielen Anzeigen von
Heiratsgesuchen, von Wohnungen „mit separatem Eingang“ und
dergleichen sind nur eine schwungvolle geldliche Ausnützung der
allgemeinen Lüsternheit.

Schmach und Schande über eine Presse, die sich ihrer


erzieherischen Pflicht so wenig bewußt ist!

Am meisten hast du dich zu schützen vor jener Literatur, die


angeblich „Aufklärung“ verbreiten will in geschlechtlichen Dingen
und mit allerlei unverfänglichen oder auch verfänglichen Titeln die
Neugier der Jugend erregt. Ich weiß aus vielen Berichten, die mir
zugegangen sind, wie solche Bücher Schaden anrichten. Die
Lüsternheit und Sinnlichkeit des Verfassers steigt zwischen den
Zeilen auf und teilt sich dem Leser – ihn erregend – mit, so daß
mancher mir schon berichtete, wie sehr ihn gerade diese
Aufklärungsliteratur zur Onanie und sinnlichen Gesprächen
verleitete.

Auch da, wo der Inhalt des Buches an sich richtig und gut ist,
kann diese Gefahr bestehen, denn hier macht der Ton die Musik, und
ich stehe keineswegs bei denjenigen, die da meinen, man müsse aus
Gründen der „Natürlichkeit“ den letzten zarten Schleier der
Schamhaftigkeit von den geschlechtlichen Dingen hinwegnehmen.
Nicht das restlose Wissen, nicht die absolute Entschleierung ist der
beste Schutz, sondern die zarte, poesievolle und doch kraftvoll-
gesunde Auffassung vom Liebesleben, jene innere, tiefe und
wahrhaftige Schamhaftigkeit. Nicht im Verstand liegt die Sittlichkeit,
sondern in der Seele. Darum haben diejenigen die höchsten
sittlichen Kräfte, die die stärksten Glaubenskräfte haben.

Prostituiert ist auch die bildende Kunst. Vorbei ist die Hoheit der
griechischen Meister, die mit der Darstellung der Nacktheit höchste
Schamhaftigkeit und sittliche Würde verbanden. Wir leugnen gar
nicht die sinnlichen Elemente des Kunstgenießens. Aber die Kunst
soll unsere Sinnlichkeit idealisieren, durch das körperlich Schöne den
Enthusiasmus der Seele wecken, nicht aber die rohe Sinnlichkeit
entflammen und den aufstrebenden Geist in die Fesseln der
quälenden Körperlichkeit bannen. Eine gemeine Kunst verführt zu
einsamen Triebverirrungen, zu Lüsternheit und Ausschweifung. Es ist
nicht ratsam, in Kunstfragen den Staatsanwalt und die Polizei zur
obersten Instanz zu machen. Bessere Richter einer gesunkenen,
feilen und geilen Kunst sind guter Geschmack, anständige Gesinnung
und Selbstachtung. Das Angebot wird durch die Nachfrage
hervorgelockt, und jeder vernünftige Mensch sollte es für unter
seiner Würde halten, ein Bildwerk zu betrachten oder gar zu kaufen,
das die Lüsternheit herausfordert.

Der Stolz müßte sich auch aufbäumen gegen den Schmutz, der
sich in photographischen oder literarischen Pikanterien breit macht.
Warum gehen junge Männer nicht diesen gemeinen Anreizen aus
dem Wege? Warum erschweren sie sich den Kampf und lassen sich
immer mehr herabziehen? Nicht die gewissenlosen Händler sollte
man anklagen, sondern die charakterlosen Männer, die den Schmutz
begehren.

Das Denken in geschlechtlichen Dingen ist sehr wohl ein Maßstab


der allgemeinen Kraft und Sittlichkeit eines Volkes überhaupt, und es
ist charakteristisch, wenn wir aus Frankreich hören, daß dort die
Väter ihren beim Militär dienenden Söhnen zur Unterhaltung
pornographische Photographien senden.
Was aber soll man dazu sagen, wenn sogar die dramatische Kunst,
die den stärksten Einfluß auf das Volk hat, ihre Verantwortlichkeit
verliert und im sexuellen Zynismus landet? Die Kunst geht nach Brot,
und wenn der Brotherr, das Publikum, einen verkommenen
Geschmack hat und mit gierigem Blick nach Lüsternheiten Ausschau
hält, dann darf man sich nicht wundern, wenn die Bühne
französische Ehebruchsdramen und zynisch-erotische Vaudevilles
aufführt. Da ist der Held der Bühne nicht der stolze, edle Mensch,
nicht Tell, Tasso oder Posa, sondern der seine Frau betrügende
Ehemann, der weichlich-erbärmliche Don Juan, der in tausend
Ängsten vor dem Entdecktwerden und in tausend Nöten von einer
jammervollen Situation in die andere gerät, und der uns dann als
von den Frauen besonders begehrt dargestellt wird. Sieht man, wie
vollbesetzt diese Theater sind, und wie im Publikum die Mienen ohne
alle Selbstbeherrschung gierig-lüstern werden, so kann man das
Gefühl von Scham und Empörung nicht unterdrücken über ein Volk,
das so seine großen Männer vergißt, und über Menschen, die so sehr
alles Edle, Schöne, Menschliche von der Geilheit überwuchern
lassen.

Schule deinen Geschmack und deinen ganzen inneren Menschen


an echter, edler Kunst und sei zu stolz, ein Spielball dieser lüstern-
geschäftlichen Spekulationskunst zu werden.

Halte dich auch fern von den auf niedriger Stufe stehenden
Varieté-Theatern, wo der Humorist ein privilegierter Zotenreißer ist
und die Tänzerinnen mit dem Mangel an Kleidung den noch
größeren Mangel an Können verdecken, wo ein rauch- und
bierdunstiges Lokal bis zum letzten Platz mit Männern angefüllt ist,
und sogar Frauen sich nicht scheuen, ihr eigenes Geschlecht auf der
Bühne prostituiert zu sehen. Warum sind die Varietés, die
Singspielhallen, die Konzertcafés mit erotisch-winselnder
Geigenmusik überfüllt, und warum können sich ernste Bühnen so
schwer halten? Weil die Massen korrumpiert sind, und weil die
wachsende Degeneration die Sinnlichkeit triumphieren läßt und
zugleich die Selbstkritik schweigen heißt.
Diese bedrohlich angewachsene Sinnlichkeit wird von dem Kapital
in raffinierter Weise ausgeschlachtet. Ganze Industrien rechnen ja
mit dieser Sinnlichkeit. Aber wieviel Unheil richtet sie an! Wieviel
Nervenkraft und Menschenglück wird dabei zerstört! Es ist nicht
ehrlich, Geld zu verdienen, wenn ein anderer dabei geschändet wird.

Aber niemand ist genötigt, sich diesen Schäden hinzugeben. Setze


an die Stelle dieses wirren und wüsten Treibens deinen Stolz, deine
Würde, dein besseres Ich und eine ernste Arbeit mit festem
Lebensziel, dann wird die Gefahr deine Kräfte stählen. Die Arbeit ist
die Grundlage deines Lebens, und die Stunden, die nicht deinen
Pflichten gehören, sondern dir selbst, die sollst du ausfüllen mit
Schönem, mit guter Lektüre. Unser deutsches Schrifttum ist reich an
guten Büchern. Du sollst die freien Stunden benutzen, gute Kunst
kennen zu lernen. In Museen und Galerien ist Gelegenheit dazu. Und
vor allem sollst du die Natur, deine Heimat, kennen lernen und
wandern, damit dein Körper stark und dein Geist fröhlich werde.
Geh allem aus dem Wege, was dich herabzieht.
Schaue nur Schönes, denke nur Gutes, handle
nur edel, dann wirst du den Sinn und die
Schönheit des Lebens in dir selbst finden, weil
du in Harmonie mit dem Weltprinzip bist.
Schlußwort.
So bist du mir nun gefolgt, lieber junger Freund, und wir haben
das Gebiet durchwandert, das gleicherweise Glück und Unglück,
Jubel und Tränen, Schönheit und Grauen umschließt, in das fast alle
Menschen mit Kraft und Sehnsucht einziehen, und in dem wir sie
weiterwandern sehen mit Krankheit, Schwäche, gebrochener Seele,
verlorener Jugend und beladen mit wirren und schwülen
Geheimnissen.

So viel Jammer entsteigt der Unwissenheit!

War's da nicht recht, deine Augen sehend zu machen? Ich habe


dir nicht nur Häßliches zeigen und dich vor Gefahren warnen wollen,
nein, auch die Schönheiten des Liebesgefühls habe ich in dir keimen
lassen, weil ich weiß, daß alle Lebensschönheit nur in der Natur
steckt und die Natur auch im Menschen wohnt. Naturalia non sunt
turpia!

Nicht das ist die wahre Sittlichkeit, die einen Gegensatz zwischen
Mensch und Natur errichtet, die vom Menschen ein Abtöten seiner
Natur verlangt und ihn in einen letzten Endes vergeblichen Kampf
zwischen Tun und Willen stürzt. Nein, die wahre Sittlichkeit liegt im
Erkennen der erdgeborenen Natur des Menschen und in dem festen
Willen, schrittweise und allmählich auf höhere Stufen zu gelangen.
Weder haben diejenigen recht, die leichtsinnig in den Tag
hineinleben, die alles, so wie es ist, für gut halten und vom Baume
des Lebens so viel Früchte herabnehmen, wie sie erhaschen können,
noch können wir denjenigen folgen, die in düsterem Pessimismus
alle Lebensschönheit nicht sehen wollen und sich auf den Himmel
vorzubereiten wähnen, während doch zugleich ihr Aszetismus ein
göttliches Gebot in den Staub zieht.

Zwischen diesen zwei Irrenden steht der wahrhaft sittliche


Mensch, der sein Leben und seine Persönlichkeit reich und kraftvoll
entfaltet, aber nicht eingreift in die Rechte der anderen und nicht
das Wohl der Nachgeborenen untergräbt. Dem die tiefe Erkenntnis
der biologischen Zusammenhänge ein starkes
Selbstverantwortlichkeitsgefühl aufzwingt, und der seine Wünsche
schweigen heißt, wenn ihre Befriedigung die feinen geheimnisvollen
Fäden verwirrt, die alle Menschen in Glück und Unglück miteinander
verbinden.

Da sehen wir die strengen Grenzen zwischen individueller und


sozialer Ethik. Die eine lebt sowohl im Aszetismus wie in der
Vergnügungssucht der Masse, die sich in ihrem oberflächlichen
Individualismus eine Kollektivethik geschaffen hat. Beide aber maßen
sich an, selbst Richter aller Dinge zu sein. Hoch über beiden steht
die soziale Ethik, die von Einzelnen in das Volk getragen wird, von
jenen Einzelnen, in denen die schreiende sexuelle Not der Menschen
ein Echo fand, und in denen das Menschheitsgewissen, jene feine
und sichere Unterscheidungskraft zwischen Gut und Böse, lebte.

Diese soziale Ethik nimmt einem natürlichen Triebe alles, was ihn
häßlich macht und die Menschennatur herabwürdigt, und sie
gestaltet sein Äußern so, wie es das Wohl der sozialen Gesamtheit
verlangt.

Alle Ethik hat ihre Wurzeln im Geschlechtsleben. Denn das


Geschlechtsgefühl ist die eigentliche Urquelle aller menschlichen
Sympathiegefühle und aller sozialen Organisationen überhaupt. Ist
daher das Geschlechtsleben krank und verdorben, so muß der ganze
Bau des Menschendaseins erschüttert werden.

Das Geschlechtsleben ist die höchste und stärkste


Entwicklungskraft der Menschheit. Es hat der Religion Nahrung
gegeben, hat Kultur, soziale Gemeinschaft und Kunst entwickelt und
dem Geist seine feinsten Blüten gegeben. Aber es ist auch die Kraft,
die wie keine andere die Menschen hinabstößt in Schwäche und
Elend, in Verwilderung und Versumpfung, in leiblichen und geistigen
Tod. Das Geschlechtsgefühl ist dem Menschengeschlecht Himmel
und Hölle zugleich. Darin liegt sein tiefer, eherner Ernst.

Aus dem Geschlechtsgefühl quillen Menschenwerte. Ein niedriges


Geschlechtsleben schafft Krankheit und niedriges, schlechtes
Denken. Ein reines Geschlechtsleben dient der Gesundheit, adelt den
Menschen und veredelt die Rasse. Diese Reinheit vereinigt
Natürlichkeit mit feinstem Schamgefühl, gesunde Kraft mit
zartschöner, idealistischer Auffassung.

Das ist's, wozu ich dich mit diesem Buche hinführen wollte. Nicht
die „Natürlichkeit“ in jenem stumpfen Sinne einer seelenlosen
Nüchternheit, die das Geschlechtliche zu einer Alltagsgebärde
stempelt. Die dem Liebesgefühl seine Gefahren dadurch nehmen
will, daß man es in der Nüchternheit körperlicher
Selbstverständlichkeit erstickt. Nein, diejenige Natürlichkeit will ich
dich lehren, die zwar den körperlichen Untergrund aller Dinge sieht,
aber alle Körperkultur nur als Ausgangspunkt einer kraftvollen
Seelenkultur erkennt.

Dem Seelenkultus dienen wir! Der rohe Körperkult dient letzten


Endes der Form- und Zügellosigkeit, wenn der Seele feinste
Strömungen nicht das körperliche Tun durchwehen. Die Seele allein
birgt die wahre Scham, des Geschlechtsempfindens zarteste Blüte.

So habe ich dir die Wege deines Tuns gewiesen. Unbeirrt und
klaren Auges kannst du in das Leben hinaustreten. Trenne dich von
der Masse, von denen, die ideallos geworden sind, folge dem Stern
deines besseren Ich, schreite mutig und siegreich durch alle
Gefahren! Vermehre nicht das Unglück und den Kummer der
Menschen, sondern sei in deiner sittlichen Kraft wie ein Licht, das ins
Dunkle strahlt und auch anderen Menschen das Leben verschönt.
So trenne ich mich von diesem Buche und
t r e n n e m i c h v o n d i r.

Lebe wohl!

Dein Leben sei rein und ehrlich und voll


Glück! Und daß es so sei, gehe den einsamen
Weg der Guten!

Lebe wohl!
Fußnoten:
1 Man lese „Arbeit, Kraft und Erfolg“, Wege zur Steigerung der
Leistungsfähigkeit in körperlichem und geistigem Schaffen. Von Emil Peters.
Mk. 4.25. Zu beziehen durch den Volkskraft-Verlag, Konstanz am Bodensee.

2 Volkskraft-Verlag, Konstanz am Bodensee.

3 Volkskraft-Verlag, Konstanz am Bodensee, geh. Mk. 2.75, geb. Mk. 4.50.

4 Wissenschaft und Sittlichkeit, Berlin 1908.

5 Die Gefahren des außerehelichen Geschlechtsverkehrs. 2 Aufl. München


1904. A. Müller.

6 a. a. O., S. 6.

7 Volkskraft-Verlag Konstanz am Bodensee, geh. Mk. 2.75, geb. Mk. 4.50.


Porto 25 Pfg.
Anmerkungen zur
Transkription:
Das Original ist in Fraktur gesetzt.

Schreibweise und Interpunktion des


Originaltextes wurden übernommen;
lediglich offensichtliche Druckfehler
wurden korrigiert.

Einige Ausdrücke wurden in beiden


Schreibweisen übernommen:

andererseits (Seiten 38 und 39) und


andrerseits (Seiten 26, 31, 97 und
106)
gesunderen (Seite 34) und
gesünderen (Seite 90)
gesunder (Seite 19) und gesünder
(Seiten 88 und 116)

Folgende offensichtliche Druckfehler


wurden korrigiert:

geändert wurde
"Daß ist die große"
in
"Das ist die große" (Seite 18)
geändert wurde
"Buche „Der nervöse Mensch“."
in
"Buche „Der nervöse Mensch“.[1]"
(Seite 34)
geändert wurde
"den G o n o c c o c i N e i s s e r i oder"
in
"den G o n o c c o c i N e i s s e r i oder"
(Seite 96)
geändert wurde
"führt zur Dishamonie, und"
in
"führt zur Disharmonie, und" (Seite
118)
geändert wurde
"Volkskraf-Verlag, Konstanz am
Bodensee, geh. Mk. 2,75, geb. Mk.
4,50."
in
"Volkskraft-Verlag, Konstanz am
Bodensee, geh. Mk. 2.75, geb. Mk.
4.50." (Fußnote 3)
*** END OF THE PROJECT GUTENBERG EBOOK JUGEND, LIEBE
UND LEBEN ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like