KevinM1
Moderators-
Posts
5,222 -
Joined
-
Last visited
-
Days Won
26
Everything posted by KevinM1
-
I'm probably one of the few people that doesn't own an Xbox. I have been playing Warhawk on my PS3, though. It's an online game similar to the Battlefield 1942-ish games on the PC (although much simpler). It, too, has capture the flag, and zone capture/defend, and other modes. Great fun.
-
I'm pretty sure that we've all played some form of online game, so why not share what you've played, what you liked, what you hated, and what you're currently playing now, if anything? I'll go first: My very first MMO (if it could really be called that) was Federation on AOL in the mid-90's. It was a text-based sci-fi game in which you haul cargo, fight bad guys, and explore space. If you got to a high enough level, you could actually create your own planet. This was pretty fun (I liked the "pewpew" Han Solo vibe), but the grind was pretty rough. It took a lot of cargo runs to get enough money to buy decent weapons. I moved onto Dragonrealms, another text-based game on AOL (it still exists today, but is now hosted by Simutronics). Unsurprisingly, it's a fantasy, swords & sorcery game. It featured a very detailed world, but, again, it was a bit of a grind fest. Experience was handled a bit differently than other games. Skills are learned through repetition. Unfortunately, some of the skills don't really lend themselves to that kind of learning. For instance, learning magic devices, at an early level, basically entails focusing on a runestone every 20 seconds for an hour to get the learning rate up to a decent level. At college, I played a free MUD called Revenge of the Jedi. Fun, simple game set in the Star Wars universe. Small community of players (20 or so regulars). It was fun, until they changed the codebase (it went from an awesome CircleMUD setup to some homebrew thing). The last two I've played have been World of Warcraft and EVE-Online. Both are fun, but flawed. WoW has top-notch production values, but the game isn't much fun. There's no real point other than obtaining gear and bragging rights. There's no real way for the player to leave their mark on the game world. The 20 red bandannas you get from the Defias Brotherhood never help the Alliance in any appreciable way. The world will always remain static. EVE is the complete opposite, in those regards. Players drive the entire economy, they shape the vast majority of the political landscape, and in very tangible ways, the player matters. Do a Google search on the Guiding Hand Social Club to see what I mean. The problem is that the game feels like playing a spreadsheet with some flashy graphics. That, and there's no real viable way of going the Han Solo route -- smuggling rogue who gets by with their wits and cunning -- as the in-game police force is too perfect. All that said, I'm still tempted to go back as the player base is far more mature than WoW's. So, what have been your online gaming experiences?
-
Was that part about accident, was that a threat of some kind, or just a comment about the conversation? @ original poster - It could be schitzo (forgive spelling). It could be anything. If you are a christian (and some other religions) you might believe it's a demon. if you are an athiest it's a supernatural spirit. If you are against super-natural stuff then it's a mental illness or your imagination. Either way don't concern yourself with it. Demon, or ghost, or whatever it may be (even if it's retardation or some form of mental illness) it can't hurt you if you don't try to hurt it, so leave it alone and it won't bother you. Not to start a religious debate, but what I put in bold above is patently false. Atheists don't just lack faith in a god, but in anything supernatural. So, an atheist's stance on this issue is to find a natural cause to the underlying issue, which, in this case, is either mental illness, him cracking under social, cultural, and employment pressures, or some combination of the two. To bills_money: While I'm unsure of what your culture may say about this, where I come from feelings of frustration, loneliness, and sadness are all natural, understandable things. The other threads I've seen you start lead me to believe that you're falling into the same trap that so many of us have fallen into at one time or another. The evidence in your posts makes me think that you feel as though you're not learning fast enough, and that your peers are leaving you behind. So you try to overcompensate by studying longer and harder, but the results don't come (at least, not fast enough for your liking). This renewed effort has begun to take its toll: less social enjoyment, leading to more stress. You try to act happy, because that's what's expected of you, but you really don't feel happy. And now you're tired, frustrated, and confused. Now, I could be very wrong about all of this, but this is the vibe I've been getting from your messages on here. Regardless, I think it would be very beneficial for you to find someone to talk to in order to get whatever is truly bothering you into the open. You're not doing yourself any favors by trying to act in a way you don't currently feel. In fact, the opposite is true -- the more you try to bottle up whatever frustrations you're feeling, the more those frustrations will fester. I hope this helps, in some small way.
-
[SOLVED] Using PHP to rewrite bits of a JavaScript file
KevinM1 replied to KevinM1's topic in Application Design
120+ views and no replies? That's kinda disappointing. No one can give me a nudge in one direction or another? Or share some insight? -
[SOLVED] escaping characters and bringing them back in output
KevinM1 replied to polemios's topic in PHP Coding Help
Hmm...I don't think magic quotes would affect that. Try commenting out your ereg_replace("\'", ....) lines and see what happens. -
[SOLVED] escaping characters and bringing them back in output
KevinM1 replied to polemios's topic in PHP Coding Help
The ? : is a trinary operator. Explaining it requires an example. My function is: <?php function myEscape($string){ return get_magic_quotes_gpc() ? mysql_real_escape_string(stripslashes($string)) : mysql_real_escape_string($string); } ?> That's the same as typing: <?php function myEscape($string){ if(get_magic_quotes_gpc()){ return mysql_real_escape_string(stripslashes($string)); } else{ return mysql_real_escape_string($string); } } ?> So, instead of: if(conditional statement){ //do something } else{ //do something else } It can be shortened to: conditional statement ? //do something : //do something else -
[SOLVED] escaping characters and bringing them back in output
KevinM1 replied to polemios's topic in PHP Coding Help
Here's a helpful function that I use: <?php function myEscape($string){ return get_magic_quotes_gpc() ? mysql_real_escape_string(stripslashes($string)) : mysql_real_escape_string($string); } ?> So, when you want to escape user data, simple do: <?php $userName = myEscape($_POST['username']); ?> As far as output is concerned, I always thought that any escaped data in a database won't look escaped when outputted. So, no slashes or anything. -
[SOLVED] Using PHP to rewrite bits of a JavaScript file
KevinM1 posted a topic in Application Design
Please bear with me as what I'm doing is a bit involved. I currently have an e-commerce site that I'm rewriting. One of the scripts within this site allows an administrator to configure the various kinds of e-mails that the site sends to registered members when certain things happen (like a welcome e-mail to a new member, for example). It's a pretty straight forward script -- there's a select-element that allows the administrator to select the category of e-mail they want to configure (new member welcome, purchase request, etc). Below that, there's a small form that allows the administrator to set the reply address, message subject, and the message itself. Like I said, pretty easy. The complexity comes in the form of a JavaScript file I've written. This JS file does two things: 1. Toggles the display of the reply address/subject/message form. The message field allows for some custom, predefined tags to be used. These tags are str_replaced by member/statistical info that's in the database. The toggle is to show/hide the tag instructions. 2. Puts default values within those three fields, based on what category has been selected. For example, if the new member welcome category has been selected, then the form's subject field would automatically have "Welcome to blahblahblah" text in it. Here's what I'd like to do: when an administrator updates the e-mail configuration, and that info is entered into the database, I'd also like to overwrite the correct values within my JavaScript file, so the default entries it outputs are the same as what's currently in the database. I'm thinking that there's two ways to go about this: 1. Use PHP to find the right part of the JS file and overwrite the old values with the new when the update goes through. 2. Do some AJAX-y things, which is beyond my current ability. Anyone have any ideas on how I might tackle this? Is it time to dive into AJAX? NOTE: I'm not doing object-oriented PHP here. I understand the basics, but knowing when/how to combine the objects and structures I've learned of still eludes me. So my script is procedural in nature. With any luck, I'll have that OOP epiphany that others seem to get, and version 2 will be object-oriented. -
Like you and Fenway suggested, it was the name attribute that tripped me up. For some reason I always think of it as the page title. Like I said, it's a pet peeve of mine. Not a lot of logic behind it, it's just my preferred way of doing things.
-
I would, but I absolutely abhor mixing my JavaScript with my markup. It's a very big pet peeve of mine. To me, it's the coding equivalent of scratching one's nails down a chalkboard.
-
Yup, just tested it with an alert. It outputs the correct URI.
-
To be honest, I'm not sure. I just want the anchor's URI as the address for the new window. I haven't been able to find any property for it but href in the little relevent documentation I've found online so far.
-
Apparently I am getting a syntax error in IE7. It's telling me that I have a syntax error on line 18. Unfortunately, that cannot be the case as line 18 is merely 'return false;' (I changed it from 'return true;' in the previous example). However, since the error is about an invalid argument, I'm thinking the problem is on line 17, which is the line that opens the new window. Code: var W3CDOM = (document.createElement && document.getElementsByTagName); function init(){ if (!W3CDOM) return; var popup = document.getElementById('popup'); popup.onclick = newWin; } function newWin(evt){ evt = (evt) ? evt : ((event) ? event : null); if(evt){ var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if(elem){ var newWindow = window.open(elem.href, 'Adobe Acrobat Reader 8', 'resizable=yes,scrollbars=yes,status=yes,menubar=yes,toolbar=yes'); /* line in question */ return false; } else{ return false; } } else{ return false; } } window.onload = init; Anyone have an idea on what the problem is? Because I'm not seeing it.
-
I'm trying to make a link for Adobe Acrobat Reader into a popup. I've gotten it to work in Firefox, but it's not working in IE7. Here's what I have: HTML: ...(requires <a id="popup" href="http://www.adobe.com/products/acrobat/readstep2.html">Adobe Acrobat Reader</a>). JavaScript: var W3CDOM = (document.createElement && document.getElementsByTagName); function init(){ if (!W3CDOM) return; var popup = document.getElementById('popup'); popup.onclick = newWin; } function newWin(evt){ evt = (evt) ? evt : ((event) ? event : null); if(evt){ var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if(elem){ var newWindow = window.open(elem.href, 'Adobe Acrobat Reader 8', 'resizable=yes,scrollbars=yes,status=yes,menubar=yes,toolbar=yes'); return true; } else{ return false; } } else{ return false; } } window.onload = init; I'm not getting any errors from the console, so it's not a syntax issue. Is there some IE7 quirk that I don't know about?
-
[SOLVED] Using a select to display hidden divs
KevinM1 replied to KevinM1's topic in Javascript Help
Yeah, I figured that my description would be confusing. I've made a test file, so that can help demonstrate what I want to do. Let me paste the code first. HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Select Test</title> <link rel="stylesheet" type="text/css" href="../styles.css" /> <script type="text/javascript" src="configemail.js"></script> </head> <body> <select id="catSwitch"> <option value="#">Select a Category</option> <option value="#">-----------------------</option> <option value="1">Category 1</option> <option value="2">Category 2</option> <option value="3">Category 3</option> <option value="4">Category 4</option> </select> <div id="catDiv" style="display: none;"> <form id="catForm" action="" method="POST"> <p><label for="input1">Input 1: </label><input type="text" name="input1" /></p> <p><label for="input2">Input 2: </label><input type="text" name="input2" /></p> <input type="submit" name="submit" value="Submit" /> </form> </div> </body> </html> JavaScript: var W3CDOM = (document.createElement && document.getElementsByTagName); function init(){ if (!W3CDOM) return; var catSwitch = document.getElementById('catSwitch'); catSwitch.onchange = switchForms; } function switchForms(evt){ evt = (evt) ? evt : ((event) ? event : null); if(evt){ var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if(elem){ alert('Value of the select option: ' + elem.value); toggle(elem.value); //toggle the form based on elem.value } } } function toggle(value){ var catDiv = document.getElementById('catDiv'); var catForm = document.getElementById('catForm'); if(value != '#'){ catDiv.style.display = 'block'; if(value == '1'){ catForm.elements['input1'].value = 'Category 1 value 1'; catForm.elements['input2'].value = 'Category 1 value 2'; } if(value == '2'){ catForm.elements['input1'].value = 'Category 2 value 1'; catForm.elements['input2'].value = 'Category 2 value 2'; } } else{ catDiv.style.display = 'none'; } } window.onload = init; Here's what I'm attempting to do: If a category is selected (if the value of the option selected != '#'), display a hidden div. Within this div is a form. I want the values of these inputs to change based on what category was selected. Else I want the div to remain hidden. Unfortunately, I have a logic error with my code as I cannot get the div to appear when I select something valid (that is, an option whose value != '#'). I'm thinking it has something to do with getting the value of the options, as the alert function call doesn't fire at all. EDIT: One of two things happened: 1. There was some strange caching stuff going on. 2. I was an idiot and didn't include "window.onload = init;" at the bottom of my file. I'm betting on me being an idiot. -
[SOLVED] Using a select to display hidden divs
KevinM1 replied to KevinM1's topic in Javascript Help
Apologies for the double-post, but my new idea is too long to append to the end of my previous message. After thinking about this for a bit longer, I realize that all I need to change when the select-element is toggled is the second form's values not the form itself. The actual structure is the same across the board. So, would something like -- HTML: . . . <select id="catSwitch"> <option value="#">Select a Category</option> <option value="#">-----------------------</option> <option value="1">Category 1</option> <option value="2">Category 2</option> <option value="3">Category 3</option> <option value="4">Category 4</option> </select> . . . <div id="catDiv" style="display: none;"> <form id="catForm" ... > </form> </div> . . . JavaScript: var W3CDOM = (document.createElement && document.getElementsByTagName); function init(){ if (!W3CDOM) return; var catSwitch = document.getElementById('catSwitch'); catSwitch.onchange = switchForms; } function switchForms(evt){ evt = (evt) ? evt : ((event) ? event : null); if(evt){ var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if(elem){ toggle(elem.value); //toggle the form based on elem.value } } } function toggle(value){ if(value != '#'){ var nextDiv = document.getElementById('catDiv'); var catForm = document.getElementById('catForm'); nextDiv.style.display = 'block'; if(value == '1'){ catForm.elements['input1'].value = 'Category 1 value 1'; catForm.elements['input2'].value = 'Category 1 value 2'; } elseif(value == '2'){ catForm.elements['input1'].value = 'Category 2 value 1'; catForm.elements['input2'].value = 'Category 2 value 2'; } } else{ nextDiv.style.display = 'none'; } } window.onload = init; Be more or less correct? -
I'm debating whether or not to use JavaScript for this. I know I can brute-force what I want (more or less) with straight PHP, but where would the fun (or learning) with that be? Here's the long and short of it: I have a form with a select element. Below that, I will have another form, whose pre-generated (but editable by the user) values are determined by what option the user chose vis-a-vis the select element. Currently, the script I'm rewriting doesn't display the second/bottom form until the select element's form is submitted. This submission causes the page to reload, with the correct second/bottom form visible. This is all done by merely setting the first form's action to $_SERVER['PHP_SELF'] and letting PHP do its thing. I'm leaning towards doing the following: making the select element merely trigger an event which will toggle the visibility of div's with the different forms. My main concern with this is the state of the toggle. So, if I select the first option, then decide on the fourth, the form changes to the correct one. My thoughts, in code form, are -- HTML: . . . <select id="catSwitch"> <option value="#">Select a Category</option> <option value="#">-----------------------</option> <option value="1">Category 1</option> <option value="2">Category 2</option> <option value="3">Category 3</option> <option value="4">Category 4</option> </select> . . . <div id="catDiv1" style="display: none;"> <form id="form1" ... > </form> </div> <div id="catDiv2" style="display: none;"> <form id="form2" ... > </form> </div> . . . JavaScript: var W3CDOM = (document.createElement && document.getElementsByTagName); function init(){ if (!W3CDOM) return; var catSwitch = document.getElementById('catSwitch'); catSwitch.onchange = switchForms; } function switchForms(evt){ evt = (evt) ? evt : ((event) ? event : null); if(evt){ var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if(elem){ toggle(elem.value); //toggle the form based on elem.value } } } function toggle(value){ //how do I deal with the previous div-element, so I can turn it's display back off? var nextDiv = document.getElementById('catDiv' + value); nextDiv.style.display = 'block'; } window.onload = init; Am I on the right track? EDIT: Apologies for the spacing problems in the second code block. This board never seems to like any code that's pasted in.
-
That wouldn't be much better. People using the the webpage won't have any access to the PHP code. The vulnerability is that anyone who has access to the server's file system will be able to read the code and get the password. If the file is one directory higher it won't change who has access to the file. The way to solve this is put this info in a file readable by the web server and access the information through the $_SERVER variable. My curiosity is piqued. How would one use the $_SERVER variable to access another script?
-
A few things: 1. FORM VALIDATION. It can't be bold enough. If you're using a form to login, you absolutely need to verify that the info submitted into your form is legit. 2. Encryption. At the very least, the password should be encrypted. MySQL has several built-in encryption functions, including PASSWORD() and MD5(). Be sure that the stored passwords are encrypted in the database. 3. Separate connection script. Most people, myself included, write a separate script that connects to the database, and then include/require that file in the script(s) that actually do the heavy lifting. The key here is to put the database connection script in a folder that the outside public cannot access. This is typically one folder above your web folder.
-
[SOLVED] Color theme when designing a website...
KevinM1 replied to ~n[EO]n~'s topic in Miscellaneous
I just try to use common sense. Historical sites, for example, typically want to evoke thoughts of antiquity and age. Colors that are similar to faded parchment (slightly yellowed) or old, worn wood (dark brown) tend to work well. Black and white images work well, too. -
GoDaddy.com is a great value. The only thing I really dislike about them is the number of hoops you have to jump through in order to get to a control panel. Also, I believe that they still don't have a built-in code editor. I like using built-in editors for making quick changes on the fly. Other than that, they're great.
-
:DROOL: Nice setup. I only wish mine were that good. Work: Ubuntu 7.04. I'm not sure the size of the monitor -- it's a flat panel, but not very big. It's square, so my resolution is 1024 x 768. I typically have two windows open -- gedit for coding, Firefox for looking at what I code. Home: Vista Business w/ 19inch widescreen (1400 x 900) monitor. Again, multiple windows -- Notepad++ for coding, Firefox and IE7 for looking at my work. I really need to get multiple monitors and an Apple so I can test for its browsers...
-
I don't think PHP 6 is out yet.
-
Ooh, interesting. I've read that either 7.10 or 8.04 will be LTS, so I'll try that trick when it comes out.
-
Looks like they're using a templating system then, as what you posted originally isn't plain PHP. Like I asked before, what do you want to test against? You mentioned another number other than 14. Is it just one other number? Or a range of other numbers?