Jump to content
xisto Community

SystemWisdom

Members
  • Content Count

    118
  • Joined

  • Last visited

Everything posted by SystemWisdom

  1. @jzyehoshua:You posted just as soon as i did! :PAnyway, I read your post and I do agree Wisdom is just as likely an answer as those listed.. And from the answer I posted above (courtesy of the AlchemyLab), Wisdom is related to the ONE THING as Intuition and Clarity of Being.Very insightful answer and I am glad to see others share ideas not in the list!
  2. That is a very good example, I never had thought of it that way! Thx for sharing that! Oh, and I mis-quoted myself earlier too, don't ask me how.. I was thinking one thing and wrote another.. I meant to say Hopefully some of you caught that mistake, but anyhow... And, as I mentioned earlier I would post the correct answer (courtesy of the AlchemyLab), and although they claim this is the Correct Answer, I believe it would be correct more for those who are at the highest level of spiritual being (something we are all capable of achieving) and at other levels other answers become more meaningful to us and further help our progression. Thank you to all for sharing their insightful answers, it is very interesting to read about the ideas of others! And keep posting your opinions!
  3. All very good answers! And yes, all answers on the list could potentially fit the riddle.. In fact, when I first saw the riddle (without having a list of choices) I assumed it was referring to Fire! (which is an Alchemical Substance nonetheless!)But I should note that the answer IS known, and I shall post it here in time, but for now I am interested in seeing the opinions of others!(cmat, I think the answer you were thinking of is 42, from "The Hitchhikers guide to the Galaxy" am I correct?)
  4. Basically, your answer could (should) change through time, and that change signifies your progression within the spiritual reality of the universe. Most importantly, you should choose that answer which YOU feel is most correct for you, and not be influenced by the choices of others. There is in the end however, 1 correct answer, and that, well, that is the Secret of Life! Isn't it? (It's not a big secret though, when you find the answer you will understand!) Remember: To be happy is to be successful in life!
  5. Without hate how could we define Love? Yet how can they be the polar opposites of each other? When you hate one thing, you grow a great love for its opposite (and vice-versa); thus Love & Hate coexist on the same plane, and both feed each other!However, Hate is NOT a Sin! The actions towards your feelings of Hate may be a Sin.The goal of all beings is to reach Personal Enlightenment and Self Liberation. Even Maslow's Hierarchy of Needs places Self-Actualization at the very top!To be happy is to be successful in life!
  6. Do You Know the Answer to this Ancient Riddle? --------------------------------------------------------------- Please select your answer above! --------------------------------------------------------------- Although this Riddle is Ancient in Origins, the translation of this question was taken from The Alchemy Lab, though they provide no correct answer. I personally believe that any answer you choose is the most correct for you, and indicates your level of progression within the spiritual world. The link above leading to The Alchemy Lab contains the same Riddle, but with a Hint relating to the Emerald Tablet of the Egyptians! Also, for those who are interested in Alchemy and/or Metaphysics, here is a free Personal Alchemy Quiz which may help to explain your level of progression within the spiritual world. Note: Nicolas Flamel was a real person who lived during the 15th Century, and was accreddited with having created the Real Philosopher's Stone. He is not just a character from J.K. Rowling's Harry Potter series books!
  7. PHP Dynamic Signatures using the GD Module ????[/tab]After much scowering on the internet to find a suitable tutorial on this subject, I came up empty-handed. So I was forced to learn it on my own through trial & error. And since I had discovered a lack of tutorials on this subject, I dediced to write one! Working Example: Abstract: ????Using the GD Module of PHP allows a developer to build custom Images with Dynamic Content. Such content could be the Requesting Users IP Address, Web-Browser Type, Operating System, even the number of times the user has seen the Image! ????Luckily, Xisto Supports the GD Module with PHP, so those who are hosted here on Xisto can take full advantage of this tutorial! (Hint: Get Hosted With Xisto!) By Rob J. Secord, B.Sc. (SystemWisdom) Intended Audience: Intermediate to Advanced PHP Web-Application Designers/Developers. Assumed knowledge: -- PHP Basics/Arrays -- OOP Concepts such as Classes -- MySQL Databases with PHP -- MIME-Type Headers Theory: ????First, we will start with a simple Image Background that has some appeal (It is recommended that you create a simple Image Template in your favorite Image Editing software, like Photoshop) and remember to leave some space for the dynamic content to be added. ????After that, we simply access the image using PHPs GD Module, and write some dynamic content to it. We then output the image as a GIF file format and set the MIME-Type Content Headers to reflect a GIF image. ????To add to the images dynamic content, we will track the number of times an individual user requests the image, and store that into a MySQL Database. For this we will also require a database connection to MySQL. ????On to the fun stuff! NOTE: You can Download a complete ZIP file containing all files used in this tutorial as well as the suggested directory structure, at the end of this tutorial! Implementation: For this tutorial, I will use the following file structure (all files will be covered in this tutorial): -- .htaccess -- install.php -- sig_syswiz.php (NOTE: Will be renamed to sig_syswiz.gif later in tutorial) -- images ????|--- systemwisdom.gif -- fonts ????|--- arial.ttf -- dynasig ????|--- dynasig.inc.php The Bold entries are Folders, and the Italic entries are Files. Now, imagine those are the real file and folder names, as I will use those names in examples for the rest of this tutorial. ????We will start off by making (or selecting) an image to use as our Image Template, for this tutorial I will use the image below: Image File: images/systemwisdom.gif ????You should copy your image to your web-server using the same directory structure as listed above (you could place it anywhere you want really, just be sure your PHP code can access it). Now that you know what the Image Template looks like, you can look at my Example Signature to compare it to the finished result. ????Next we will use a True-Type Font for writing our Dynamic Content to the image. This gives us more flexibility with our fonts than what PHP provides for us. For this tutorial I am using a simple Arial Type font, and you can find this font in your Windows\Fonts directory (or on the Internet) or you could use any other True-Type Font that you want to use. ????The font file should be added to your web-server using the same directory structure as listed above (fonts/arial.ttf). ????Next we will get into the Bulk of the PHP code to achieve our Dynamic Signature. This code will be a Class called 'DynaSig' in the dynasig/dynasig.inc.php file and could be re-used for other signatures as well. Note: Although the DynaSig Class file would require minor modifications to work with other signatures (mainly text locations), it could easily be enhanced to be more dynamic requiring no changes at all to the DynaSig Class file. That is an exercise I will leave up to you! ????Now, I will begin by showing you the completed class file, and I will then explain each part of it as we go along in this tutorial. Note: Although this class will work, it only provides basic functionality and much could be added to it, but we will keep it simple for this tutorial. The DynaSig Class file would look like the following: DynaSig Class file: dynasig/dynasig.inc.php <?phpclass DynaSig{ // Dynamic Signature Version var $m_szVersion; // True-Type Font Styles var $m_szFontFace; var $m_aFontColor; var $m_iFontSize; // Image Template File var $m_szRawImage; // Dynamic Image Object var $m_oRawImage; // Quote/Author Arrays for Random Quote var $m_szQuotes; var $m_szAuthor; function DynaSig() { // Version $this->m_szVersion = 'v1.0'; // Default Font Styles $this->m_szFontFace = ''; $this->m_aFontColor = Array( 255, 255, 255 ); $this->m_iFontSize = 12; $this->m_szRawImage = ''; $this->m_oRawImage = 0; // Random Quotations $this->m_szQuotes = Array(); $this->m_szAuthor = Array(); } // // PUBLIC MEMBER FUNCTIONS BELOW... // function SetImageFile( $szFile ) { $this->m_szRawImage = 'images/' . $szFile . '.jpg'; } function SetFontFile( $szFile ) { $this->m_szFontFace = 'fonts/' . $szFile . '.ttf'; } function SetFontColor( $iRed, $iGreen, $iBlue ) { $this->m_aFontColor[0] = $iRed; $this->m_aFontColor[1] = $iGreen; $this->m_aFontColor[2] = $iBlue; } function SetFontSize( $iSize ) { $this->m_iFontSize = $iSize; } function AddQuote( $szQuote, $szAuthor ) { if( strlen( $szQuote ) && strlen( $szAuthor ) ) { $this->m_szQuotes[] = $szQuote; $this->m_szAuthor[] = '- ' . $szAuthor; } } function Create() { $this->m_oRawImage = imagecreatefromjpeg( $this->m_szRawImage ); imagealphablending( $this->m_oRawImage, true ); // Bounds of Map Image $iWidth = imagesx( $this->m_oRawImage ); $iHeight = imagesy( $this->m_oRawImage ); // Get User Data $szIP = $_SERVER['REMOTE_ADDR']; $szOS = $this->GetOperatingSystem(); $szBrowser = $this->GetBrowser(); // Get User View Count $iViewCount = $this->CountViews( $szIP, $szOS, $szBrowser ); // Write User Data to Image $this->WriteTTF( 10, 48, 'Hello '.$szIP.', You have viewed '.$iViewCount.' of my posts!' ); $this->WriteTTF( 10, 61, 'You are using '.$szBrowser.' on '.$szOS.'!' ); // Print Random Quote to Image $iIdx = rand( 0, count($this->m_szQuotes) - 1 ); $this->WriteTTF( 10, ($iHeight - 20), $this->m_szQuotes[$iIdx] ); $this->WriteTTF( 50, ($iHeight - 8), $this->m_szAuthor[$iIdx] ); // Output Image to Browser imagegif( $this->m_oRawImage ); // Free Image Resource imagedestroy( $this->m_oRawImage ); return; } // // PRIVATE MEMBER FUNCTIONS BELOW... // function CountViews( $szIP, $szOS, $szBrowser ) { // Connect to Database $iConnID = mysql_connect( 'localhost', 'my_username', 'my_password' ); mysql_select_db( 'my_database', $iConnID ); // Query Database for Matching User $szQuery = 'Select * From DynaSigData Where UserIP=\''.$szIP.'\' And UserOS=\''.$szOS.'\' And UserBrowser=\''.$szBrowser.'\''; $szQueryID = mysql_query( $szQuery, $iConnID ); $szResultSet = mysql_fetch_array( $szQueryID ); @mysql_free_result( $szQueryID ); if( !$szResultSet ) { // User not found, first viewing.. $szQuery = 'Insert Into DynaSigData (UserViews, UserIP, UserOS, UserBrowser ) '; $szQuery .= 'Values ( 1, \''.$szIP.'\', \''.$szOS.'\', \''.$szBrowser.'\' ) '; mysql_query( $szQuery, $iConnID ); $iViewCount = 1; }else { // User found, add 1 to view count.. $iUserID = intval( $szResultSet['UserID'] ); $iViewCount = intval( $szResultSet['UserViews'] ) + 1; $szQuery = 'Update DynaSigData Set UserViews='.$iViewCount.' Where UserID='.$iUserID.';'; mysql_query( $szQuery, $iConnID ); } // Disconnect DB @mysql_close( $iConnID ); // Return View Count return $iViewCount; } function WriteTTF( $iLocX, $iLocY, $szText ) { $oColor = imagecolorallocate( $this->m_oRawImage, $this->m_aFontColor[0], $this->m_aFontColor[1], $this->m_aFontColor[2] ); imagettftext( $this->m_oRawImage, $this->m_iFontSize, 0, $iLocX, $iLocY, $oColor, $this->m_szFontFace, $szText ); } function GetOperatingSystem() { // Operating System Types $aUserOS = Array( 'Windows XP' => 'Windows NT 5.1', 'Windows 2000' => 'Windows NT 5.0', 'Windows NT 4.0' => 'Windows NT 4', 'Windows 9x' => 'Windows 9', 'Windows 9x' => 'Win 9', 'Windows Me' => 'Windows Me', 'Linux' => 'Linux', 'Macintosh' => 'Macintosh' ); // Check for Matching Operating System foreach( $aUserOS as $szKey => $szValue ) if( preg_match( '/' . $szValue . '/i', $_SERVER['HTTP_USER_AGENT'] ) ) $szUserOS = $szKey; // If OS Not Found, Set Default Operating System if( !isset( $szUserOS ) ) $szUserOS = 'Some Weird OS'; // Return Operating System return $szUserOS; } function GetBrowser() { // Browser Types $aUserBrowser = Array( 'Internet Explorer 6' => 'MSIE 6', 'Internet Explorer 5' => 'MSIE 5', 'Internet Explorer 4' => 'MSIE 4', 'Firefox' => 'Firefox', 'Netscape 7' => 'Netscape7', 'Netscape 6' => 'Netscape6', 'Opera' => 'Opera' ); // Check for Matching Operating System foreach( $aUserBrowser as $szKey => $szValue ) if( preg_match( '/' . $szValue . '/i', $_SERVER['HTTP_USER_AGENT'] ) ) $szUserBrowser = $szKey; // If OS Not Found, Set Default Browser Type if( !isset( $szUserBrowser ) ) $szUserBrowser = 'Some Weird Browser'; // Return Browser Type return $szUserBrowser; } } // End of Class?> ????First of all, you will see a Class Declaration named 'DynaSig' and within it, are a bunch of Member Variables. They are all self-explanitory (though I will explain them eventually anyway), as is the Constructor which sets their respective default values. Now assuming you understand Object-Oriented Programming, I trust you understand thus far.????Moving on, you will notice 4 Set Functions which are used to setup the Format of the Dynamic Signature Image. These are used directly after Creating a DynaSig Object to set the Image Template file, the True-Type Font file, the Font Color and the Font Size respectively. You will notice that the SetImageFile() and SetFontFile() functions automatically add the directory and the extension to the parameter passed in. This is a personal preferrence which simply enforces the file location and type. You may also notice that we are using JPEG type images as our Image Template. This is important due to the nature of JPEG and GIF Images, as we will discuss later in this tutorial. ????Next is the AddQuote() function, which is the same as the Set functions from above, the only difference is that this function accepts 2 parameters (namely the Quote and Author) and adds their values to arrays. These arrays will be used to draw out a random quote later in this tutorial and write it to the Dynamic Signature Image. ????Now since those were all very basic functions, I will not explain them as thuroughly as I will the next 2: ????The Create() function, which is the last of our 'Public Functions' and the last one we will call when using our DynaSig Object, will output a Dynamic GIF Image to the requesting users browser. ????From here, the Create() function will call all of the other 'Private Functions' used in the class. But the first thing our Create() function must do, is open an Image Handle to the Image Template file we will be using. This handle is a Copy of the Image Template and we can then alter it without altering the original Image Template File. We open this image handle using the imagecreatefromjpeg() function from the GD Module in PHP. ????Now the reason why we open the Image Template as a JPEG is because GIF Images store their color indexes internally. If you open a GIF image of solid black, for example, you would not be able to add additional colors, since the GIF file only has a color index of Solid Black. Basically, the more colors in the GIF file then the more colors you can use with the GD module. Alternatively, JPEG files do not have this limitation, therefore it is more flexible to open your Image as a JPEG to get access to more colors. In the end however, we will still be outputting a GIF (generated dynamically) as they tend to be smaller in size. ????Once we have the Image Handle opened, we can then determine the Images Size using the imagesx() and imagesx() functions. This will give us the Width and Height of our image (this could be used for dynamically positioning text). ????After that, we determine the users IP Address using the built-in PHP Global Server Variable $_SERVER['REMOTE_ADDR'] which gives us a string containing the requesting users IP address! Brilliant! ????Then we can query the requesting users HTTP Agent string contained in yet another PHP Global Server Variable called $_SERVER['HTTP_USER_AGENT'] which contains both the Operating System and Browser details. We simply match the patterns using Regular Expressions against some known types, and if a specified pattern exists, we know the users HTTP Agent! This can be seen in the GetOperatingSystem() and GetBrowser() functions at the bottom of the Class File. Since both of these functions are relatively simplistic I will not explain them in great detail, though feel free to ask questions if any of it confuses you. ????Next we Query our Database to find the requesting users View Count, or in other words, how many times the user has accessed out signature image! This is done in the CountViews() function and I will describe it in greater detail later. For now, know that it returns an integer containing the requesting users View Count. ????After all of that is done, all of our Information Gathering is complete, so now we will need to write that information to the image. This is accomplished by the WriteTTF() function which first allocates the correct Color (as set by the SetFontColor() function) for use in the Image, and then writes the Information to the Image according to the Font Styles defined by the Set functions. The most important part of this function are the first 2 parameters which specify the X and Y locations of where to write the text to the Image. ????Next we will write our random quote to the Image. By adding quotes to our class using the AddQuote() function, we essentially build an array of Quotes. To choose one of them, we simply generate a random number between the Upper and Lower Bounds of the Array. This is accomplished with the PHP rand() and count() functions. With our random number we use it to index our array of quotes to write one of them to the Image. This process is pretty straight-forward. ????Finally, the last part of the Create() function is to output the image to the requesting users browser and then release the Image Handle from memory. This is accomplished by calling imagegif() and imagedestroy() respectively. One thing to note though, is that PHP will now output an Image instead of a Web-Page. Since our browser sent a request for a PHP page, it is expecting a Web-Page in return, not just an Image. We will have to modify the MIME-Type Headers to reflect the new content-type later on, before we use this class and call its associated Create() function. That will be done in our next file. ????After the Create() function we have the CountViews() function, which is the last function we will need to discuss in our DynaSig Class file. As mentioned earlier, this function is used to Query the Database for the requesting user to count the number of times they have viewed our Dynamic Signature Image. ????The first thing you'll notice, is that it connects to a Database. Your Access Credentials for Your DB MUST be supplied here (unless you change the code a bit). Next it searches the database for a user who matches the requesting users IP, OS and Browser. All 3 are used in the search to lessen the likely-hood of 2 users joining with the exact same data, and thus preventing user A to view user B's view count. If the user IS found in the database, then we simply store the users view count in an interger variable, add 1 to it, and then update the database with the new view count. Otherwise, if the user IS NOT found, then we set the users view count to 1 and insert a new record in the database for the current user. That pretty much sums up the CountViews() function, and gives us the current users view count. ????Now with that file done, and out of the way, you can place it on your web-server in the suggested directory mentioned at the beginning of this tutorial, and we will link to that file in the next file we discuss; the sig_syswiz.php file, which creates an object of our DynaSig Class, supplies the Image Template File and the Font Styles, and finally creates the image for output. You could have several of these files all pointing to different Image Templates, setting differnet Font Styles and still use the same DynaSig Class file. ????Again, I will first show you the completed file and then we will walk through it together: Main file: sig_syswiz.php <?php// Set Content Type to GIF with NoCacheheader( "Content-type: image/gif" );header('Expires: ' . gmdate('D, d M Y H:i:s') . 'GMT');header('Cache-control: no-cache');// Include DynaSig Class filerequire( 'dynasig/dynasig.inc.php' );// Create DynaSig Object$oDynaSig = new DynaSig();// Set Image Template File$oDynaSig->SetImageFile( 'systemwisdom' );// Set Font Styles$oDynaSig->SetFontFile( 'arial' );$oDynaSig->SetFontColor( 88, 100, 133 );$oDynaSig->SetFontSize( 10 );// Add Some Custom Quotes$oDynaSig->AddQuote( 'I have not failed, I have just found 10,000 ways that won\'t work!', 'Thomas Alva Edison' );$oDynaSig->AddQuote( 'Give me a museum and I\'ll fill it!', 'Pablo Picasso' );$oDynaSig->AddQuote( 'Where the spirit does not work with the hand, there is no art.', 'Leonardo da Vinci' );// Create and Output the Image$oDynaSig->Create();?> ????The first thing I hope you notice, is the size of this file -- it is much smaller than the DynaSig Class File! Yay!????Next, you will notice that the Content-Type is set to GIF. Remember, when accessing this file, you are accessing a PHP file which by default outputs HTML as the content type. Since we are actually outputting a GIF Image through this PHP code, we need to change the content-type before-hand. Also, the image is set to expire immediately forcing it to not be cached, and instead re-processed with each request. ????After that, we can begin creating our Dynamic Image! We first include our DynaSig Class file for use within this script, and instatiate an object of our DynaSig Class. Next we tell it the filename of our Image Template file, followed by the True-Type Font file and the respective Font Styles (Color/Size). Next we can add as many Custom Quotes as we want using the AddQuote() function created earlier, and finally, we Create and Output the Dynamic Signature Image by calling the Create() function! ????That's almost all there is to it! Our Dynamic Signature Image is nearly ready to be used! But we just have one more thing to do to make it work! We have to create the database, which is dont with the following PHP script: Install file: install.php <?php// Connect to DB$iConnID = mysql_connect( 'localhost', 'my_username', 'my_password' );mysql_select_db( 'my_database', $iConnID );// Check for Connection Errorif( !$iConnID ){ $szErrorMsg = 'Installer: Database Connection Failed!<br><br>Database Error Num: '; $szErrorMsg .= mysql_errno() . '<br>Database Error:<br>' . mysql_error(); die( $szErrorMsg );}// Drop Old Tablemysql_query( 'Drop Table `DynaSigData`;', $iConnID );// Create New Table$szQuery = 'Create Table If Not Exists DynaSigData (';$szQuery .= '`UserID` INT UNSIGNED DEFAULT \'1\' NOT NULL AUTO_INCREMENT PRIMARY KEY,';$szQuery .= '`UserViews` INT UNSIGNED DEFAULT \'0\' NOT NULL,';$szQuery .= '`UserIP` TEXT,';$szQuery .= '`UserOS` TEXT,';$szQuery .= '`UserBrowser` TEXT';$szQuery .= ') TYPE = MyISAM COMMENT = \'DynaSig Data\';';mysql_query( $szQuery, $iConnID );mysql_close( $iConnID );?> ????The install file requires little explanation, as it merely creates the Required Database table for tracking the user View Counts. Again, you MUST point this file to Your Database using Your Database Access Credentials. This file should only be run once before testing the Signature Image, and after it has been run and your database is installed, you can safely delete this file off of your web-server. ????Now we are done! (Or are we?) ????You could now access your Dynamic Signature by typing the address into you URL bar of your browser, and you will see the Dynamic Image (Ex: http://myDomain.com/sig_syswiz.php), but that will not work in a Forum for an Image Tag (), because most forums do not allow you to post images with an extension of .PHP (or any extension other than those used for online images, like gif, jpg, png or bmp). So in order to make this work for online forums, we will have to trick the forums by Renaming our sig_syswiz.php file to sig_syswiz.gif and then telling PHP to parse GIF files as PHP files in our DynaSig directory. This last step is as easy as renaming the above mentioned file, and adding the following .htaccess file to the same directory as the sig_syswiz.gif file: HT Access file: .htaccess ????Now you will be able to use your new Dynamic Signature in Online Forums! Yay! Putting it all together: ????If you now take all of the code samples from above and organize them according to the Suggested File Structure mentioned at the beginning of this tutorial, you will have a working Dynamic Signature for use in Forums and the like! Remember: You will still have to point to Your Database using Your Database Credentials in the DynaSig Class file as well as in the Install File which builds the appropriate Database Table! Working Example: "http://forums.xisto.com/no_longer_exists/404.png /> Conclusion: ????Well, I hope that you have learned something useful from this tutorial, and maybe even use such a Signature in online forums! ????Please feel free to comment on this tutorial, if you noticed anything wrong or out of place in this tutorial, please don't hesitate to mention it! [tab]I am interested in all feedback really, I'm curious about what you think of my writing, tutorial, methods used, code, effectiveness, layout, etc.. Thanks! Download Complete ZIP Package of Tutorial Edit: Added a download link
  8. I would have to recommend PHP as well.. It is much easier to learn than JSP is.. Also, I see many more PHP hosts (including free ones) then I do see JSP hosts.. (although both can run on Apache servers).. JSP does have some security features such as compiled class files among other things..As far as CSS goes, it is Client-Side anyway, so any server-side language could produce it for the resulting HTML anyway... And Flash integration (server-side with DBs) would probably be eaiser with PHP (although I know JSP I have never integrated JSP with Flash on the server-side before)..All-in-all, I would say PHP would be a better choice, but that is just me!
  9. I have to agree, with Google around no other Search Engine is necessary.. If Google can't find it, it probably isn't on the internet.. (or at least restricted from public view)..Even GMail is amazing.. my favorite web-based email site so far..Not to mention the WebAPIs that allow web-masters to link google search directly into their own site!!In fact, I never even heard of Ask or WebSearch...
  10. I am not wrong, nor is the PHP online documentation.. You can go and argue this fact with the PHP developers if you want to.. Read: session_start Quoting the page: In most cases PHP will use cookie-based sessions (to store session id) unless the users browser doesn't accept cookies, then it will use the querystring method.. You see, when outputting *anything* to the browser (including white-space) the PHP processor first must prepare and send the MIME Type Headers for the requested page. If *any* output is sent to the client *before* session_start() then PHP has to send the Headers first. If the headers are sent before calling session_start() then PHP will not be able to append the SessionID to the page headers, and thus you will receive an error.. I didn't make this up, it IS the way PHP works!
  11. I am guessing you have some white-space (or anything) that is being output to the browser (meaning it is not inside of any PHP tags) in your /home/dynasty/public_html/New Folder/db_connect.php file at line 9.In order to use sessions, you must start your session before outputting *anything* to the browser.. Even white-space will cause this error for you, if the white-space is output before the call to session_start()..
  12. I have DL'd about 900+ free fonts from http://www.sketchpad.net/b6.htm The only problem with so many fonts is finding the right one!!
  13. When comparing strings you should encapsulate them with single or double quotes, in this situation I would recommend single-quotes, as in: // [...]if($answer=='yes'){ // [...]}if($answer=='no'){ // [...]}// [...] As far as the logic goes, well there are many different ways to do what you want, so yours may suite your needs.. And security? Well, I don't see much there, but you said you were gonna add that after so.. I hope that helps..
  14. PHP to allow only letters/numbers: function isAlphaNumeric( $szInput ){ return (bool) preg_match( '/^[a-zA-Z0-9]$/', $szInput );}// usage:if( isAlphaNumeric( 'mystring123' ) ){ // valid}else{ // invalid} I hope that helps!
  15. Some browsers support the background attribute in <TD> tags, but it is not a part of the standard.. meaning it will not validate under HTML4.01 or XHTML.. But that's not what you're looking for... To do the same with CSS you can use the style attribute combined with the 'background-image' property as in: <table> <tr> <td style="background-image: url(relative_path/my_image.gif)">My Cell</td> </tr></table> The code above will validate under both HTML 4.01 and XHTML.. I hope that helps!
  16. That's pretty neat! Is it thinking? No, but whoever made all those questions wasted *alot* of time! :PAnyway, I thought of a lighter, and after 25 questions and 3 guesses it got it right! First it asked me if it was a flashlight, then a torch, then finally a lighter! Pretty neat how the 3 guesses kinda related!!The sithsense one was cool too, but I'm not a StarWars fan..
  17. I really don't know if he is innocent or not to be 100% certain, but I do know of what statements he has made to the media in the past, and those alone would get anyone of us (not rich/famous) into prison real quick!As far as I know, he openly admitted to serving a minor with alcohol, and then he is found not guilty for it? C'mon!!! Smells to much like another O.J. trial to me... Money Talks!Just my 1.5 cents
  18. It is always nice to have an existing library of functions to serve your needs, and this is one of mine: function OpenSubWin( page, w, h, sb ){ var sw = screen.width, sh = screen.height; var ulx = ((sw-w)/2), uly = ((sh-h)/2); var sbt = (sb==1) ? 'yes' : 'no'; var paramz = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+sbt+',width='+w+',height='+h+''; var oSubWin = window.open( "", "SubWin", paramz ); oSubWin.moveTo( ulx, uly ); oSubWin.location.replace( page );} It not only simplifies the task of opening a new sub-window, but it also centers the sub-window on the users screen! I hope that helps, enjoy!
  19. I am doing the same thing in my game (kinda), did you break into my home and steal my plans? <jk> Anyway, the way I plan on doing what you have mentioned above involves the use of the GD (Graphics Device) Module for PHP. Using the GD module, you can draw the background map, and then place your character image right on top wherever you want, and then send that new combined image to the browser. Next, you would want to output the image into an <input type=image> tag, that way when a player clicks on the image it gets posted back to the page with the X, Y coordinates of where the player clicked. You can then move the player to that spot, or perform some other action! I hope you were able to follow that, here is a good site to learn about <input type=image> if you need to: Image Input Types Also, I have an example of my map online, but so far it only generates alternating town icons, and isn't posting X & Y coordinates back to my page yet.. Check it out here: Magick World Map (Please note, this is the very first public viewing of my map, and not all towns have been named, but please do not take my ideas! Thx!) Anyway, I hope that helps in some way!
  20. SQL Injection occurs via an input form (like a login), where the form accepts special characters (like !@#$%^ etc..). One of the easiest/best ways to prevent such a compromise is to disallow any special characters and force users to only use alphanumeric values when supplying input via a web-form (abc...123...). Even spaces should be considered invalid, since SQL injection involves the use of an SQL statement containing spaces to seperate keywords (select * from [table]). Also, you should use a URL Decoding method before validating the input, that way a %20 would get converted to a space, and filtered out (as well as any other invalid encoded characters). Doing that should thwart about 95% (if not 100%) of any SQL Injection techniques...
  21. I haven't figured it out yet :(Mac confuses me :PDo you know any Javascript at all? It sounds like a few javascript functions are not being recognized by Safari, amd I am having alot of trouble finding out which ones.. Theoretically, it should work fine, unless Safari browsers haven't followed basic standards for DHTML.. :(Maybe it has to do with it being on a Mac? Did you test it with IE and Firefox from Mac too, or was that on Windows?I am almost at the point of resolving to detect the Safari browser on Mac and just skip preloading altogether, so it doesn't cause problems... :(Well, ima keep looking for an answer, wish me luck!
  22. Sessions are more secure than cookies.. Cookies get passed back and forth from the client to the server, and can easily be caught as it goes along the network. Anything that is considered 'sensitive' material/data would need to be encrypted before being stored in a cookie. If shared hosts (like Xisto) concern you and/or you want to avoid possible Session Hijacking techniques, then a better way to protect your sessions is to setup a Custom Session Handler using a DB and store all session data in the DB. Then, with every user privelage escalation (like a Login) you simply regenerate the users Session ID to prevent it from being Hijacked. Also, storing Sessions in a cookie presents other problems as well. Some people disable cookies, forcing get/post alternatives (ever see a long encrypted SessionID in your URL bar?), which could limit the user from seeing your site altogether. Also, many browsers limit the size of the cookies they accept, and to be on the safe side, you should not exceed 4kb (4096 bytes) in a single cookie, otherwise some browsers may truncate the cookie data. Overall, I would recommend utilizing both methods to maximize your security, and you can read up on both of these methods and more at PHP Security Consortium. @Hmmz: Is it the one entitled "Incredible Secure Authentication"? I would like to see what types of security measures you have considered in your tutorial. I am writing a tutorial myself on Secure Authentication and is quite large to say the least. I am curious to see if our systems are very similar or very distinct! If it is too similar, I guess you beat me to posting then, 'cause I wouldn't want to post anything like a copy-cat tutorial! I look forward to reading it!
  23. Yes, it can be done without PHP, just look at the example I posted using HTML..
  24. Using PHP: if( !headers_sent() ){ header('Expires: ' . gmdate('D, d M Y H:i:s') . 'GMT'); header('Cache-control: no-cache');} Or using plain HTML: <META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT"> Of course, you may put any expiration date, the ones above are merely examples, though they would expire the content immediatley! I hope that helps!
  25. My suggestion would be to open a socket/request connection to Xisto forums using PHP (specifically a URL pointing to your members page "http://forums.xisto.com/user/5697-hype/;) and once you receive the statically generated content you could store it all in a string and simply parse that string looking for the values you want.. You could gather alot of information about yourself from your member page..Just a suggestion, I have never actually done it, but it shouldn't be too hard..
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.