Jump to content

gilgimech

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.netgamegurus.com/

Profile Information

  • Gender
    Not Telling

gilgimech's Achievements

Member

Member (2/5)

0

Reputation

  1. I've got this bit of php code to call a sql query. The query is for specific rows in my database. It adds the amounts together of the items in these rows. This is what I have. $plugins_sql = mysql_query("SELECT forum_posts FROM slave_forums"); $plugins_jQuery = mysql_result($plugins_sql, 4 ); $plugins_actionscript = mysql_result($plugins_sql, 2 ); $total_count = $plugins_jQuery ['COUNT(forum_posts)'] + $plugins_actionscript['COUNT(forum_posts)']; $plugins_count = $total_count; In total I'm gonna have to include 15 rows into this. It seems to work fine. I was just wondering if there was a better way of doing it.
  2. This is driving me crazy!!!! I have this bit of PHP code that's breaking my CSS layout. <?php if ($user->data['is_registered']) { ?> <div id="user_menu"> <a href="<?php echo $forum; ?>/ucp.php?mode=logout&sid=<?php echo $user->data['session_id'] ?>">Logout</a><br> <a href="<?php echo $forum; ?>/search.php?search_id=newposts">View new Posts</a><br> <a href="<?php echo $forum; ?>/ucp.php?i=pm&folder=inbox">View new PM\'s</a><br> <a href="<?php echo $forum; ?>/ucp.php">User CP</a><br> <a href="<?php echo $forum; ?>/ucp.php?i=profile&mode=signature">Edit Signature</a><br> <a href="<?php echo $forum; ?>/search.php?search_id=egosearch">My Posts</a><br /> </div> <?php } else { ?> <form method="post" action="<?php $root.$login_page ?>" name="Username" target="_self" > <div id="login_title" > Forum login </div> <div id="username_lable"> Username </div> <div id="usename_textbox"> <input class="forminput" value=" User Name" onfocus="this.value=''" id="username" name="username" size="16" /> </div> <div id="password_lable"> Password </div> <div id="password_textbox"> <input class="forminput" value="password" type="password" onfocus="this.value=''" id="password" name="password" size="16"/> </div> <div id="form_submit"> <input class="forminput" type="image" src="../../images/login_submit_btn.jpg" value="Log in" name="login" /> </div> </form> <a href="http://127.0.0.1/forum/ucp.php?mode=register"><img src="../../forum/styles/prosilver/theme/images/icon_register.gif" width="16" height="14" />Register</a> </div> <div id="forgot_pass_link"> <a id="login_box_open" href="http://127.0.0.1/forum/ucp.php?mode=sendpassword">Forgot Your Password?</a> </div> <?php } ?> I don't think it's the CSS because the else statement works fine with my css. It's the if statement that breaks it. It seems that the php if floating outside of the wrapper div, but I can't figure out how to correct this.
  3. That's what I was thinking of doing. I'm actually trying to link the forum to an arcade script. It'll be a chore though. I'll have to tweak all of the arcade script so all the tables are the same. Like the forum is prefix_password and the arcade is prefix_userpass.
  4. I have two php scripts on my site. Arcadem and bbPHP. What I'm trying to do is combine the logins for both scripts. I want to use bbPHP for the main interface. I really don't know where to start. What I'm looking to do is use the bbPHP register and login form for both scripts. I'v been looking into "hooks", eg. username => memberid. But I don't really understand how it works. From what I understand "username" would be considered to be "memberid". But how do I call both databases, and get the form to point add to both databases. I just need someone to give me general info to point me in the right direction. 1. How to call two database at the same time? 2. How to use one form to write to two databases? 3. How to login to two scripts with one form?
  5. I have a directory script, and what I want is the directory categories not to be displayed if there are no entries. this is how I display the categories . $selmaincats="SELECT * from cl_categories where CatParent='0' order by CatName ASC"; $selmaincats2=mysql_query($selmaincats) or die("Could not grab main categories"); while($selmaincats3=mysql_fetch_array($selmaincats2)) { echo"<A href='index.php?catid=$selmaincats3[CatID]'>$selmaincats3[CatName]</a> "; } and this is how I display the entries $selectlinks="SELECT * from cl_entries where CatID='$catid' and validated='1' order by EntryName ASC"; $selectlinks2=mysql_query($selectlinks) or die(mysql_error()); $numlinks=mysql_num_rows($selectlinks2); if($numlinks>0) { while($selectlinks3=mysql_fetch_array($selectlinks2)) { $selectlinks3[Description]=htmlspecialchars($selectlinks3[Description]); $selectlinks3[EntryName]=htmlspecialchars($selectlinks3[EntryName]); echo "<A href='out.php?entryID=$selectlinks3[entryID]' target='_blank'>$selectlinks3[EntryName]</a>"; } }
  6. Hmm.... That seemed to work, kinda. I think it's conflicting with the div collapse. the first div will change the image, but won't collapse. the rest collapse but won't change the image. Here's the page I'm working on. http://www.netgamegurus.com/news/ Here all the code Call the javascript <script type="text/javascript" src="../includes/1.4.1_jquery.js"></script> <script type="text/javascript" src="../includes/animatedcollapse.js"></script> animatedcollapse.js var animatedcollapse={ divholders: {}, //structure: {div.id, div.attrs, div.$divref, div.$togglerimage} divgroups: {}, //structure: {groupname.count, groupname.lastactivedivid} lastactiveingroup: {}, //structure: {lastactivediv.id} preloadimages: [], show:function(divids){ //public method if (typeof divids=="object"){ for (var i=0; i<divids.length; i++) this.showhide(divids[i], "show") } else this.showhide(divids, "show") }, hide:function(divids){ //public method if (typeof divids=="object"){ for (var i=0; i<divids.length; i++) this.showhide(divids[i], "hide") } else this.showhide(divids, "hide") }, toggle:function(divid){ //public method if (typeof divid=="object") divid=divid[0] this.showhide(divid, "toggle") }, addDiv:function(divid, attrstring){ //public function this.divholders[divid]=({id: divid, $divref: null, attrs: attrstring}) this.divholders[divid].getAttr=function(name){ //assign getAttr() function to each divholder object var attr=new RegExp(name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,) return (attr.test(this.attrs) && parseInt(RegExp.$1)!=0)? RegExp.$1 : null //return value portion (string), or 0 (false) if none found } this.currentid=divid //keep track of current div object being manipulated (in the event of chaining) return this }, showhide:function(divid, action){ var $divref=this.divholders[divid].$divref //reference collapsible DIV if (this.divholders[divid] && $divref.length==1){ //if DIV exists var targetgroup=this.divgroups[$divref.attr('groupname')] //find out which group DIV belongs to (if any) if ($divref.attr('groupname') && targetgroup.count>1 && (action=="show" || action=="toggle" && $divref.css('display')=='none')){ //If current DIV belongs to a group if (targetgroup.lastactivedivid && targetgroup.lastactivedivid!=divid) //if last active DIV is set this.slideengine(targetgroup.lastactivedivid, 'hide') //hide last active DIV within group first this.slideengine(divid, 'show') targetgroup.lastactivedivid=divid //remember last active DIV } else{ this.slideengine(divid, action) } } }, slideengine:function(divid, action){ var $divref=this.divholders[divid].$divref var $togglerimage=this.divholders[divid].$togglerimage if (this.divholders[divid] && $divref.length==1){ //if this DIV exists var animateSetting={height: action} if ($divref.attr('fade')) animateSetting.opacity=action $divref.animate(animateSetting, $divref.attr('speed')? parseInt($divref.attr('speed')) : 500, function(){ if ($togglerimage){ $togglerimage.attr('src', ($divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open) } if (animatedcollapse.ontoggle){ try{ animatedcollapse.ontoggle(jQuery, $divref.get(0), $divref.css('display')) } catch(e){ alert("An error exists inside your \"ontoggle\" function:\n\n"+e+"\n\nAborting execution of function.") } } }) return false } }, generatemap:function(){ var map={} for (var i=0; i<arguments.length; i++){ if (arguments[i][1]!=null){ //do not generate name/value pair if value is null map[arguments[i][0]]=arguments[i][1] } } return map }, init:function(){ var ac=this jQuery(document).ready(function($){ animatedcollapse.ontoggle=animatedcollapse.ontoggle || null var urlparamopenids=animatedcollapse.urlparamselect() //Get div ids that should be expanded based on the url (['div1','div2',etc]) var persistopenids=ac.getCookie('acopendivids') //Get list of div ids that should be expanded due to persistence ('div1,div2,etc') var groupswithpersist=ac.getCookie('acgroupswithpersist') //Get list of group names that have 1 or more divs with "persist" attribute defined if (persistopenids!=null) //if cookie isn't null (is null if first time page loads, and cookie hasnt been set yet) persistopenids=(persistopenids=='nada')? [] : persistopenids.split(',') //if no divs are persisted, set to empty array, else, array of div ids groupswithpersist=(groupswithpersist==null || groupswithpersist=='nada')? [] : groupswithpersist.split(',') //Get list of groups with divs that are persisted jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object this.$divref=$('#'+this.id) if ((this.getAttr('persist') || jQuery.inArray(this.getAttr('group'), groupswithpersist)!=-1) && persistopenids!=null){ //if this div carries a user "persist" setting, or belong to a group with at least one div that does var cssdisplay=(jQuery.inArray(this.id, persistopenids)!=-1)? 'block' : 'none' } else{ var cssdisplay=this.getAttr('hide')? 'none' : null } if (urlparamopenids[0]=="all" || jQuery.inArray(this.id, urlparamopenids)!=-1){ //if url parameter string contains the single array element "all", or this div's ID cssdisplay='block' //set div to "block", overriding any other setting } else if (urlparamopenids[0]=="none"){ cssdisplay='none' //set div to "none", overriding any other setting } this.$divref.css(ac.generatemap(['height', this.getAttr('height')], ['display', cssdisplay])) this.$divref.attr(ac.generatemap(['groupname', this.getAttr('group')], ['fade', this.getAttr('fade')], ['speed', this.getAttr('speed')])) if (this.getAttr('group')){ //if this DIV has the "group" attr defined var targetgroup=ac.divgroups[this.getAttr('group')] || (ac.divgroups[this.getAttr('group')]={}) //Get settings for this group, or if it no settings exist yet, create blank object to store them in targetgroup.count=(targetgroup.count||0)+1 //count # of DIVs within this group if (jQuery.inArray(this.id, urlparamopenids)!=-1){ //if url parameter string contains this div's ID targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded). Overrides other settings targetgroup.overridepersist=1 //Indicate to override persisted div that would have been expanded } if (!targetgroup.lastactivedivid && this.$divref.css('display')!='none' || cssdisplay=="block" && typeof targetgroup.overridepersist=="undefined") //if this DIV was open by default or should be open due to persistence targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded) this.$divref.css({display:'none'}) //hide any DIV that's part of said group for now } }) //end divholders.each jQuery.each(ac.divgroups, function(){ //loop through each group if (this.lastactivedivid && urlparamopenids[0]!="none") //show last "active" DIV within each group (one that should be expanded), unless url param="none" ac.divholders[this.lastactivedivid].$divref.show() }) if (animatedcollapse.ontoggle){ jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object and fire ontoggle event animatedcollapse.ontoggle(jQuery, this.$divref.get(0), this.$divref.css('display')) }) } //Parse page for links containing rel attribute var $allcontrols=$('a[rel]').filter('[rel^="collapse["], [rel^="expand["], [rel^="toggle["]') //get all elements on page with rel="collapse[]", "expand[]" and "toggle[]" $allcontrols.each(function(){ //loop though each control link this._divids=this.getAttribute('rel').replace(/(^\w+)|(\s+)/g, "").replace(/[\[\]']/g, "") //cache value 'div1,div2,etc' within identifier[div1,div2,etc] if (this.getElementsByTagName('img').length==1 && ac.divholders[this._divids]){ //if control is an image link that toggles a single DIV (must be one to one to update status image) animatedcollapse.preloadimage(this.getAttribute('data-openimage'), this.getAttribute('data-closedimage')) //preload control images (if defined) $togglerimage=$(this).find('img').eq(0).data('srcs', {open:this.getAttribute('data-openimage'), closed:this.getAttribute('data-closedimage')}) //remember open and closed images' paths ac.divholders[this._divids].$togglerimage=$(this).find('img').eq(0) //save reference to toggler image (to be updated inside slideengine() ac.divholders[this._divids].$togglerimage.attr('src', (ac.divholders[this._divids].$divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open) } $(this).click(function(){ //assign click behavior to each control link var relattr=this.getAttribute('rel') var divids=(this._divids=="")? [] : this._divids.split(',') //convert 'div1,div2,etc' to array if (divids.length>0){ animatedcollapse[/expand/i.test(relattr)? 'show' : /collapse/i.test(relattr)? 'hide' : 'toggle'](divids) //call corresponding public function return false } }) //end control.click })// end control.each $(window).bind('unload', function(){ ac.uninit() }) }) //end doc.ready() }, uninit:function(){ var opendivids='', groupswithpersist='' jQuery.each(this.divholders, function(){ if (this.$divref.css('display')!='none'){ opendivids+=this.id+',' //store ids of DIVs that are expanded when page unloads: 'div1,div2,etc' } if (this.getAttr('group') && this.getAttr('persist')) groupswithpersist+=this.getAttr('group')+',' //store groups with which at least one DIV has persistance enabled: 'group1,group2,etc' }) opendivids=(opendivids=='')? 'nada' : opendivids.replace(/,$/, '') groupswithpersist=(groupswithpersist=='')? 'nada' : groupswithpersist.replace(/,$/, '') this.setCookie('acopendivids', opendivids) this.setCookie('acgroupswithpersist', groupswithpersist) }, getCookie:function(Name){ var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair if (document.cookie.match(re)) //if cookie found return document.cookie.match(re)[0].split("=")[1] //return its value return null }, setCookie:function(name, value, days){ if (typeof days!="undefined"){ //if set persistent cookie var expireDate = new Date() expireDate.setDate(expireDate.getDate()+days) document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString() } else //else if this is a session only cookie document.cookie = name+"="+value+"; path=/" }, urlparamselect:function(){ window.location.search.match(/expanddiv=([\w\-_,]+)/i) //search for expanddiv=divid or divid1,divid2,etc return (RegExp.$1!="")? RegExp.$1.split(",") : [] }, preloadimage:function(){ var preloadimages=this.preloadimages for (var i=0; i<arguments.length; i++){ if (arguments[i] && arguments[i].length>0){ preloadimages[preloadimages.length]=new Image() preloadimages[preloadimages.length-1].src=arguments[i] } } } } brianlange's image swap script <script type="text/javascript"> $(document).ready(function() { $('#open_close_arrow').toggle(function() { $(this).html('<img src="../images/arrow.png" >'); }, function() { $(this).html('<img src="../images/arrow2.png">'); }); }); </script> animatedcollaps script <script type="text/javascript"> animatedcollapse.addDiv('g4news', 'fade=1') animatedcollapse.addDiv('worldsinmotionnews', 'fade=1') animatedcollapse.addDiv('gamesetwatchnews', 'fade=1') animatedcollapse.addDiv('fingergamingnews', 'fade=1') animatedcollapse.addDiv('freelanceflashgamesnews', 'fade=1') animatedcollapse.addDiv('indiegamesnews', 'fade=1') animatedcollapse.addDiv('gamerbytesnews', 'fade=1') animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted //$: Access to jQuery //divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID //state: "block" or "none", depending on state } animatedcollapse.init() </script> The div's that uses the scripts <div class="news_title"> <div id="news_title_txt"> <a href="http://g4tv.com/">G4TV - The Feed</a> <div id="open_close_arrow"> <a href="javascript:animatedcollapse.toggle('g4news')"><img src="../images/arrow2.png" width="15" height="15"/></a> </div> </div> </div> <div class="news_title"> <div id="news_title_txt"> <a href="http://worldsinmotion.biz/">Worlds In Motion</a> <div id="open_close_arrow"> <a href="javascript:animatedcollapse.toggle('worldsinmotionnews')"><img src="../images/arrow2.png" width="15" height="15"/></a> </div> </div> </div>
  7. That worked better. The only problem I'm having now, is that I'm using it multiple time in one page. Now, it doesn't work on the first time you click, so the images are getting backwards.
  8. I don't know allot of javascript and I've been fight with this all day. I have a a div that expands when you click on the expand image/button. It's a down arrow. What I want to do is when you click the down arrow image. To replace it with a up arrow image, and back when you click it again. Here's what I'm trying to work with. <script type="text/javascript"> var img1 = ../images/arrow.png; var img2 = ../images/arrow2.png; var imageChoice = 1; function imageChange(element) { if (imageChoice == 1) { element.src == img2; imageChoice = 2; } else if (imageChoice == 2) { element.src == img1; imageChoice = 1; } <a href="javascript:animatedcollapse.toggle('news')"><img src="../images/arrow.png" width="15" height="15" onclick="imageChange(this);" /></a> </script>
  9. Sweat seems to work. Thanks.
  10. I'm having issues with htaccess displaying images. It works, I just can't get the images to load.
  11. Not what I was looking for. I need something like <?php if ('My IP Adress") { do not redirect } else (Any other IP){ redirect }; ?> I just don't know how to implement that into my current code
  12. I'm using this script to redirect for site maintenance. <?php $hostname="localhost"; $username="xxxxxx"; $password="xxxxxx"; $database="xxxxxx"; $tbl_name="xxxxxx"; // Connect to the database MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect"); MYSQL_SELECT_DB("$database") OR DIE("Unable to select database"); $result = mysql_query("SELECT * FROM $tbl_name") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $maint_on_off = $row['on_off']; } if ($maint_on_off == "1") { header ('Location: ../maintenance.php'); } ?> Does anyone know how I can redirect everyone except myself. Maybe using IP to detect.
  13. I dunno. Most sites I go to have three columns. Event this site (PHP Freaks) has three columns.
  14. I don't think that's me. I don't have any browser detect for Chrome. I use Chrome 4.1.249.1064 for my main browser and don't have any problems with it. I do have a browser detect for IE6. Working with IE sucks, so I'm narrowing down to 7 and 8. I figure, that if someone is still using and outdated browser that my site's not for them anyway. Sometimes people just need to be pushed to upgrade. Oh yeah did I mention the IE sucks?
×
×
  • 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.