log_errorsphpinfo
phpinfo 时间:2021-01-11 阅读:(
)
INDEXSYMBOLSANDNumericsarrayassignmentoperator,74!
negativeoperator,78!
=notequalto,77,375!
==notidentical,78querystring,327:conditionaloperator,80@errorcontroloperator,113{}curlybracesinconditionalstatements,57–58infunctions,83indentationconventions,60withassociativearrayelements,372withvariablesindouble-quotedstrings,99~homedirectoryonMacOSX,38*multiplicationoperator,86,375*shorthandforallcolumns,375/divisionoperator,66,375++incrementoperator,66--decrementoperator,66$variableprefix,50Aamode,fopen()function,188appendingcontentwithfopen(),191tagpassinginformationthroughquerystrings,327a+mode,fopen()function,188combinedread/writeoperations,192creatingfile-baseduserregistrationform,250absolutepathnamesusingincludeswith,114accessseealsofileaccessusingsessionstorestrictaccess,238–253Access(Microsoft),286actionattribute,tag,119AddTypecommand(Apache),31ADDDATE()function,MySQL,391additionoperator(+),66precedenceofarithmeticoperators,67addslashes()functionSQLinjection,343INDEX446AES_DECRYPT()function,MySQL,441AES_ENCRYPT()function,MySQL,430aliases,MySQL,383handlingdates,390all-in-oneinstallation,21allow_url_fopendirective,181checkingifdisabled,209creatingsocketconnectionifdisabled,203,206allow_url_includedirective,181AM/PMMySQLdateformatspecifiers,389PHPformatcharacters,395&,HTMLentity,338ampersand(&)charactereffectonvariableinfunctionargument,138ANDoperatorlogicalAND(&&),PHP,78SELECTcommand,375WHEREclause,414anonymousaccesssecuringMySQLonMacOSX,276securingMySQLonWindows,267ApachechoosingwebserverforWindows,22configuringforPHP,onWindows,29–32confirmationthatrunningsuccessfully,37installingonWindows,22–24startingandstoppingApacheonWindows,24usingApacheonMacOSX,36–37versions,12apostropheshtmlentities()function,134whentousequotes,55appendmode,fopen()function,188,191combinedread/writeoperations,192argumentspassingmultipleargumentstofunctions,98arithmeticoperators,66–67combiningcalculationsandassignment,68precedenceof,67arraydatatype,65arraysarrayelements,53associativearrays,53,73,74creatingarrays,73–76destroyingsessionvariables,236emptyarrays,74$_FILESarray,155–157$_GETarray,54indexedarrays,53,73,74initializing,74inspectingwithprint_r()function,75loopingthrougharrays,82–83multidimensionalarrays,75$_POSTarray,54readingtextfileinto,185–187$_SESSIONarray,54,238$_SERVERarray,54storingmultiplevalues,53superglobalarrays,54array_key_exists()function,126,199ASkeyword,MySQL,383,390assignmentoperatorsassigningvaluestovariables,51combiningcalculationsandassignment,68equalityoperatorconfusion,51associativearrays,53,73,74authenticationauthenticatingusercredentials,436–438buildingloginpage,242–244creatingfile-baseduserregistrationform,248–252creatingreusablelogoutbutton,245–247encryptingpasswords,247–253limitationswithoutusingdatabase,253restrictingaccesstopageusing$_SESSION,244–245sessions,235two-wayencryption,440–441usingencryptedlogin,252–253usingfile-basedauthentication,241–247AuthenticationtypeconfiguringphpMyAdmin,279auto_increment(MySQL),295,297,377Bbmodemodifier,fopen()functionexampleusing,207reading/writingbinaryfiles,188backslash(\)character,70seealsoescapesequencesaddslashes()function,343automaticinsertionbeforequotes,124removingfromforminput,124–125SQLinjection,343usewithLIKEinSELECTcommand,376usewithquotes,56backticks(`)MySQLnaming,290backups,MySQL,281–283balancebracesfeaturechoosingscripteditorforPHP,17basename()function,97,98creatingdownloadlink,208creatingscaled-downimagecopy,218savingoriginalandresizedimages,230bashshellsettingupMySQLonMacOSX,273–274BBEditcheckingscriptswithfilecomparisonutility,20choosingscripteditorforPHP,19"Bcc:"header/stringblockingemailscontaining,136,137BETWEENkeywordSELECTcommand,375,376BeyondComparetool,20binarydatacolumntypes,MySQL,301binaryfilesfopen()functionmodes,188INDEX447bindingparametersMySQLIpreparedstatements,345–346,354PDOpreparedstatements,346–347,356bindParam()method(PDO),346–347,356bind_param()method(MySQLI),345–346,354,366,368bind_result()method(MySQLI),366BLOBtype,MySQL,301blogssuitabilityofPHPfor,6Booleandatatype,65Booleanvalues,76derivationofterm,56explicitBooleanvalues,76implicitBooleanvalues,77usingquoteswith,56tagsnl2br()function,385breakkeywordloops,83switchstatement,80buffer,outputbufferingoutputwithob_start()function,241creatingreusablelogoutbutton,247flushing,237,241buildFileList()customfunction,198–199resizingimages,214buildListFile4()customfunction,215,420buildListFile5()customfunction,215,419,420CcalculationsinPHP,66–68arithmeticoperators,66–67combiningcalculationsandassignment,68precedenceofarithmeticoperators,67camelcasing,50captionsaddingtorandomimage,107–112changingindynamicgallery,329carriagereturncharacter(\r),70casekeyword,switchstatement,79,80casesensitivity,SQL,343catchblock,305categoriesadding,424creatinglookuptable,418insertingimageinlookuptable,420–424,425"Cc:"header/stringautomatingreplyaddress,141blockingemailscontaining,136,137CHARtype,MySQL,299charactersextractingcompletesentences,385–388endingoncompleteword,383–384firstparagraph,384–385fixednumberofcharacters,382–383MySQLtextcolumntypes,299replacingwithothercharacters,101checkboxesgettingdatafrom,145–146checkedattribute,taggettingdatafromcheckboxes,145gettingdatafromradiobuttongroups,144chmodsettingsestablishinguploaddirectories,158client-sidevalidation,129closeCursor()function(PDO),313,315closedir()function,196closingfilesfclose()function,187closingtags,PHP,47codeincludes,91–115indenting,59–60modularizingwithfunctions,83–85nestingPHPcodeblocks,48puttingPHPcodeaboveDOCTYPEdeclaration,100repeating,80–83codehints,17collation,291,296columntypes,MySQL,299–301binarydata,301dateandtime,300numeric,300predefinedlist,301text,299columnsaddingextracolumnstotables,402–404breakingdowninformationinto,289description,286namingforgreatersecurity,351combinedassignmentoperators,68CommandLineClient(Windows)accessingMySQLthrough,269commandnotfounderror(MacOSX),275commandsseealsofunctionsechocommand,127,134endingcommands,51exitcommand,MySQLmonitor,276includecommands,91–93usecommand,MySQLmonitor,276commands,SQLDELETEcommand,378INSERTcommand,351–356,377SELECTcommand,374–376UPDATEcommand,377commentscommentingscripts,51,86httpd.
conffile,Apache,30php.
inifile,39multilinecomments,52single-linecomments,52comparisonoperators,PHP,77–78comparisonoperators,MySQL,375INDEX448comparisonsconditionalstatements,59compositeprimarykeycreatinglookuptable,417concatenationoperator(.
)combinedconcatenationoperator(.
=),68joiningstrings,62conditionaloperator(:),80gettingdatafromradiobuttongroups,144conditionalstatements,57–59aboveDOCTYPE,215breakkeyword,83comparisons,59creatingXHTMLoutputinside,111do.
.
.
whileloop,81elseclause,58elseifclause,58ifstatement,57,58logicaloperators,78–79whileloop,81configurationdirectives,PHPallow_url_fopen,181allow_url_include,181display_errors,42,386error_reporting,42extension_dir,42file_uploads,42,153,154log_errors,42max_execution_time,153max_input_time,153open_basedir,181post_max_size,153safe_mode,181safe_mode_include_dir,181upload_max_filesize,153upload_tmp_dir,153configurationsettings,PHPaffectingfileaccess,180–181affectingfileuploads,153configurationwindow,PHPcorecheckingifserversupportsuploads,153ConfigurationWizardconfiguringMySQLonWindows,265ConnectiontypeconfiguringphpMyAdmin,279connectionsbuildingdatabaseconnectionfunction,305–307connectingtoMySQLwithPHP,301–316checkingremoteserversetup,302–303howPHPcommunicateswithMySQL,303–305MySQLextension,303,314MySQLI,304,314PDO,304,315reusabledatabaseconnector,306–307socketconnectiontoremotefile,203updatingPHP/MySQLconnectorfiles,270–271constantsdefining,215description,160movingtemporaryfiletouploadfolder,160notusingindouble-quotedstring,344contentmanagementsystemcreatingbasicinsertandupdateforms,350–351settingup,347–374"Content-Type:"header/stringblockingemailscontaining,136,137continuekeyword,83cookieshowsessionswork,234invalidatingsessioncookie,237copy()functionfileuploadsecurity,177movingtemporaryfiletouploadfolder,161copyrightnoticeautomaticallyupdating,103–105count()function,PHP,106usingwithforloop,185COUNT()function,MySQLcountingrecordsinresultset,310,315selectingsubsetofrecords,333credentials,userauthenticatingwithdatabase,436–438authenticatingwithtextfiles,241–247ctype_alnum()function,432,434curlybracesinconditionalstatements,57–58infunctions,83indentationconventions,60withassociativearrayelements,372withvariablesindouble-quotedstrings,99currentpagegeneratingpagetitlefromfilename,98–103settingstyletoindicate,96–98usingPHPtoidentify,96–103custom-builtPHPfunctionslocatingcustom-builtfunctions,85Ddataaccessopeningremotedatasources,203–206datatypesinPHP,64–66weaktypinginPHP,64–65databasecolumnsseecolumnsdatabasefieldsseecolumnsdatabasequeriesseequeriesdatabasequeryresultsseeresultsdatabaserecordsseerecordsdatabaserowsseerecordsdatabasesseealsorelationaldatabaseschoosingdatabasemysql_select_db()function(MySQL),314select_db()method(MySQLI),314INDEX449connectingtoMySQLwithPHP,301–316contentmanagementsystem,347–374creatingdatabasetables,294–296creatinguseraccounts,291–294deletingrecords,371–373displayingresultsfromquery,311–313findingnumberofresultsfromquery,308–311flat-filedatabase,184information_schema(MySQL5),293insertingrecords,351–356insertingrecordswithphpMyAdmin,296–299keepingdatasafe,342–347makingreusabledatabaseconnector,306–307notstoringimagesindatabase,321updatingrecords,360–371usingphpMyAdmintocreate,291dateandtimecolumntypes,MySQL,300dateformatspecifiers,MySQL,389DATEtype,MySQL,300date()function,103description,61formatcharactersused,395formattingdatesinPHP,394usingtimestamptocreateuniquename,171datesaddingtoandsubtractingfrom,390–392culturaldifferences,388displayinginvariouslanguages,394displayingitemsupdatedwithinpastweek,391formatting,389–390insertingintoMySQL,396–399intervaltypes,391MySQLhandling,388–392PHPhandling,392–396creatingUnixtimestamp,393–394formattingdatesinPHP,394–396settingcorrecttimezone,392–393Unixepoch,392DATETIMEtype,MySQL,300DATE_ADD()function,MySQL,391DATE_FORMAT()function,MySQL,389–390DATE_SUB()function,MySQL,391DAYintervaltype,MySQL,391daysMySQLdateformatspecifiers,389PHPformatcharacters,395DAY_HOURintervaltype,MySQL,391dbConnect()customfunctionmakingreusabledatabaseconnector,306–307DECIMALtype,MySQL,300decisions,57–59comparisonoperators,77–78ifstatement,57,58switchstatement,79–80DECODE()function,MySQL441decrementoperator(--),66,67inforloops,82decryptionseeencryptiondefaultkeyword,switchstatement,80define()function,160DELETEcommand,378deletingrecords,371deletepagedeletingrecords,371–373linkingto,356–359DELETEprivilege,SQL,292deletingdatachoosingwrongfopen()mode,188deletingrecords,371–373maintainingreferentialintegrity,426DESCkeyword,357detailspage,building,410–414die()function,303replacingerrormessages,378directoriesclosedir()function,196inspectingdirectorycontents,195–197opendir()function,196open_basedirdirective,181readdir()function,196scandir()function,195displayingPHPoutput,61display_errorsdirectivePHPconfigurationsettings,42warningmessages,386DISTINCToption,SELECT,374DIVoperator,SELECT,376divisionoperator(/),66,375precedenceofarithmeticoperators,67do.
.
.
whileloop,81DOCTYPEdeclarationconditionalstatementabove,215puttingPHPcodeabove,100DocumentRoot,Apache,30DOCUMENT_ROOTvariable,$_SERVERarrayusingincludeswithabsolutepathnames,114Dollarsymbol($)escaping,70namingvariables,50doubledatatype,65doublequotesdifferencebetweensingleanddoublequotes,69escapingdoublequotecharacter,70preservinguserinputwhenformincomplete,134usingescapesequencesinside,70whentousequotes,56Dreamweaver,9,17drop-downmenubuildingdrop-downmenuoffiles,197–199gettingdatafrom,146–147insertingrecordswithalookuptable,419DSN(datasourcename)connectingtoMySQLwithPDO,315INDEX450dumpfile,MySQL,281DynamicExtensionssection,php.
ini,26,42EechocommandcreatingXHTMLoutputinsideconditionalstatement,111displayingPHPoutput,61displayingXHTMLinsidePHPblock,127preservinguserinputwhenformincomplete,134editorchoosingscripteditorforPHP,17–19EditPlus2,19else/elseifclauses,ifstatement,58sendingemailfromfeedbackform,127emdashHTMLentity(—),99emailaddingextraheaders,139automatingreplyaddress,140–142blockingspecificphrases,136–139encoding,139,140fulllistofheaders,139headerinjection,136includinguseraddressinheaders,139–142mailfunction,123messagebody,123PHPresponsibilityfordelivery,123processingandacknowledgingmessages,125–129redirectinguseraftersending,148sending,123–129fromfeedbackform,125–129subjectline,123trustedusers,123emptyarraysimplicitBooleanvalues,77usingarray()functiontocreate,74emptystringsimplicitBooleanvalues,77empty()function,131notempty,140updatingrecordswithMySQLextension,362ENCODE()function,MySQLtwo-wayencryption,430encodingemail,139,140URLencoding,120encryption,430–442AES_DECRYPT()function,MySQL,441AES_ENCRYPT()function,MySQL,430choosingencryptionmethod,430DECODE()function,MySQL,441ENCODE()function,MySQL,430encryptingpasswords,247–253one-wayencryption,430–438registeringnewusers,431–438userauthenticationwith,436–438salt,430SHA1algorithm,247,430,431sha1()function,252,434,437two-wayencryption,430,438–442decryptingpassword,441–442registeringnewusers,439–440userauthenticationwith,440–441usingencryptedlogin,252–253enctypeattribute,tagaddingfileuploadfieldtoforms,154ENUMtype,MySQL,301EOF(endoffile)feof()function,187equalitycomparisonoperator(=),MySQL,375differencebetweenPHPandMySQL,360equalitycomparisonoperator(==),PHP,77assignmentoperatorconfusion,51makingcomparisons,59ereg-typeregularexpressionfunctions,137errorcontroloperator(@)duringtesting,184preventingerrorswhenincludefilemissing,113errorelement,$_FILESarray,156errormessagesfatalerror,63MySQL,378notices,63parseerror,63stricterrors,64understandingPHPerrormessages,63–64warnings,63errorInfo()function(PDO),310errorscommandnotfound,275errorlevelsin$_FILESarray,157settingfilesizelimit,166"headersalreadysent"error,237preventingerrorswhenincludefilemissing,112–113toleranceoferrorsinPHP,8error_reportingdirective,42escapesequencesseealsobackslash(\)characterdoublequotes,69heredocsyntax,70usinginsidedoublequotes,70whentousequotes,56exceptionsPDO(PHPDataObjects),304execute()methodinsertingrecordswithMySQLI,354insertingrecordswithPDO,356MySQLIpreparedstatements,346namedplaceholders,PDO,346questionmarkplaceholders,PDO,346updatingrecordswithPDO,369,371exitcommand,MySQLmonitor,276exitcommand,PHP,243$expectedarraycheckingrequiredfieldsnotblank,131explicitBooleanvalues,76INDEX451explode()function,8insertingdatesintoMySQL,396readingtextfileintoarray,186exploringfilesystemseefilesystem,exploringExportsection,phpMyAdminbackupanddatatransfer,MySQL,283extensionsrecommendedPHPconfigurationsettings,42Windowsdisplayingfilenameextensions,21extension_dirdirective,42externalfilescallstofunctionsin,386creatingreusablelogoutbutton,247includecommands,91–93includes,91–115locatingcustom-builtfunctions,85externallinkscreatinganintelligentlink,416–417extract()function,373updatingrecordswithPDO,369,370EXTR_PREFIX_ALLconstant,373FfalsevalueexplicitBooleanvalues,76impactofusingquotes,56–57implicitBooleanvalues,77fatalerror,63fclose()function,187,195feedbackgatheringinformationfromforms,118–123sendingemailfromfeedbackform,125–129feof()function,187positionofinternalpointer,194,195fetch()method(PDO),315,325fetchColumn()method(PDO),310,313,315,334fetch_assoc()method(MySQLI),313,315fetch_row()method(MySQLI),315,334fgets()function,187controllingbytesretrieved,205positionofinternalpointer,194,195readingandwritingtogether,190readingfilecontentswith,189,190fieldscheckingrequiredfieldsnotblank,130–133creatingstickyformfields,134–136database,286,287fileaccessconfigurationsettingsaffecting,180–181minimumaccesspermissionsforscripts,180filecomparisonutilitycheckingscriptswith,19–20file()function,185–187filemanagement,180–209checkingpermissiontoopenfiles,180–182creatingdownloadlink,207–209exploringfilesystem,195–203openingremotedatasources,203–206readingandwritingfiles,182–195filestoragecreatingfolderforlocaltesting,181filesystem,exploring,195–203opendir()function,196–197readdir()function,196scandir()function,195–196fileuploads,152,177addingfileuploadfieldtoforms,154checkingifserversupports,153–154controllingtypesoffiles,167–169creatingfolderforlocaltesting,158directivesettingsaffectingmax_execution_time,153max_input_time,153post_max_size,153upload_max_filesize,153upload_tmp_dir,153howPHPhandles,152–158movingtemporaryfiletouploadfolder,159–162organizinguploadsintospecificfolders,172–173overwritingfileswithoutwarning,161permissions,158,159pointstowatchwith,177preventingfilesbeingoverwritten,169–172rejectinglargefiles,163–167removingspacesfromfilenames,162–163resizingimagesautomaticallyonupload,223–230security,177settingfilesizelimit,163–167understanding$_FILESarray,155–157uploadingmultiplefiles,174–177usingtimestamptocreateuniquename,170–172vanishingfileafteruploading,155filenameextension,PHP,47includes,94–95using.
incforincludes,94,95using.
inc.
phpasdoubleextension,94filenamesextractingfrompathname,97generatingpagetitlefrom,98–103makingwebsafebyremovingspaces,162–163filesappendingcontentwithfopen()function,191automaticallynamingnextfileinseries,200–203buildingdrop-downmenuof,197–199checkingpermissiontoopen,180–182functionsforread/writeoperations,187readingandwritingtogether,190managingseefilemanagementreadingfiles,182–190,192–195combinedread/writeoperations,192fgets()function,187file()function,185–187file_get_contents()function,182–184fopen()function,189–190fread()function,187functionsfor,187movinginternalpointer,192INDEX452readingtextfileintoarray,185–187readingtextfileintostring,182–184uploadingfilesseefileuploadsusingfile-basedauthentication,241–247writingfiles,190–195combinedread/writeoperations,192fopen()function,190–192fwrite()function,187functionsfor,187movinginternalpointer,192–195writingnewfile,191–192$_FILESarray,155–157errorlevelsin,157settingfilesizelimit,166movingtemporaryfiletouploadfolder,160,161uploadingmultiplefiles,174,176filesize()function,250file_exists()function,110,113file_get_contents()function,182–184file_uploadsdirective,42checkingifserversupportsuploads,153uploadsdisabledbyhost,154flag,351flat-filedatabase,184floatdatatype,PHP,65FLOATtype,MySQL,300floating-pointnumberdatatype,PHP,65foldersbuildingdrop-downmenuoffiles,197–199locatingscriptsforwebserverprocessing,11organizinguploadsintospecific,172–173footersmovingtoincludefiles,92fopen()function,187,188appendingcontenttofilewith,191combinedread/writeoperations,192modes,187,188binaryfiles,188creatingfile-baseduserregistrationform,250positionofinternalpointer,194readingfilewith,189–190writingfileswith,190–192forloop,81–82foreachloop,82–83foreignkeys,288–289creatinglookuptable,417–418deletingrecordshavingdependent,425–427findingrecordswithoutmatching,414–416linkingimagestoarticles,402–409selectingrecordsfrommultipletables,410–414tablerelationships,400formelementnameattribute,121formsseealsowebpagesaddingfileuploadfieldto,154automaticinsertionofbackslashbeforequotes,124creatingbasicinsertandupdateforms,350–351creatingstickyformfields,134–136creatinguserregistrationform,431–436file-basedform,248–252differencebetweenpost/getmethods,119–122gatheringinformationfrom,118–123handlingmultiple-choiceformelements,142–148linkingtoupdateanddeletepages,356–359passinginformationthroughmultipageforms,256–258preservinginformationpassedbetween,256preservinguserinputwhenformincomplete,133–136redirectingtoanotherpage,148removingunwantedbackslashesfromforminput,124–125securitywithsuperglobals,122sendingemailfromfeedbackform,125–129usesof,118usingsessionsformultipageforms,256–258validatinguserinput,129–142fpassthru()functioncreatingdownloadlink,208fputs()function,190fread()function,187knowinghowmuchtoread,189positionofinternalpointer,194,195readingandwritingtogether,190free_result()method(MySQLI),315,406fseek()function,193fsockopen()function,203–206functionkeywordmodularizingcodewithfunctions,83functionsseealsocommandsbuildingdatabaseconnectionfunction,305–307callstofunctionsinexternalfiles,386dateandtimefunctions,MySQL,388–392dateandtimefunctions,PHP,392–399functionnaminginPHP,8introduction,60–61locatingcustom-builtfunctions,85modularizingcodewith,83–85nestingfunctions,100passingmultipleargumentsto,98passingvaluesto,84–85recursivefunctions,138returningvaluesfrom,85usingparentheses,309functions,MySQLADDDATE(),391AES_DECRYPT(),441AES_ENCRYPT(),430COUNT(),310,315,333DATE_ADD(),391DATE_FORMAT(),389–390DATE_SUB(),391DECODE(),441ENCODE(),430LEFT(),383NOW(),349INDEX453SUBDATE(),391UNIX_TIMESTAMP(),394functions,PHParrayarray(),74array_key_exists(),126,155,199count(),106explode(),186extract(),373implode(),146in_array(),145is_array(),330list(),217natcasesort(),199print_r(),75,86,121functions,PHPcustombuildFileList(),198–199buildListFile4(),215buildListFile5(),215dbConnect(),306getFirst(),385getNextFilename(),200–203isSuspect(),137nukeMagicQuotes(),124,125functions,PHPDataObjects(PDOmethods)bindParam(),347closeCursor(),313,315errorInfo(),310,347execute(),346fetch(),315fetchColumn(),310,315getMessage(),305prepare(),356query(),310,315quote(),344functions,PHPdateandtimedate(),103,394–396mktime(),393strftime(),394strtotime(),393time(),170functions,PHPemailmail(),123functions,PHPfilemanagementbasename(),97closedir(),196copy(),161fclose(),187feof(),187fgets(),187file(),185–187filesize(),250file_exists(),110file_get_contents(),182–184fopen(),187fpassthru(),208fputs(),190fread(),187fseek(),193functions,PHPfilemanagement(continued)fsockopen(),203–206fwrite(),187is_readable(),110is_uploaded_file(),177mkdir(),172move_uploaded_file(),159opendir(),196–197parse_url(),417pathinfo(),199readdir(),196rewind(),187scandir(),195–196simplexml_load_file(),206functions,PHPimagemanipulationgetimagesize(),108imagecopyresampled(),220imagecreatefromgif(),219imagecreatefromjpeg(),219imagecreatefrompng(),219imagecreatetruecolor(),220imagedestroy(),223imagegif(),221imagejpeg(),221imagepng(),221functions,PHPmathrand(),105round(),220functions,PHPMySQLmysql_connect(),303,314mysql_error(),309mysql_fetch_assoc(),312,314mysql_fetch_row(),314mysql_insert_id(),423mysql_num_rows(),309,314mysql_query(),308,314mysql_real_escape_string(),343mysql_select_db(),304,314functions,PHPMySQLImproved(methods)bind_param(),345bind_result(),366fetch_assoc(),313,315fetch_row(),315free_result(),315mysqli(),304,314mysqli_error(),309mysqli_real_escape_string(),344prepare(),345query(),309,314select_db(),314stmt_init(),345functions,PHPscriptandvariablecontroldefine(),160die(),303empty(),131exit,243function_exists(),113INDEX454header(),148include(),85ini_set(),104isset(),103is_array(),330is_numeric(),361ob_end_flush(),237ob_start(),237require(),85unset(),131functions,PHPsessionsession_name(),237session_register()(deprecated),237session_unregister()(deprecated),237setcookie(),237functions,PHPstringaddslashes(),343ctype_alnum(),432explode(),186htmlentities(),134implode(),146nl2br(),189,385number_format(),164preg_match(),432preg_replace(),218rtrim(),186sha1(),252simplexml_load_string(),206strlen(),206strops(),206,257,384strrpos(),384strtolower(),102strtoupper(),102str_replace(),101substr(),206,382trim(),249ucfirst(),100ucwords(),101wordwrap(),127function_exists()function,113,125callstofunctionsinexternalfiles,386creatingscaled-downimagecopy,222fwrite()function,187argumentsfor,190positionofinternalpointer,194Ggalleryactivatingthumbnails,327–330buildingdynamicelements,326–339convertinggalleryelementstoPHP,323–326creatingmulticolumntableforthumbnails,330–331navigatingthroughsubsetofrecords,336–339pagingthroughalongsetofrecords,332–339planninggallery,321–323selectingsubsetofrecords,332–336GDextension,212–213$_GETarraydescription,54passinginformationthroughquerystring,329,330,360,361,365,369securitywithsuperglobals,122writingscriptswithoutregister_globals,122getmethodbookmarkingsearchresults,122postmethodcompared,119–122sendingdatawith,121getFirst()customfunctiondisplayingfirsttwosentencesofanarticle,388extractingcompletesentences,385getimagesize()function,108,110,325,326resizingimages,217getMessage()method(PHPexceptions),305getNextFilename()customfunctionautomaticallynamingnextfileinseries,200–203savingoriginalandresizedimages,230GIFacronymexpanded,213checkingGDextensionenabled,212–213imagetypenumber,217GoLiveasscripteditorforPHP,18graphicalinterfaceusingMySQLwith,277–281greaterthancomparisonoperator(>),78makingcomparisons,59SELECTcommand,375Hheader()function,148buildingloginpage,243creatingdownloadlink,208,209creatingreusablelogoutbutton,246"headersalreadysent"error,237usingsessionsformultipageforms,256headersaddingextraemailheaders,139emailheaderinjection,136fulllistofemailheaders,139includinguseraddressin,139–142"headersalreadysent"sessionerror,237heightattribute,tagdisplayingvaryingsizesofimages,106,110,111resizingimages,217heredocsyntax,70hiddenfieldspreservinginformationpassedbetweenforms,256hostingcompaniescheckingGDextensionenabled,213checkingifserversupportsuploads,153–154checkingPHPversiononserver,17checkingwebsitesupportsPHP,16–17connectingtoMySQLwithPHP,301rejectinglargefilesasuploads,163INDEX455hostnameconfiguringphpMyAdmin,279howPHPcommunicateswithMySQL,303hoursMySQLdateformatspecifiers,389PHPformatcharacters,395htdocsfolder,31HTML(HypertextMarkupLanguage)mixing.
htmland.
phppages,64htmlentities()function,134,135,362,367,370httpd.
conffile,Apache,30,32$HTTP_GET_VARSarray(deprecated),123HTTP_HOSTvariable,$_SERVERarray,417$HTTP_POST_VARSarray(deprecated),123HTTP_REFERERvariable,$_SERVERarray,417Iidattribute,tagduplicatingvalueinnameattribute,119identicalcomparisonoperator(===),77readingtextfileintostring,184ifstatementelseclause,58elseifclause,58sendingemailfromfeedbackform,127makingcomparisons,59makingdecisions,57IIS(InternetInformationServices)choosingwebserverforWindows,22configuringforPHPonWindows,32–34imagecopyresampled()function,220,221imagecreatefromgif()function,219imagecreatefromjpeg()function,219imagecreatefrompng()function,219imagecreatetruecolor()function,220imagedestroy()function,223imagegif()function,221,222imagejpeg()function,221,222imagepng()function,221imagesaddingcaptiontorandomimage,107–112creatingdynamiconlinegallery,321–339displayingrandomimage,105–107displayingvaryingsizesof,90,106generatingthumbnails,212–230getimagesize()function,108imagetypenumbers($_FILESarray),217manipulatingdynamically,213–223MIMEtypes,167notstoringindatabase,321promptingusertodownload,207–209resizing,213–230automaticallyonupload,223–230calculatingscalingratio,215–217creatingscaled-downcopy,217–223mergingwithimageupload,223–228savingoriginalandresizedversions,228–230uploading,161,166,170implicitBooleanvalues,77implode()function,146,148Importtab,phpMyAdminbackupanddatatransfer,MySQL,283IN()comparisonoperator,SELECTcommand,375,376usingabsolute/relativepathnames,94includes,90–115creatingpageswithchangingcontent,103–112filenameextensionfor,94–95includecommands,91–93mergingimageuploadwithresizing,223movingfooterto,92movingnavigationmenuto,92preventingerrorswhenmissing,112–113securityissueschoosinglocationforincludefiles,114includingfilesfromotherservers,115using.
incasfilenameextension,94,95using.
inc.
phpasdoubleextension,94usingwithabsolutepathnames,114include_once()command,91incrementoperator(++),66,67forloops,82indentingcode,59–60indexedarrays,73addingnewelementtoend,74description,53usingarray()functiontobuild,74inequalitycomparisonoperator(!
=),77information_schemadatabase,293initializinganarray,74ini_set()function,104settingcorrecttimezone,393injectionemailheaderinjection,136SQLinjection,342–343InnoDBtables,265,266tagduplicationofname/idattributes,119INSERTcommand,377auto_incrementcolumns,377creatingbasicinsertform,350INSERTprivilege,SQL,291insertingrecords,351–356usingMySQLextension,351–353usingMySQLI,353–355usingPDO,355–356INTtype,MySQL,300integerdatatype,65internallinkscreatinganintelligentlink,416–417internalpointersseepointersINTERVALkeyword,MySQL,391INTOkeyword,INSERTcommand,377in_array()function,145,199issetfunction(),103,113,362isSuspect()customfunction,137,138INDEX456is_array()function,330,374is_numeric()function,361is_readable()function,110,113is_uploaded_file()function,177,226JJaguar(OSX10.
2)MySQL5notsupported,271PHP5Macpackagenotavailable,39JapanJourneysite,12Japanese-languagesite,6,7JavaScript,5joiningstrings,62combinedconcatenationoperator,68join,left,415JPEGacronymexpanded,213checkingGDextensionenabled,212–213creatingscaled-downimagecopy,221imagetypenumber($_FILESarray),217Kkeystwo-wayencryption,430keywords,MySQLAS(alias),383BETWEEN(comparisonoperator),375,376DESC(sortorder),357INTERVAL(date),391INTO(INSERT),351,377LIKE(comparisonoperator),375,376LIMIT(SELECT),332,376keywords,PHPbreak(loops),80,83case(switch),79,80catch(try/catchblocks),305continue(loops),83default(switch),80functionkeyword,83new(objects),304return(functions),85this(objects),50LLEFTJOIN,MySQL,414,415LEFT()function,MySQL,383lessthancomparisonoperator(tag,119methodsseefunctionsMicrosoftAccess,286MIMEtypescontrollingtypesoffilesforupload,167fileuploadsecurity,177tableofcommonlyused,167minutesMySQLdateformatspecifiers,389PHPformatcharacters,395mkdir()function,172mktime()function,393modesfopen()function,187,188binaryfiles,188creatingfile-baseduserregistrationform,250safe_modedirective,181safe_mode_include_dirdirective,181modularizingcodewithfunctions,83–85locatingcustom-builtfunctions,85passingvaluestofunctions,84–85returningvaluesfromfunctions,85ModuleSettingssection,php.
ini,27modulodivisionoperator(%),66,67,330MONTHintervaltype,MySQL,391monthsMySQLdateformatspecifiers,389PHPformatcharacters,395move_uploaded_file()functionfileuploadsecurity,177movingtemporaryfiletouploadfolder,159,161savingoriginalandresizedimages,228,230settingfilesizelimit,166multidimensionalarrays,65,75MultifunctionalDatabasetype,265,268multilinecomments,52multiple-choicelistgettingdatafrommultiple-choicelist,147–148multiplicationoperator(*),66,375precedenceofarithmeticoperators,67MyISAMtables,265MySQLseealsoSQL(structuredquerylanguage)ADDDATE()function,391AES_ENCRYPT()function,430aliases,383ASkeyword,383backticks(`),290backupanddatatransfer,281–283buildingdatabaseconnectionfunction,305–307casesensitivity,290changestoinstallationoroperationof,12columntypes,299–301connectingwithPHP,301–316checkingremoteserversetup,302–303howPHPcommunicateswithMySQL,303–305MySQLextension,303,314MySQLI,304,314PDO,304,315creatingdatabasetables,294–296creatingdatabase-specificuseraccounts,291–294dateformatspecifiers,389dates,388–392addingtoandsubtractingfrom,390–392displayingitemsupdatedwithinpastweek,391formatting,389–390DATE_ADD()function,391DATE_FORMAT()function,389–390DATE_SUB()function,391displayingresultsfromquery,311–313downloadpage,263drawbacks,262ENCODE()function,430errormessages,378findingnumberofresultsfromquery,308–311formattingdateortimestamp,390INDEX458IN()comparisonoperator,375insertingdatesinto,396–399insertingrecordsintotables,296–299manually,296–297loadingimagerecordsfromSQLfile,298–299INTERVALkeyword,391LEFTJOIN,414,415LEFT()function,383namingconventions/rules,290NOW()function,349privileges,291reasonsforchoosing,262–263SUBDATE()function,391UNIX_TIMESTAMP()function,394usingwithgraphicalinterface,277–281settingupphpMyAdmin,277–280usingolderversions,12usingphpMyAdmintocreatenewdatabase,291versions,12,263MySQL5,293MySQLAdministrator,277mysqlcommand,275mysqldatabase,293MySQLextensionconnectingtoMySQLwithPHP,303,314countingrecordsinresultset,308–309deletingrecords,372displayingresultsfromquery,311fetchingnextrowinresultset,328incorporatingvariablesintoSQLqueries,344insertingrecords,351–353linkingtoupdateanddeletepages,358makingreusabledatabaseconnector,306processingqueryandresults,412retrievingallrecords,387selectingsubsetofrecords,334updatingrecords,360–364MySQLimprovedextensionseeMySQLIMySQLmonitorusingonMacOSX,275–276usingonWindows,269MySQLonMacOSX,271–276downloadingandinstallingMySQL,271,272securing,275–276settingup,271–276addingMySQLtoPATH,273–274amendingPATHinbashshell,273–274amendingPATHintcshshell,274MySQLonWindowsinstallation,263–271startingandstoppingMySQLmanually,268uninstallingoldversionof,263updatingPHPconnectorfiles,270–271upgrading,264usingMySQLmonitoronWindows,269WindowsEssentialsversionofMySQLchangingdefaulttabletype,268configuring,265–268downloadfor,264installing,264–265MySQLonlinemanual,443MySQLQueryBrowser,277MySQLI(MySQLimprovedextension)connectingtoMySQLwithPHP,304,314countingrecordsinresultset,308–309deletingrecords,372displayingresultsfromquery,311fetchingnextrowinresultset,328incorporatingvariablesintoSQLqueries,345–346insertingrecords,353–355linkingtoupdateanddeletepages,358makingreusabledatabaseconnector,306,307processingqueryandresults,412retrievingallrecords,387selectingsubsetofrecords,334updatingrecords,364–368usingexternalvariables,344mysqli()function,304,314mysqli_error()method,309,378mysql_connect()function,8,303,314mysql_error()function,309,378mysql_fetch_assoc()function,312,314mysql_fetch_row()function,314,334mysql_insert_id()function,423mysql_num_rows()function,309,314mysql_query()functionconnectingwithMySQLextension,314countingrecordsinresultset,308insertingrecords,353retrievingallrecords,387updatingrecords,364mysql_real_escape_string()functionhandlingstringsinSQL,344insertingrecords,352SQLinjection,343updatingrecords,364usingexternalvariables,344mysql_select_db()function,304,314Nnameattribute,tagduplicatingvalueinidattribute,119formelement,121gettingdatafromcheckboxes,145gettingdatafrommultiple-choicelist,147gettingdatafromradiobuttongroups,143URLquerystrings,120nameelement,$_FILESarray,156movingtemporaryfiletouploadfolder,160uploadingmultiplefiles,176namedplaceholdersPDOpreparedstatements,346namingconventionsfileuploadsecurity,177MySQL,290INDEX459namingfilesautomaticallynamingnextfileinseries,200–203getNextFilename()customfunction,200–203natcasesort()function,199Navicat,277navigationmenumovingtoincludefiles,92negationoperator(!
),78nestingfunctions,100nestingPHPcodeblocks,48newfileonlymodes,fopen()function,188combinedread/writeoperations,192writingnewfile,191–192newkeyword,304newlinecharacter(\n),70removingwithrtrim(),186–187newlinesnl2br()function,385newsfeedhandlingXMLnewsfeed,206openingwithfsockopen()function,203nl2br()function,189displayingparagraphs,385nobody,runningPHPas,158Non-TransactionalDatabaseOnlytype,265notidenticalcomparisonoperator(!
==),78notnull,295Notepad,17notices(PHPerrortype),63NOW()function,MySQL,349nukeMagicQuotes()customfunction,72,73,124,125nullvalueimplicitBooleanvalues,77shouldnotbeinquotes,56numbershandlinginSQL,344MySQLnumericcolumntypes,300shouldnotbeinquotes,55,86writingnumbersinPHP,63number_format()function,164numericcolumntypes,MySQL,300num_rowsproperty(MySQLI),309,314Oobjectdatatype,65ob_end_flush()function,237,241creatingreusablelogoutbutton,247ob_start()function,237bufferingoutputwith,241one-to-manytablerelationship,400one-to-onetablerelationship,400one-wayencryption,430–438creatingtabletostoreuserdetails,431registeringnewusers,431–438SHA1algorithm,247,430userauthenticationwith,436–438OOP(object-orientedprogramming),304PHPand,4opendir()function,196–197openingfilescheckingpermissiontoopenfiles,180–182fopen()function,187openingtags,PHP,47,85open_basedirdirective,181operatorsarrayassignment(=>),74arithmetic,PHP,66–67arithmetic,MySQL,375assignment(=),68comparison,MySQL,375comparison,PHP,77–78concatenation(.
),62,68conditional(:),80equality(=),MySQL,375equality(==),PHP,77errorcontrol(@),113logical,MySQL,375logical,PHP,78–79precedenceofarithmeticoperators,67ternary(:),80ordie()expressionseedie()functionORoperator,logicalOR(||),78SELECTcommand,375WHEREclause,414ORDERBYclause,SELECTcommand,376outputdisplayingPHPoutput,61wheredisplayed,48overwritingdatachoosingwrongfopen()mode,188preventingfilesbeingoverwritten,169–172Ppagesseewebpagespagingmechanismcreatingintelligentlink,416–417navigatingthroughmanyrecords,332–339paragraphsdisplaying,385extractingfirstparagraph,384–385PARAM_XYZconstantsnamedplaceholders,PDO,347parseerror,63parse_url()function,417passwordsaddingsaltbeforeencrypting,248,252AES_DECRYPT()function,441buildingloginpage,242,244cautionusing.
incfilenameextension,94,95configuringMySQLonWindows,267DECODE()function,441decrypting,441–442encrypting,247–253howPHPcommunicateswithMySQL,303one-wayencryption,430INDEX460securingMySQLonMacOSX,275–276storinginsessionvariables,235two-wayencryption,430,438–442updatinguserdetails,442pathinfo()function,199pathsaddingMySQLtoPATHinOSX,273–274amendingPATHinbashshell,273–274amendingPATHintcshshell,274extractingfilenamefrom,97usingincludeswithabsolutepathnames,114PathsandDirectoriessection,php.
ini,26PCRE(Perl-compatibleregularexpression),137PDO(PHPDataObjects)connectingtoMySQLwithPHP,301,315countingrecordsinresultset,310–311deletingrecords,373displayingresultsfromquery,311exceptions,304fetchingnextrowinresultset,328howPHPcommunicateswithMySQL,304–305incorporatingvariablesintoSQLqueries,346–347insertingrecords,355–356makingreusabledatabaseconnector,306,307processingqueryandresults,412retrievingallrecords,387selectingsubsetofrecords,334updatingrecords,368–371usingexternalvariables,344PDO::PARAM_XYZconstantsnamedplaceholders,PDO,347permissionscheckingpermissiontoopenfiles,180–182establishinguploaddirectories,158minimumaccesspermissionsforscripts,180PHPcalculationsin,66–68changestoinstallationoroperationof,12checkingsettings,41–42checkingversiononserver,16–17checkingwebsitesupportfor,16–17choosingscripteditorfor,17–19configuringApacheforPHPonWindows,29–32configuringIISforPHPonWindows,32–34configuringtodisplayerrorsonMacOSX,39–40connectingtoMySQLwith,301–316dates,392–396creatingUnixtimestamp,393–394formattingdatesinPHP,394–396settingcorrecttimezone,392–393functionnamingin,8howhardisPHPtolearnanduse,8installingonMacOSX,38–41locatingscriptsforwebserverprocessing,11logicinwebpages,6necessityoffilenameextension,47necessityofPHPtags,47officialmeaningof,4OOPand,4originalname,4overview,46PHPpageessentials,46PHPpageoptionalparts,47platformssupported,4recognizingvariables,8recommendedconfigurationsettings,42safetyof,10securityanduserinput,10server-sidelanguages,5settinguponWindows,24–29addingPHPtostartupprocedure,27–29downloadingandconfiguringPHP,24–27testingonMacOSX,40testingonWindows,34–35toleranceoferrors,8usesotherthandirectoutput,48usingApacheonMacOSX,36–37startingandstoppingApache,36–37versions,12PHP6magicquotes,72register_globalssetting,122PHPcodeseecodePHPonlinemanual,442.
phppagesmixing.
htmland,64php.
inifilecheckingGDextensionenabled,213checkingPHPsettings,41configuringPHPtodisplayerrorsonMacOSX,39downloadingandconfiguringPHP,24,25,27updatingPHPconnectorfiles,271phpinfo()commandexaminingPHPconfigurationsettings,41–42securityconsiderationsonlivewebsite,154testingPHP,35,40phpMyAdminbackupanddatatransfer,MySQL,281–283changestotheinstallationoroperationof,12columntypes,MySQL,299–301configuringmanually,280configuringwithsetup.
php,278–279creatingdatabase,291creatingdatabasetables,294–296creatinguseraccounts,291–294downloadingandinstalling,277grantinguserprivileges,292–294insertingrecordsintotables,296–299insertingrecordsmanually,296–297loadingrecordsfromSQLfile,298–299launching,280loggingoutof,281settingup,277–280php_mysql.
dll/php_mysqli.
dllfilesupdatingPHPconnectorfiles,270,271INDEX461PHP_SELFvariable,$_SERVERarray,327placeholdersMySQLIpreparedstatements,345PDOpreparedstatements,346PNGabbreviationexpanded,213checkingGDextensionenabled,212–213imagetypenumber($_FILESarray),217pointer,fileinternalfopen()functionmodes,188movinginternalpointer,192–195positioninginternalpointer,188rewind()function,187portsconfiguringMySQLonWindows,266connectingtoMySQLwithPDO,316installingApacheonWindows,23POSIXregularexpressions,137$_POSTarrayblockingemailscontainingspecificphrases,138checkingifempty,361checkingrequiredfieldsnotblank,130deletingrecords,372description,54eliminatingmagicquotes,124gettingdatafromcheckboxes,145fromdrop-downoptionmenu,146frommultiple-choicelist,147fromradiobuttongroups,143postmethod,121post_max_sizedirective,153preservinginformationpassedbetweenforms,256preservinguserinputwhenformincomplete,133,134securitywithsuperglobals,122sendingemailfromfeedbackform,125,126,128,129writingscriptswithoutregister_globals,122postmethodgetmethodcompared,119–122sendingdatawith,121post_max_sizedirective,153hostcompanylimitsaffecting,154tags,121readingtextfileintoarray,185precedenceofarithmeticoperators,67predefinedlistcolumntypes,MySQL,301preg_match()function,432preg_replace()function,218,386prepare()methodinsertingrecordswithPDO,356MySQLIpreparedstatements,345preparedstatementsdefenseagainstSQLinjection,343preparedstatements,MySQLIbindingparameters,354incorporatingvariablesintoSQLqueries,345–346insertingrecordswithMySQLI,354,366preparedstatements,PDObindingparameters,356incorporatingvariablesintoSQLqueries,346–347primarykeys,287–288compositeprimarykey,417creatinglookuptable,417–418description,286foreignkeyslinkingto,288–289renumberingsequences,288printcommandcomparisonwithecho,61creatingXHTMLoutputinsideconditionalstatement,111displayingPHPoutput,61displayingXHTMLinsidePHPblock,127print_r()functioninspectinganarray,75,121privileges,SQL,291grantinguserprivileges,292–294.
profilefilesettingupMySQLonMacOSX,273,274punctuationgetFirst()customfunction,385QQUARTERintervaltype,MySQL,391queriescountingrecordsinresultsetMySQL/MySQLI,308–309PDO,310–311displayingresultsfrom,311–313incorporatingvariablesinto,344–347mysql_query()function,314query()method,314,315querystringspassinginformationthrough,327–330URLs,120questionmarkplaceholdersMySQLIpreparedstatements,345PDOpreparedstatements,346quirksmodeputtingPHPcodeaboveDOCTYPEdeclaration,100"HTMLentity,135quotesautomaticinsertionofbackslashbefore,124doublequotes,69handling,68handlingstringsinSQL,344htmlentities()function,134magicquotes,69,71–73eliminating,124–125matching,55,56preservinguserinputwhenformincomplete,134singlequotes,69updatingrecordswithMySQLI,367usingdoubleorsinglequotes,69whentouse,55specialcases(true/false/null),56INDEX462Rrmode,fopen()function,188readingfileswithfopen(),189–190r+mode,fopen()function,188combiningread/writeoperations,192,193creatingfile-baseduserregistrationform,250radiobuttongroupsgettingdatafrom,143–144rand()function,105randomimagesaddingcaptionto,107–112displaying,105–107RDMS(relationaldatabasemanagementsystem),290read-onlymodes,fopen()function,188read/writemodes,fopen()function,188readdir()function,196readingfilesseeunderfilesrecordscountingrecordsinresultsetMySQL/MySQLI,308–309PDO,310–311deleting,371–373havingdependentforeignkeys,425–427description,287extractingfetch_assoc()method(MySQLI),315fetch_row()method(MySQLI),315mysql_fetch_assoc()function(MySQL),314mysql_fetch_row()function(MySQL),314query()method(MySQLI),314query()method(PDO),315fetch()method(PDO),315finding,withoutmatchingforeignkey,414–416gettingnextrecord,315goodrelationaldatabasedesign,289inserting,351–356intotables,296–299withlookuptable,418–424navigatingthroughsubsetof,336–339pagingthroughalongsetof,332–339selectingfrommultipletables,410–414selectingsubsetof,332–336updating,360–371withlookuptable,424–425recursivefunctions,138referentialintegritydeletingrecordshavingdependentforeignkeys,425–427registeringnewuserscreatinguserregistrationform,431–436enteringduplicatedusername,435enteringinvaliddata,435one-wayencryption,431–438two-wayencryption,439–440register_globalssetting,122regularexpressionsautomatingreplyaddress,141blockingemailscontainingspecificphrases,136creatingscaled-downimagecopy,218Perl-compatible,137POSIX,137relationaldatabasesseealsodatabasesbreakingdowninformationfor,289foreignkeysseeforeignkeysgoodrelationaldatabasedesign,289howdataisstoredin,286–289lookuptable,417–425primarykeysseeprimarykeystablerelationships,400–402workingwithmultipledatabasetables,400–427relativelinkssiterootrelativelinks,114remoteaccesscheckingremoteserversetup,302–303openingremotedatasources,203–206repeatingcodeloops,80–83"Reply-To:"header,139automatingemailreplyaddress,141$_REQUESTarraycomparisonwith$_POSTand$_GET,123require()command,91requiredfieldscheckingnotblank,130,133require_once()command,91resizingimages,214–223automaticallyonupload,223–230calculatingscalingratio,215–217creatingscaled-downcopy,217–223mergingwithimageupload,223–228savingoriginalandresizedversions,228–230resourcedatatype,65resources,releasingdatabasecloseCursor()method(PDO),315free_result()method(MySQLI),315resultsetscountingrecordsinresultsetCOUNT()function,315MySQLandMySQLI,308–309mysql_num_rows()function(MySQL),314num_rowsproperty(MySQLI),314PDO,310–311displayingresultsfromquery,311–313fetchColumn()method(PDO),315fetchingnextrowinresultset,328findingnumberofresultsfromquery,308–311gettingsingleresult,315returnkeywordreturningvaluesfromfunctions,85rewind()function,187movinginternalfilepointer,193rootaccessconfiguringMySQLonWindows,267securingMySQLonMacOSX,275–276whentouse,291INDEX463round()function,220rows,287rtrim()functionreadingtextfileintoarray,186SsafetyofPHP,10safe_modedirective,181safe_mode_include_dirdirective,181saltencryptingpasswords,248,252,430one-wayencryption,431two-wayencryption,438scalingratiocalculating,215–217resizingimages,217scandir()functioninspectingdirectorycontents,195–196scope,variablepassingvaluestofunctions,84scripteditorchoosingforPHP,17–19scriptscheckingwithfilecomparisonutility,19–20commenting,51minimumaccesspermissionsfor,180SCRIPT_NAMEvariable,$_SERVERarray,97secondsMySQLdateformatspecifiers,389PHPformatcharacters,395secretkeystwo-wayencryption,430SecureSocketsLayer(SSL)connection,122,438securityaddingextraemailheaders,139,140blockingemailscontainingspecificphrases,136–139configuringMySQLonMacOSX,275–276configuringMySQLonWindows,267encryptingpasswords,247–253encryption,430–442one-wayencryption,430–438two-wayencryption,438–442establishinguploaddirectories,158file-basedauthentication,241–247file_exists()function,169filteringoutpotentialattacks,136–139includefileschoosinglocationfor,114includingfilesfromotherservers,115testingthesecurityofincludes,94–95using.
incasfilenameextension,94,95using.
inc.
phpasdoubleextension,94includinguseraddressinheaders,139–142insertingrecordswithMySQLextension,352keepingdatasafe,342–347movingfilestouploadfolder,161namingcolumnsforgreatersecurity,351security(continued)phpinfo()command,154pointstowatchwithfileuploads,177preventingerrormessagewhenincludefilemissing,113register_globalssetting,122sendingdatawithgetorpostmethod,121sessions,235SQLinjection,342–343storingsensitiveinformation,235superglobals,122transferringpassword,browsertoserver,438usingencryptedlogin,252–253SEEK_ENDconstant,fseek()function,193SELECTcommand,374–376*shorthandforallcolumns,375%wildcard,376_(underscore)wildcard,376BETWEENkeyword,375,376comparisonoperators,375DISTINCToption,374DIVoperator,376IN()comparisonoperator,375,376LIKEkeyword,375,376LIMITkeyword,376logicaloperators,375ORDERBYclause,376WHEREclause,375SELECTprivilege,SQL,291select_db()method(MySQLI),314semicolonsendingcommandsandstatements,51sentencesdisplayingfirsttwosentencesofarticle,386–388extractingcompletesentences,385–388sequencesrenumberingprimarykeys,288$_SERVERarrayDOCUMENT_ROOT,114HTTP_HOST,417HTTP_REFERER,417PHP_SELF,327SCRIPT_NAME,97Serverhostname/port/socketconfiguringphpMyAdmin,279howPHPcommunicateswithMySQL,303serverrootconfiguringApacheforPHPonWindows,30wheretostorePHPfilesonMacOSX,37server-sidelanguages,5,47toleranceoferrors,8,9serverscheckingifserversupportsfileuploads,153–154checkingPHPversionon,16–17checkingremoteserversetup,302–303$_SESSIONarraybuildingloginpage,243creatinganddestroyingsessionvariables,236endingsessionafterinactivity,253INDEX464restrictingaccesstopageusing,244–245usingsessionsformultipageforms,256–258usingsessionstorestrictaccess,239,240sessionvariablescreatinganddestroying,236storing,235storingsensitiveinformation,235sessions,234–258bufferingoutputwithob_start()function,241buildingloginpage,242–244cookies,234creatingPHPsessions,236creatingreusablelogoutbutton,245–247destroying,237encryptingpasswords,247–253endingafterinactivity,253–255"headersalreadysent"error,237howsessionswork,234–237invalidatingsessioncookie,237passinginformationthroughmultipageforms,256–258restrictingaccesstopageusing$_SESSION,244–245security,235settingsession.
save_pathonWindows,27settingtimelimiton,253–255userauthentication,235usingfile-basedauthentication,241–247usingformultipageforms,256–258usingtorestrictaccess,238–253session_destroy()command,237,240session_name()function,237session_register()function(deprecated),237session_start()commandbuildingloginpage,243creatingPHPsessions,236creatingsessionvariables,236endingsessionafterinactivity,253,255"headersalreadysent"sessionerror,237session_unregister()function(deprecated),237SETtype,MySQL,301setcookie()command,241"headersalreadysent"sessionerror,237setup.
phpconfiguringphpMyAdminwith,278–279SHA1algorithmencryptingpasswords,247,430sha1()functioncreatinguserregistrationform,434usingencryptedlogin,252SimpleXMLhandlingXMLnewsfeed,206simplexml_load_file()function,206simplexml_load_string()function,206singlequotes,55–56,69differencebetweensingleanddoublequotes,69htmlentities()function,135preservinguserinputwhenformincomplete,134single-linecomments,52siterootrelativelinks,114Sitesfolder(MacOSX)locatingwebfiles,37sizeelement,$_FILESarray,156uploadingmultiplefiles,176socketconnections,creating,203spacesfileuploadsecurity,177removingfromfilenames,162–163replacingunderscoreswith,101URLs,101specialcharactersescapesequencesindouble–quotedstrings,70SQL(structuredquerylanguage)seealsoMySQLcasesensitivity,343enhancingreadabilityofSQL,343handlingnumbers,344handlingstrings,344incorporatingvariablesintoSQLqueries,344–347MySQLextension,344MySQLIpreparedstatements,345–346PDOpreparedstatements,346–347keepingdatasafe,342–347mysql_real_escape_string()function,343quotes,344referentialintegrity,426rulesforwriting,343–344whitespace,343SQLcommandsDELETEcommand,378INSERTcommand,351–356,377SELECTcommand,374–376UPDATEcommand,377SQLexportcompatibilitybackupanddatatransfer,283SQLinjection,342–343SQLyogusingMySQLwithgraphicalinterface,277squarebracketcharactersescaping,70srcattribute,tagdisplayingfirstimage,326startupaddingPHPtoWindowsstartupprocedure,27–29statementsconditionalstatements,57–59endingstatements,51staticpageconvertingtodynamicPHPpage,323–339stmt_init()method(MySQLI),345strftime()function,394,395stricterrors,PHP,64strictmode,MySQL,266stringdatatype,65stringsseealso,functions,PHPstringcombinedconcatenationoperator(.
=),68definition,55extractingcharactersINDEX465completesentences,385–388endingoncompleteword,383–384firstparagraph,384–385fixednumberofcharacters,382–383handlinginSQL,344joining,62MySQLtextcolumntypes,299readingtextfileinto,182,184replacingcharactersin,101whentousequotes,55strlen()functioncheckinglengthofpassword,249,432findingendofsubstring,206strpos()function,206,257confusingwithstrrpos()function,384extractingfirstparagraph,384strrpos()functionconfusingwithstrpos()function,384endingcharacterextractoncompleteword,384strtolower()function,102strtotime()function,393strtoupper()function,102str_replace()function,101removingspacesfromfilenames,162SUBDATE()function,MySQL,391subjectline,mail()function,123substr()function,206endingcharacterextractoncompleteword,384extractingfixednumberofcharacters,382extractingfirstparagraph,384subtractionoperator(-),66,375precedenceofarithmeticoperators,67superglobalarrays,54$HTTP_GET_VARS(deprecated),123$HTTP_POST_VARS(deprecated),123$_FILES,155–157$_GET,54$_POST,54$_REQUEST,123$_SERVER,114$_SESSION,236securitywith,122switchstatement,79–80breakkeyword,80casekeyword,79defaultkeyword,80syntaxcoloringchoosingscripteditorforPHP,17syntaxerrorscheckingscriptswithfilecomparisonutility,19–20Ttabcharacter(\t),70tablerelationships,400–402lookuptables,402many-to-many,401one-to-many,400one-to-one,400tablesaddingextracolumnsto,402–404creatingdatabasetables,294–296definingimagestable,295–296deletingrecords,371–373displayingmulticolumntableinwebpage,330–331foreignkeyslinkingtoprimarykeys,288–289insertingrecordsinto,296–299,351–356lookuptablescreating,417–418insertingrecords,418–424updatingrecords,424–425selectingrecordsfrommultipletables,410–414updatingrecords,360–371workingwithmultipledatabasetables,400–427tablespace,InnoDBconfiguringMySQLonWindows,266tags,PHP,47,85closingtag(>),47nestingPHPcodeblocks,48openingtag(tagduplicationinname/idattributes,119preservinguserinputwhenformincomplete,136preventingunwantedwhitespace,136updatingrecordswithMySQLextension,362TextEditchoosingscripteditorforPHP,17TextWranglercheckingscriptswithfilecomparisonutility,20thiskeyword,50INDEX466thousandsseparatorinsertingwithnumber_format(),164writingnumbersinPHP,63throwingexceptions,305thumbnailimagesdisplayinginmulticolumntable,330,331fetchingnextimageinresultset,328generating,212,230resizingimages,214,223timesettingtimelimitonsessions,253–255timedirectivesmax_execution_timedirective,153max_input_timedirective,153timezonessettingthecorrecttimezoneinPHP,392–393time()functionseealso,functions,PHPdateandtimeendingsessionafterinactivity,253usingtimestamptocreateuniquename,170TIMESTAMPcolumnautomaticupdating,349–350TIMESTAMPtype,MySQL,300timestampsseealsoUnixtimestampsdifferencebetweenMySQLandPHPtimestamps,392formattingMySQLdateortimestamp,390mktime()function,393strtotime()function,393TINYBLOBtype,MySQL,301titlesgeneratingpagetitlefromfilename,98–103tmp_nameelement,$_FILESarray,156mergingimageuploadwithresizing,226movingtemporaryfiletouploadfolder,160TransactionalDatabaseOnlytype,265trim()function,249troubleshootingerrorcontroloperator,113makingsurePHPsupportsMySQLonWindows,271PHPinstallationproblemsonWindows,35usingcommentstodisablescript,52truevalueeffectofusingquotes,56–57explicitBooleanvalues,76implicitBooleanvalues,77trustedusers,mail()function,123try/catchblock,305two-wayencryption,438–442AES_DECRYPT()function,441AES_ENCRYPT()function,430,439–441creatingtabletostoreuserdetails,438decryptingpassword,441–442DECODE()function,441ENCODE()function,430,439–440passwords,430registeringnewusers,439–440userauthenticationwith,440–441typeelement,$_FILESarray,156controllingtypesoffilesforupload,168Uucfirst()function,100ucwords()function,101underscoresreplacingwithspaces,101SELECTcommand,376UniversalBinary(MacOSX),39Unixepoch,392Unixtimestampsseealsofunctions,PHPdateandtimecomparedwithMySQLtimestamps,392PHPhandlingdates,393–394preventingfilesbeingoverwritten,169usingtocreateuniquename,170–172UNIX_TIMESTAMP()function,MySQL,394unset()function,131,237destroyingsessionvariables,236UNSIGNEDattribute,INTtype,MySQL,300settinginphpMyAdmin,295UPDATEcommand,377creatingbasicupdateform,350updatingrecords,360withMySQLextension,362withMySQLI,367,368withPDO,370WHEREclause,377,378updatepagelinkingto,356–359updatingrecords,360–371UPDATEprivilege,SQL,292uploadingfilesseefileuploadsupload_max_filesizedirective,153upload_tmp_dirdirective,153URLencoding,120URLsallow_url_fopendirective,181allow_url_includedirective,181querystrings,120spacesin,101using$_SERVER['PHP_SELF'],327usecommand,MySQLmonitor,276userauthenticationseeauthenticationUserforconfigauth,phpMyAdmin,279userinputautomatingemailreplyaddress,140–142checkingrequiredfieldsnotblank,130–133filteringoutpotentialattacks,136–139gettingdatafromcheckboxes,145–146fromdrop-downoptionmenu,146–147frommultiple-choicelist,147–148fromradiobuttongroups,143–144handlingmultiple-choiceformelements,142–148INDEX467includinguseraddressinheaders,139–142PHPsecurityand,10preservingwhenformincomplete,133–136validating,129–142usernamesbuildingloginpage,242,244connectingtoMySQLwithPHP,303usersauthenticatingusercredentials,436–438creatingtabletostoreuserdetailsone-wayencryption,431two-wayencryption,438,439creatinguserregistrationform,431–436grantingMySQLuserprivileges,292–294promptingusertodownloadimages,207–209registeringnewusersone-wayencryption,431–438two-wayencryption,439–440updatinguserdetails,442Vvalidatinguserinput,129–142blockingemailscontainingspecificphrases,136–139checkingrequiredfieldsnotblank,130–133filteringoutpotentialattacks,136–139includinguseraddressinheaders,139–142preservinguserinputwhenformincomplete,133–136validationclient-sidevalidation,129datesforMySQLinput,396–399server-sidevalidation,129–142valuespassingvaluestofunctions,84–85returningvaluesfromfunctions,85usingarraystostoremultiplevalues,53whentousequotes,55VARCHARtype,MySQL,299settinginphpMyAdmin,295variables,48–51assigningvaluesto,50description,49hyphensnotpermittedinvariablenames,104–105incorporatingintoSQLqueries,344–347naming,50,85passingvaluestofunctions,84–85recognizinginPHP,8returningvaluesfromfunctions,85treatmentinsidedoublequotes,69usingplaceholdersMySQLIpreparedstatements,345PDOpreparedstatements,346whentousequotes,55versions,12checkingPHPversiononserver,16–17MySQL,263Wwmode,fopen()function,188writingfileswithfopen(),190–191w+mode,fopen()function,188combinedread/writeoperations,192creatingfile-baseduserregistrationform,250WAMPsettinguplocaltestenvironmentonWindows,21warnings,63weaklytypedlanguage,64,65,84webdesignunderstandingcodeunderlyingwebpages,5webfiles,locating,11,20definingApacheserverrootonWindows,30–31settinguponMacOSX,37usingIISonWindows,11,34webpagesseealsoformsaddingcaptiontorandomimage,107–112automaticallyupdatingcopyrightnotice,103–105buildingloginpage,242–244creatingmulticolumntable,330–331creatingpageswithchangingcontent,103–112creatingreusablelogoutbutton,245–247displayingarandomimage,105–107embeddingPHPin,47–48generatingpagetitlefromfilename,98–103mixing.
htmland.
phppages,64pagingthroughalongsetofrecords,332–339returningtosamepointinpagingmechanism,416–417planningdynamicimagegallery,321–323preventingerrorswhenincludefilemissing,112–113redirectingtoanotherpage,148restrictingaccessusing$_SESSION,244–245settingstyletoindicatecurrentpage,96–98understandingunderlyingcode,5usingPHPtoidentifycurrentpage,96–103wheretotest,20webserverschoosingforWindows,22locatingscriptsforprocessing,11server-sidelanguages,5websitescheckingPHPversiononserver,16–17checkingwebsitesupportsPHP,16–17gatheringinformationfromforms,118–123waysPHPbringstolife,4WEEKintervaltype,MySQL,391WHEREclause,375ANDoperator,414deletingrecords,371,378ORoperator,414tablerelationships,400updatingrecords,360,377,378whileloop,81whitespace,59–60removingwithtrim(),249SQL,343INDEX468widthattribute,tagdisplayingvaryingsizesofimages,106,110,111resizingimages,217WindowscheckingPHPsettings,41–42choosingwebserverfor,22configuringApacheforPHP,29–32configuringIISforPHP,32–34displayingfilenameextensions,21installingApacheon,22–24MySQLonseeMySQLonWindowssettinguplocaltestenvironmenton,21–35settingupPHPon,24–29settingupphpMyAdmin,277–281startingandstoppingApacheon,24testingPHPon,34–35URLforJapanJourneysite,12WindowsEssentialsversionofMySQLchangingdefaulttabletype,268configuring,265–268installing,264–265WindowsExtensionssection,php.
ini,26WinMergetool,20wordwrap()function,127write-onlymode,fopen()function,188writingfilesseeunderfilesXxmode,fopen()function,188writingnewfilewithfopen(),191–192x+mode,fopen()function,188combinedread/writeoperations,192creatingfile-baseduserregistrationform,250XAMMPsettinguplocaltestenvironmentonWindows,21XHTML(ExtensibleHypertextMarkupLanguage)creatingXHTMLoutputinsideconditionalstatement,111displayingXHTMLinsidePHPblock,127understandingcodeunderlyingwebpages,5XMLhandlingXMLnewsfeed,206YYEARintervaltype,MySQL,391yearsMySQLdateformatspecifiers,389PHPformatcharacters,395YEAR_MONTHintervaltype,MySQL,391ZzeroimplicitBooleanvalues,77
搬瓦工最近上线了一个新的荷兰机房,荷兰 EUNL_9 机房,这个 9 的编号感觉也挺随性的,之前的荷兰机房编号是 EUNL_3。这次荷兰新机房 EUNL_9 采用联通 AS9929 高端路线,三网都接入了 AS9929,对于联通用户来说是个好消息,又多了一个选择。对于其他用户可能还是 CN2 GIA 机房更合适一些。其实对于联通用户,这个荷兰机房也是比较远的,相比之下日本软银 JPOS_1 机房可...
Digital-VM商家目前也在凑热闹的发布六月份的活动,他们家的机房蛮多的有提供8个数据中心,包括日本、洛杉矶、新加坡等。这次六月份的促销活动全场VPS主机六折优惠。Digital-VM商家还是有一点点特点的,有提供1Gbps和10Gbps带宽的VPS主机,如果有需要大带宽的VPS主机可以看看。第一、商家优惠码优惠码:June40全场主机六折优惠,不过仅可以月付、季付。第二、商家VPS主机套餐1...
HostYun 商家以前是玩具主机商,这两年好像发展还挺迅速的,有点在要做点事情的味道。在前面也有多次介绍到HostYun商家新增的多款机房方案,价格相对还是比较便宜的。到目前为止,我们可以看到商家提供的VPS主机包括KVM和XEN架构,数据中心可选日本、韩国、香港和美国的多个地区机房,电信双程CN2 GIA线路,香港和日本机房,均为国内直连线路。近期,HostYun上线低价版美国CN2 GIA ...
phpinfo为你推荐
美国免费主机能介绍一个美国免费的ASP或PHP主机空间吗外国虚拟主机为什么淘宝上的 外国的虚拟主机 这么便宜?vps主机什么是vps主机便宜的虚拟主机哪儿有便宜的虚拟主机?网站空间域名网站制作 域名和空间重庆虚拟空间重庆虚拟主机租用那家好?手机网站空间我想建一手机网站,那位推荐一个域名便宜点的手机建站网址,空间小也没关系。网站空间免备案哪里能找到免费、免备案的空间?香港虚拟主机想买一个香港虚拟主机,大家推荐一下吧apache虚拟主机apache里面可以在虚拟主机里边设置虚拟目录吗?急,在线等!
已备案域名注册 webhostingpad kddi 美国主机代购 win8.1企业版升级win10 cpanel空间 免费个人空间申请 可外链相册 tna官网 上海服务器 服务器维护 美国盐湖城 酸酸乳 万网注册 碳云 蓝队云 windowsserver2012r2 美国十大啦 asp介绍 linux服务器系统 更多