Jump to content

Notretsam

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by Notretsam

  1. using addslashes() I get corpname=Morgoth\ using htmlspecialchars , I still get corpname=Morgoth tried , also same with addslashes $name = htmlspecialchars("$name"); $hint="<a href='?corpname=$name'>$name</a><br>"; Also I manually went into the database and changed the value to Morgoth\'s Dungeon and still shows as corpname=Morgoth
  2. FYI I do know the ' in Morgoth's dungeon is acting as the closing ' in this line $hint="<a href='?corpname=$name'>$name</a><br> Just not sure how to format that so it doesn't.
  3. I think I posted asking about this before, not 100% certain. so one of my members has registered the company name Morgoth's Dungeon , which is in the companyDirectory database table. Am working on a company favourties feature where people can add company to there faves list. I have the below PHP code to show hints as there typing in the input field, which the form coding is below to and the javascript function as well. The part of code $hint="<a href='?corpname=$name'>$name</a><br> on the PHP code below is the issue. As the $name within the link tags (<a>) is showing as Morgoth's Dungeon. However the corpname=$name part shows as Morgoth. Tried stripslashes and mysqli_escape_string, nothing working. anyone got a suggestion on how to get the $name to be correctly added on corpname= part. <?php $feeMemb=$_REQUEST["feeMem"]; /* create a prepared statement */ $stmtgethintwrest = $conn->prepare("SELECT companyID , companyName FROM companyDirectory ORDER BY companyName"); /* bind parameters for markers */ $stmtgethintwrest->bind_param; /* execute query */ $stmtgethintwrest->execute(); $stmtgethintwrest->bind_result($companyID , $companyName); /* fetch value */ while ($row = $stmtgethintwrest->fetch()) { $a[]="$companyName"; } // get the q parameter from URL $q=$_REQUEST["q"]; $hint=""; // lookup all hints from array if $q is different from "" if ($q !== "") { $q=strtolower($q); $len=strlen($q); foreach($a as $name) { if (stristr($q, substr($name,0,$len))) { if ($hint==="") { $hint="<a href='?corpname=$name'>$name</a><br>"; } else { $hint .= "<a href='?corpname=$name'>$name</a><br>"; } } } } /* close statement */ $stmtgethintwrest->close(); // Output "no suggestion" if no hint were found // or output the correct values echo $hint==="" ? "no suggestion" : $hint; ?> <form id="myformlarge" action='theme/company/corpopts.php?do=addfave' method='post'> <input id="wreID" name="wreID" type="hidden" value="<?php echo "$visitID"; ?>"> <div><input type="text" name="coAdd" value="<?php echo "$corpname"; ?>" size="30" class="edit" maxlength="45" onkeyup="showcorpHint(this.value)"> <div id='txtcorpHint' class='showhint'></div> <p class="centertext"><input type="submit" name="log" value="Add" size="15" class="button"></p> </div> </form> <script> function showcorpHint(str) { if (str=="") { document.getElementById("txtcorpHint").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtcorpHint").innerHTML=xmlhttp.responseText; } } var feeMem = document.getElementById('wreID').value; xmlhttp.open("GET","theme/getcorphint.php?q="+str+ "&feeMemb=" + feeMem,true); xmlhttp.send(); } </script>
  4. ty John was actually below line that was causing issue, took me forever to notice I hadn't changed the ID part. <input name="matchTyp" id="matchTyp" type="hidden" value="<?php echo "$matchType"; ?>"> <input name="matcheckid" id="matchTyp" type="hidden" value="<?php echo "$matcheckid"; ?>"> sorry Justsomeguy , didn't actually expect any further replies in this thread. yeah I had a really good web developer addon for firefox awhile back, haven't came across a good one for google chrome. the web developer tool built into chrome is a bit OTT to me. if you got any suggestions for a good extension or addon for google chrome, feel free to let me know
  5. well I did figure out eventually what was wrong
  6. so anyone got any advice on where I went wrong? still can't get it to work again.
  7. I added an alert line to see if str was empty in the javascript function, and nothing came up if (str=="") { alert("Hello! str is empty!"); document.getElementById("playerInfo").innerHTML=""; return; } so am guessing there something wrong with the onchange trigger in the <select> tag, but don't see what.
  8. well I haven't got to part of doing 2nd function because all of a sudden yesterday, the first function appears to have stopped working. I have no clue why. I clicked a wrestling move, the refmoveinfozfg function would process, then getmove would do its thing, update the database and then new information be refreshed within <div id="playerInfo"> area. now it does nothing , its like the onchange event on select is no longer calling the function or the "str" is empty, code shown below. <script> function refmoveinfozfg(str) { if (str=="") { document.getElementById("playerInfo").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("playerInfo").innerHTML=xmlhttp.responseText; } } var matchid = document.getElementById('matchid').value; var playturn = document.getElementById('playTurn').value; var matchno = document.getElementById('matchNo').value; var matchtype = document.getElementById('matchTyp').value; var matcheckid = document.getElementById('matcheckid').value; xmlhttp.open("GET","matchtest/getmove.php?selMove="+str + "&matchid=" + matchid + "&playTurn=" + playturn + "&matchNo=" + matchno + "&matchTyp=" + matchtype + "&matcheckid=" + matcheckid,true); xmlhttp.send(); } </script> <form> <input name="matchid" id="matchid" type="hidden" value="<?php echo "$sid"; ?>"> <input name="playTurn" id="playTurn" type="hidden" value="<?php echo "$playTurn"; ?>"> <input name="matchNo" id="matchNo" type="hidden" value="<?php echo "$matchNumb"; ?>"> <input name="matchTyp" id="matchTyp" type="hidden" value="<?php echo "$matchType"; ?>"> <input name="matcheckid" id="matchTyp" type="hidden" value="<?php echo "$matcheckid"; ?>"> <?php /* in each select field, there is a either a while loop or a SQL query to get wrestling moves and added via <option></option> */ echo "<select name='selMove' onchange='refmoveinfozfg(this.value)'>SQL WHILE LOOP</select>"; ?> </form /* in the getmove.php page, I pick up $selMove and other vars, then get info from database for wrestling move and the match*/ /* then the script processes the move and does its thing */ /* which is all working , as used onChange='this.form.submit();' on select fields to make sure */ /* once the script processes the move , at the very end is the below code which displays new updated information on match.php */ /* updating player information part of match page */ ob_start(); // start buffer include("matpage/matchplaystats.php"); // read in buffer $pinfo1=ob_get_contents(); // get buffer content ob_end_clean(); // delete buffer content $pinfostatus = "TRUE"; define("playerinfo",$pinfo1,$pinfostatus); echo constant("playerinfo"); can't understand why it was working, then all of a sudden it stopped working. I was working on getting the select combos to refresh along with the player information area of page. so added another ob_start and assigned page with the form to a variable, and was going echo that out like you see with the matchplaystats.php hope someone can see an issue because I got no clue while all off a sudden it stopped working.
  9. appendChild most likely do it but remember, I get a brain freeze when it comes to Javascript lol innerHTML should do the trick perfectly though, am guessing something like below would do it. <script> function refmatchhistscu(curstr) { if (str=="") { document.getElementById("matHist").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("matHist").innerHTML=xmlhttp.responseText; } } var matchid = document.getElementById('matchid').value; var x = document.getElementById("matHist").innerHTML; xmlhttp.open("GET","matchtest/refmatchhist.php?matchid="+curstr + "&matchid=" + matchid + "&currHist=" + x ,true); xmlhttp.send(); } </script> Then I call it in first function with refmatchhistscu(matchid);
  10. yeah seems easy enough, thanks for the help justsomeguy, 2nd time you helped me with something related to this project. Am currently trying to work out of instead of refreshing the full match history, if I can just add the new history within a div area that sits above the match history when it first loaded. might be doable and would be awesome if I can pull that off, but sadly the second click on select combo just replace the last click information. so is there a way to detect the information that already contained within the div area? if so, I can pass current information over to a PHP page and then echo old with new line.
  11. ah its just as simple as mathistfunct(); I presume within the () I can pass a variable? so mathistfunct($matid);
  12. so how do I call another function within the javascript function? don't know how to do that but sure some google searching most likely provide an answer.
  13. my problem is I don't know javascript , so don't know how to do any of the things you saying I could do. The function I showed in original post refreshes the div area with ID=playerInfo , but I also have a second div area with ID=matchHist that I also need refreshed. Am wondering if after the "xmlhttp.send();" if I can add a line which acts as a trigger for another function that refreshes the matchHistory div area. Am a PHP programmer, so really don't know how to code full functions in javascript, I can look at functions like I showed and make small changes, but nothing like am hoping to be able to do. If it helps any, here is the layout of the match page with the two divs am talking about. <header>header include page</header> <nav>nav include page</nav> <section> <div id="playerInfo"> player information page include </div> form with select combos (which has the onchange event to trigger the function refmoveinfozfg) </section> <section>match chat page include</section> <section> <div id="matchHist"> match history </div> </section> <footer>footer page include</footer>
  14. Before I go into what I'm looking to do, I should say I have very little experience with Javascript, I use PHP myself. However what am looking to do requires javascript and below page on w3schools helped me refresh one div area. http://www.w3schools.com/php/php_ajax_database.asp I have very similar code on match.php , which is shown below. <script> function refmoveinfozfg(str) { if (str=="") { document.getElementById("playerInfo").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("playerInfo").innerHTML=xmlhttp.responseText; } } var matchid = document.getElementById('matchid').value; var playturn = document.getElementById('playTurn').value; var matchno = document.getElementById('matchNo').value; var matchtype = document.getElementById('matchTyp').value; var matcheckid = document.getElementById('matcheckid').value; xmlhttp.open("GET","matchtest/getmove.php?selMove="+str + "&matchid=" + matchid + "&playTurn=" + playturn + "&matchNo=" + matchno + "&matchTyp=" + matchtype + "&matcheckid=" + matcheckid,true); xmlhttp.send(); } </script> The short version of what is going on here, player clicks on a "wrestling move" within a combo and the above function does what you see, the getmove.php page then processes the move, updates a database with the player stats in match. After the getmove has processed the move and everything else it does, I have the below code at end which refreshes the "playerInfo" div area. /* updating player information part of match page */ ob_start(); // start buffer include("matpage/matchlistcenter.php"); // read in buffer $pinfo1=ob_get_contents(); // get buffer content ob_end_clean(); // delete buffer content $pinfostatus = "TRUE"; define("playerinfo",$pinfo1,$pinfostatus); echo constant("playerinfo"); This all works perfectly, the player stats are refreshing correctly. My problem is, I also have the match history area on match.php that shows the player(s) if wrestling move was successful or not. I have no clue on how to either adapt the javascript function , so the two div areas refresh. I have done some google searching on it and from what I can tell, its not possible to refresh two div areas from one function. It seems like am going need one javascript function, that will load two other javascript functions that refresh the two div areas. Which I really have no clue on how to even go about doing that. I was thinking maybe at end of getmove.php, I could do "something" there that refresh the matchHistory div area.
  15. encase anyone actually reads this and wonders, here is final code, which works after i fixed typos in SQL lol stoopid me maybe someone read this and learn something <?php //connection to sql here $i = "0"; $datagetname = ""; while ( $i < "7" ) { $i++; /* checking the current value of $i variable and setting database name */ if ( $i == "1" ) { $datagetname = "matchPlayerssingle100"; } elseif ( $i == "2" ) { $datagetname = "matchPlayerssinglehardcore"; } elseif ( $i == "3" ) { $datagetname = "matchPlayersiquit"; } elseif ( $i == "4" ) { $datagetname = "matchPlayerssinglecage"; } elseif ( $i == "5" ) { $datagetname = "matchPlayerssinglehellcell"; } elseif ( $i == "6" ) { $datagetname = "matchPlayerssingleladder"; } elseif ( $i == "7" ) { $datagetname = "matchPlayerssingletlc"; } if ( $datagetname == "" ) { $moveon = "go"; } else { if ( $datagetstop == "found" ) { $moveon = "go"; } else { /* create a prepared statement */ $stmtgetmat = $conn->prepare("SELECT matchID , matchCompany, matchDivision, rankType, matchNumb, matchType, matchTimer, matchDaytime, lastMoveLanded, curMovecount, eyegougeCount, asianmistCount, cfpunchCount, defenseSet, weppickup, curplayerTurn, matchPlay1, heaplay1, fatig1, momeplay1, matchPlay2, heaplay2, fatig2, momeplay2, matchResult, matchWinner, matchTime, matchDate FROM $datagetname WHERE matchID=?"); /* bind parameters for markers */ $stmtgetmat->bind_param("s", $sid); /* execute query */ $stmtgetmat->execute(); $stmtgetmat->store_result(); $matcount= $stmtgetmat->num_rows; if ( $matcount == "0" ) { $datagetname = ""; } elseif ( $matcount == "1" ) { $datagetstop = "found"; } } /* end of else statement */ } /* end of while loop */ } /* bind result variables */ $stmtgetmat->bind_result($matchID , $rankType, $matchCompany, $matchDivision, $matchNumb, $matchType , $matchTimer, $matchDaytime, $lastMoveLanded, $curMovecount, $eyegougeCount, $asianmistCount, $cfpunchCount, $defenseSet, $weppickup, $curplayerTurn, $matchPlay1, $heaplay1, $fatig1, $momeplay1, $matchPlay2, $heaplay2, $fatig2, $momeplay2, $matchResult, $matchWinner, $matchTime, $matchDate); /* fetch value */ $stmtgetmat->fetch(); /* close statement */ $stmtgetmat->close();
  16. forget about this, slowly figuring it out what is the causing the problem is, some of the sql table columns aren't named right in the databases. so getting a bind_parem error
  17. I've figured out what the problem is, its the following line. FROM $datagetname Strange it is that, as use variable elsewhere in site for database name and works fine.
  18. <?php $i = "0"; while ( $i < "8" ) { $i++; $datagetname = ""; /* checking the current value of $i variable and setting database name */ if ( $i == "1" ) { $datagetname = "matchPlayerssingle100"; } elseif ( $i == "2" ) { $datagetname = "matchPlayerssinglehardcore"; } elseif ( $i == "3" ) { $datagetname = "matchPlayersiquit"; } elseif ( $i == "4" ) { $datagetname = "matchPlayerssinglecage"; } elseif ( $i == "5" ) { $datagetname = "matchPlayerssinglehellcell"; } elseif ( $i == "6" ) { $datagetname = "matchPlayerssingleladder"; } elseif ( $i == "7" ) { $datagetname = "matchPlayerssingletlc"; } if ( $datagetname == "" ) { $moveon = "go"; } else { // Create connection $conn = new mysqli($host, $user, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } /* create a prepared statement */ $stmtgetmat = $conn->prepare("SELECT matchID , rankType, matchCompany, matchDivision, matchNumb, matchType, matchTimer, matchDaytime, lastMoveLanded, curMovecount, eyegougeCount, asianmistCount, cfpunchCount, defenseSet, weppickup, curplayerTurn, matchPlay1, heaplay1, fatig1, momeplay1, matchPlay2, heaplay2, fatig2, momeplay2, matchResult, matchWinner, matchTime, matchDate FROM $datagetname WHERE matchID=?"); /* bind parameters for markers */ $stmtgetmat->bind_param("s", $sid); /* execute query */ $stmtgetmat->execute(); $stmtgetmat->store_result(); $matcount= $stmtgetmat->num_rows; if ( $matcount == "0" ) { $moveon = "go"; /* close statement */ $stmtgetmat->close(); } else { /* bind result variables */ $stmtgetmat->bind_result($matchID , $rankType, $matchCompany, $matchDivision, $matchNumb, $matchType , $matchTimer, $matchDaytime, $lastMoveLanded, $curMovecount, $eyegougeCount, $asianmistCount, $cfpunchCount, $defenseSet, $weppickup, $curplayerTurn, $matchPlay1, $heaplay1, $fatig1, $momeplay1, $matchPlay2, $heaplay2, $fatig2, $momeplay2, $matchResult, $matchWinner, $matchTime, $matchDate); /* fetch value */ $stmtgetmat->fetch(); /* close statement */ $stmtgetmat->close(); } /* end of else statement */ } /* end of while loop */ } ?> OK forgot to close of the else statement , so above coding is updated with it, still getting same 500 error though
  19. https://www.piliapp.com/php-syntax-check/ OK could have swore above cleared the coding , but now saying unexpected $end on line 56 , which is the ?> at the end so added in another } , as was missing one, now above syntax check link says no errors, but still getting unable to load page and 500 error.
  20. <?php $i = "0"; while ( $i < "8" ) { $i++; $datagetname = ""; /* checking the current value of $i variable and setting database name */ if ( $i == "1" ) { $datagetname = "matchPlayerssingle100"; } elseif ( $i == "2" ) { $datagetname = "matchPlayerssinglehardcore"; } elseif ( $i == "3" ) { $datagetname = "matchPlayersiquit"; } elseif ( $i == "4" ) { $datagetname = "matchPlayerssinglecage"; } elseif ( $i == "5" ) { $datagetname = "matchPlayerssinglehellcell"; } elseif ( $i == "6" ) { $datagetname = "matchPlayerssingleladder"; } elseif ( $i == "7" ) { $datagetname = "matchPlayerssingletlc"; } if ( $datagetname == "" ) { $moveon = "go"; } else { // Create connection $conn = new mysqli($host, $user, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } /* create a prepared statement */ $stmtgetmat = $conn->prepare("SELECT matchID , rankType, matchCompany, matchDivision, matchNumb, matchType, matchTimer, matchDaytime, lastMoveLanded, curMovecount, eyegougeCount, asianmistCount, cfpunchCount, defenseSet, weppickup, curplayerTurn, matchPlay1, heaplay1, fatig1, momeplay1, matchPlay2, heaplay2, fatig2, momeplay2, matchResult, matchWinner, matchTime, matchDate FROM $datagetname WHERE matchID=?"); /* bind parameters for markers */ $stmtgetmat->bind_param("s", $sid); /* execute query */ $stmtgetmat->execute(); $stmtgetmat->store_result(); $matcount= $stmtgetmat->num_rows; if ( $matcount == "0" ) { $moveon = "go"; /* close statement */ $stmtgetmat->close(); } else { /* bind result variables */ $stmtgetmat->bind_result($matchID , $rankType, $matchCompany, $matchDivision, $matchNumb, $matchType , $matchTimer, $matchDaytime, $lastMoveLanded, $curMovecount, $eyegougeCount, $asianmistCount, $cfpunchCount, $defenseSet, $weppickup, $curplayerTurn, $matchPlay1, $heaplay1, $fatig1, $momeplay1, $matchPlay2, $heaplay2, $fatig2, $momeplay2, $matchResult, $matchWinner, $matchTime, $matchDate); /* fetch value */ $stmtgetmat->fetch(); /* close statement */ $stmtgetmat->close(); } /* end of while loop */ } ?> The above page is named getdatabase.php and I include it into match.php, I get a 500 error when trying to access match.php. I can't see why above coding isn't working. Basically I have multiple databases with match information and need to check each database, until I find the right match visitor is viewing. I do have other code that works and does what I need to do, but like to get above coding working , as it makes life easier in future when am adding new wrestling match types to my game, which every match type has its own database. FYI I don't show the include file that contains the $host, $user, $password, $database vars, but it is there.
  21. Well this is strange , I downloaded a free screen reader called Thunder, one of the top results on google search for a free screen reader. (http://screenreader.net/index.php?pageid=11) I checked my old design that had tables galore, and it read everything fine, was no mention of the table tags. So really don't understand why some think screen readers can't read table layout designs as that free one read the content fine to me. also tested windows 10 narrator and that read old design with tables galore fine. really have no idea why people say screen readers can't read content in tables, it reads mines with no issues.
  22. agreed , my statement of HTML5 trying to go in direction of tables dying out was indeed completely incorrect. I didn't fully understand the reasoning for why the table tags where made obsolete in HTML 5, the article I linked in my last post along with what dsoneuk has said to me in this thread, has helped me realize its not a conspiracy against tables lol
  23. http://webaim.org/techniques/tables/ reading this , you can still use tables for layout purposes and screen readers that visually impaired use, can read them, just to have to think on how you do it and be careful not to over do tables. Also there is a table reading mode in screen readers. so like am showing above with the 3 forms. <table> <tr> <td class="form1">form 1</td> <td class="form2">form 2</td> <td class="form3">form 3</td> </tr> </table> I believe a screen reader would read the above as FORM 1 info FORM 2 info FORM 3 info I also believe the class tag be read as well, which explains why all the table tags are now obsolete as they was being read. I cringe at the thought of the old way I designed now, must have been a right nightmare for screen readers. I do think above is OK to do, as the article linked does state can still use layered tables, but keep them simple. Also information I pull from a database table and display in table rows, would be deemed data tables I believe. Yes I know, some here will say and think I should use DIVS, but I find them overly complicated to use and is why I always used tables.
  24. #container { padding:5px; margin-bottom:20px; text-align:center; display:table; width:95%; } .col1 { width:50%; display:table-cell; padding:5px;} .col2 { width:20%; display:table-cell; padding:5px;} .col3 { width:20%; display:table-cell; padding:5px;} yup am no good at using divs, totally foreign to me but to me it should be as simple as above coding, but when reducing window, col2 and col3 won't auto resize. I could understand if I had static number for widths , but with %'s , you would think it auto resize, but it isn't oh well, worth a try I guess.
  25. I was more just playing around with position to see what it did , but yeah not much.
×
×
  • Create New...