Jump to content

bpops

Members
  • Posts

    232
  • Joined

  • Last visited

    Never

Everything posted by bpops

  1. I have submitted snippets of this code before. The site I am creating works fine in Firefox, but throws back an error in IE. Here is the url: http://www.b-pops.com/boxartist/gc.shtml If anyone can tell me why this doesn't work in IE, I would be extremely grateful. I've been working on this for quite a while with no success. As you'll see, the page updates automatically in Firefox. You can change background colors, add a title, etc. IE however, gives errors that I can't track down. Also, here is the javascript that I'm using (included in the header of that page): [code] // JavaScript Document function change_bg(){ var image_url = create.background.value; var color = create.bg_color.value; var repeat = create.bg_repeat.value; var position_vert = create.bg_position_vert.value; var position_hor = create.bg_position_hor.value; box = document.getElementById('box'); position = position_vert+' '+position_hor; box.style.backgroundImage = 'url("'+image_url+'")'; if (color){ box.style.backgroundColor = color; } box.style.backgroundRepeat = repeat; box.style.backgroundPosition = position; } function change_title(){ var title = document.create.title.value; var title = title.replace('\n', '<br>'); var font_family = document.create.font_family.value; var font_custom = document.create.font_custom.value; var font_size = document.create.font_size.value; var font_color = document.create.font_color.value; var font_style = document.create.font_style.value; var title_position_vert = document.create.title_position_vert.value; var title_position_hor = document.create.title_position_hor.value; main = document.getElementById('main'); if(font_family == 'custom'){ font_family = font_custom; } main.innerHTML = title; if(font_color){ main.style.color = font_color; } main.style.fontFamily = font_family; main.style.fontSize = font_size; main.style.color = font_color; main.style.fontWeight = font_style; main.style.textAlign = title_position_hor; main.style.verticalAlign = title_position_vert; } /*function change_esrb(rating){ esrb = document.getElementById('esrb'); rating = 'images/logos/'+rating; esrb.src = rating; }*/ function change_patch(image,patch_num){ if(image == 'custom'){ if(patch_num == 'patch_1'){ image = document.create.patch_1_custom.value; } if(patch_num == 'patch_2'){ image = document.create.patch_2_custom.value; } if(patch_num == 'patch_3'){ image = document.create.patch_3_custom.value; } }else{ image = 'images/logos/'+image; } patch_num = document.getElementById(patch_num); patch_num.src = image; } function only_for(image){ image = 'images/logos/'+image; only_img = document.getElementById('only_img'); if(document.create.only.checked){ only_img.src = image; }else{ only_img.src = 'images/logos/blank.gif'; } } [/code]
  2. Ah, I wasn't aware that was required. I'll give it a try (when I get home). thanks
  3. Sure, here's the HTML code for that part of the page. Of course, it is enclosed in the <form name="create"></form> tags. thanks for your help! [code] <table border="0" width="100%" style="font-family:Georgia,Times New Roman;font-size:12px;color:#000000;" cellspacing="0" cellpadding="3"> <tr> <td colspan="2" align="center" valign="middle" style="font-family:Georgia,Times New Roman;font-size:11px;color:#FFFFFF;background-color:#3a5721;font-weight:bolder;"> BACKGROUND </td> </tr> <tr> <td align="left" valign="middle"> Background Image [<a href="javascript:;" onClick="window.open('help_bgimage.html','Help','width=300,height=300')" style="font-weight:bold;font-size:13px;">?</a>]: </td> <td align="right" valign="middle"> <input type="text" size="20" name="background" style="font-family:Georgia,Times New Roman;font-size:12px;width:150px;" onChange="change_bg();" onClick="change_bg();"> </td> </tr> <tr> <td align="left" valign="middle"> Background Color [<a href="javascript:;" onClick="window.open('help_bgcolor.html','Help','width=300,height=300')" style="font-weight:bold;font-size:13px;">?</a>]: </td> <td align="right" valign="middle"> <input type="text" size="20" name="bg_color" style="font-family:Georgia,Times New Roman;font-size:12px;width:150px;" onChange="change_bg();" onClick="change_bg();"> </td> </tr> <tr> <td align="left" valign="middle"> Tile: </td> <td align="right" valign="middle"> <select style="font-family:Georgia,Times New Roman;font-size:12px;width:150px;" name="bg_repeat" id="bg_repeat" onChange="change_bg();" onClick="change_bg();" onkeyup="change_bg();"> <option value="no-repeat" selected>None</option> <option value="repeat-x">Tile in X</option> <option value="repeat-y">Tile in Y</option> <option value="repeat">Tile X &amp; Y</option> </select> </td> </tr> <tr> <td align="left" valign="middle"> Vertical Position: </td> <td align="right" valign="middle"> <select style="font-family:Georgia,Times New Roman;font-size:12px;width:150px;" name="bg_position_vert" onChange="change_bg();" onClick="change_bg();" onkeyup="change_bg();"> <option value="top">Top</option> <option value="center" selected>Center</option> <option value="bottom">Bottom</option> </select> </td> </tr> <tr> <td align="left" valign="middle"> Horizontal Position </td> <td align="right" valign="middle"> <select style="font-family:Georgia,Times New Roman;font-size:12px;width:150px;" name="bg_position_hor" onChange="change_bg();" onClick="change_bg();" onkeyup="change_bg();"> <option value="left">Left</option> <option value="center"selected>Center</option> <option value="right">Right</option> </select> </td> </tr> </table> [/code]
  4. oh, I should clarify. the form name is "create", the entires are a background url ("background"), a color ("bg_color"), a repeat option, vertical alignment and horizontal alignment ("bg_repeat", "bg_position_vert", "bg_position_hor") the ID of the table is "box"
  5. I have this little code that changes the background of a table depending on the URL input in to a form (instantaneously). It works great in firefox, but throws out an error in Internet Explorer.. any tips? [code] function change_bg(){ image_url = create.background.value; color = create.bg_color.value; repeat = create.bg_repeat.value; position_vert = create.bg_position_vert.value; position_hor = create.bg_position_hor.value; box = document.getElementById('box'); position = position_vert+' '+position_hor; box.style.backgroundImage = 'url("'+image_url+'")'; if (color){ box.style.backgroundColor = color; } box.style.backgroundRepeat = repeat; box.style.backgroundPosition = position; } [/code] thanks in advance!
  6. I also like coppermine. Integrates very easily with phpBB, too, if that's your bag.
  7. I posted this question over at phpbb.com ( http://www.phpbb.com/phpBB/viewtopic.php?t=448208 ) and haven't had any responses yet. I was hoping maybe someone here had a solution. I'm having a bit of difficult with a redirect variable for logging into my phpbb forum. I have a dynamically generated "LOGIN" link on my site that changes the redirect variable depending on the page. The tricky part is that all my pages are dynamically generated using variables themselves. So a typical example would be: http://www.b-pops.com/wow/spell.php?id=1240 Most of the time this isn't a problem, my Login link looks like: http://www.b-pops.com/forums/login.php?redirect=../wow/spell.php?id=1240 But if I have a second variable in there, i.e. http://www.b-pops.com/wow/spell.php?id=1240&mode=post then the "LOGIN" link generated looks like: http://www.b-pops.com/forums/login.php?redirect=../wow/spell.php?id=1240&mode=post which also looks how it should. But when I click this one, and login, it redirects to http://www.b-pops.com/forums/login.php?redirect=../wow/spell.php?id=1240?mode=post&sid=XXXXXXXXXXXXXXX (Note the character before mode is '?' NOT '&' as it should be). Since my Login link is generated correctly, I don't think this is something I'm doing wrong. Anyone know a solution?
  8. Just in case anyone else is interested in doing this, I modified the DateDiff function that I found on that website just a bit. So now I just give the function two times (both in the Unix epoch format). It returns a string that tells you how much time has elapsed between the two. The units scale appropriately (perfect for comment system and blogs). [code=php:0] Function DateDiff($date1,$date2) { // get the number of seconds between the two dates $timedifference = $date2 - $date1; // determine appropriate scale if($timedifference >= 3153600) $interval = 'year'; else if($timedifference >= 604800) $interval = 'week'; else if($timedifference >= 86400) $interval = 'day'; else if($timedifference >= 3600) $interval = 'hour'; else if($timedifference >= 60) $interval = 'minute'; else $interval = 'second'; // calculate elapsed time switch ($interval) { case 'year': $retval = bcdiv($timedifference,31536000); break; case 'week': $retval = bcdiv($timedifference,604800); break; case 'day': $retval = bcdiv($timedifference,86400); break; case 'hour': $retval =bcdiv($timedifference,3600); break; case 'minute': $retval = bcdiv($timedifference,60); break; case 'second': $retval = $timedifference; break; } // add 's' if plural (e.g. 1 second, 2 seconds) if($retval != 1) $interval .= 's'; return $retval.' '.$interval; } [/code]
  9. Hey thanks for the response :) I was googling in the meantime and also found this helpful site: http://www.phpbuilder.com/columns/akent20000610.php3?page=7 I will check the links you provided too
  10. Hi all, I'm interested in subtracting two times for a comment system I'm working on. It's the typical kind of comment system you often see on blogs and such where a comment will have "Posted 26 seconds ago" or "Posted 36 minutes ago" or even "Posted 94 days ago". I have the date and time stored (XX-XX-XXXX for date and XX:XX:XX for time) in the mysql db already, just need to compare it to the current time. I'm just not sure how to go about this. How do I merge the date and time for a single number to compare? Then what's the easiest way to look at whether I should be giving seconds, minutes, hours or days? Thanks!
  11. Awesome, thanks for the quick responses, guys :) I'll be able to get to work on this tonight!
  12. Hello, I'm working on voting system for a site of mine. I already have a member database in place where people can post comments and such. But I want them to be able to rank certain items (a la amazon, five stars or whatever). But I was wondering the most space-efficient and time-efficient way of doing this was? I want members ONLY to be able to vote. But not more than once on any particular item. So do I just make a new mysql table with fields like: user_name, user_id, item_id, rank and then every time I load that item, i have to query for the ranks with that id, and then average them? Or is there a better way to do this? Any ideas or suggestions would be helpful. thanks!
  13. My qusetion was answered over at phpBB.com, so in case anyone else is interested: http://www.phpbb.com/phpBB/viewtopic.php?t=433910
  14. Hello, I posted this same thread over in the phpBB forums, but I often get more help over here with all you "freaks". anyway, here's my problem: I'm trying to use the phpbb user database for another part of my webpage. I was reading the following article: http://www.phpbb.com/kb/article.php?article_id=143 It clearly explains how to check for authentication to make sure someone is logged in, so that if I want members-only parts of my site, it is now easy to do so. But it does not answer my question for recognizing specifically who that user is. If I were to have a page where people could comment on something.. say an image... and I want their username to be displayed, I would need to authenticate their session (which I can now do), but then recognize WHO they are. Is there another tutorial on this that I've overlooked? Thanks for the help in advance!
  15. Thanks! I will have to read up a bit more on this preg_replace, but this is the solution I've been looking for!
  16. from GingerRobot's post, change the line [code=php:0] echo '</td><td>'; [/code] to [code=php:0] echo '</tr><tr>'; [/code]
  17. One of my friends recommended I just look for numbers and anytime a number is sitting right next to an alphabetic character (e.g. 5h..), to just throw out an error. While this will get rid of most leet speak, does anyone have another solution?
  18. In a user-driven site, I'm attempting to filter certain profanity. The way I do this currently is by having an array of words: [code=php:0]$bad_words = array("XXXX","XXXX","XXXX");[/code] then for an input message, I do a check, something like: [code=php:0] if (strtolower($message) != str_replace($bad_words, '', strtolower($message))){   echo "Profanity found."; } [/code] The problem that I'm having is that people are using leet (1337) speak to use these words.. for example: i's become !'s, o's become 0's (zero), s's become 5's, t's become 7's, etc. etc. So if I wanted to filter the word "sit", I'd have to filter: sit, s!t, si7, 5it, s!7, 5!7, etc. etc. (all the combinations) Anyone know of an easy way of doing this? Or does anyone know how others typically filter certain words? Or is there no easy way around it? Thanks! ???
  19. I understand these guys are just trying to keep phpfreaks organized, but I for one appreciate the work you put into this. I'm in the middle of really trying to understand cookies and php better and will be reading your post over the next few minutes. Thankyou :)
  20. I'd just have some counter, and have the counter add one evertime the loop runs. when it hits 4, have it add the </tr><tr>, then reset itself.. [code=php:0] x=1; while(-----------){ //whatever you want here if(x == 4){   echo "</tr><tr>";   x = 1; }else{   x++; } } [/code]
  21. Quick question: Can you nest include statements? for example, can i have: [code=php:0] include("top.php"); [/code] in one php file then, inside of top.php, [code=php:0] include("banner.php"); [/code] I know the easiest way to answer this is to just try it, but I'm at work and was just thinking about this. Also, if possible, anyone know the recursion limit? Thanks!
  22. Like bltesar said, it might use fewer system resources. I've defenitely used some servers in the past that are a tad slow with php, and if I was writing something static, i always preferred shtml over includes. The habit has stayed with me now, and I have a main site logo with a menu that is included() on php pages where I have dynamic stuff going on, but is incorporated with shtml on pages that don't change, like FAQs, LINKS, etc.
  23. [quote author=Orio link=topic=103466.msg411973#msg411973 date=1155067295] EDIT- @bpops- you are wrong about the "second problem". everything is fine over there (maybe "trim" being "Trim" is a problem, but I dont know). [/quote] ah, well i've never used that dollar sign in the post before, and it always worked for me. oh well
  24. If I understand what's going on, when these guys are telling you to use $_SESSION['user'] and $_SESSION['pass'], those variables user and pass are the variables stored in the session... which is unique to everyone. So you've already gotten the info out of the database and you are now just looking at the session itself.
×
×
  • Create New...

Important Information

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.