Jump to content

Notretsam

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by Notretsam

  1. thank you for the info on mysql_ going be obsolete in next version of PHP justsomeguy appreciate the help, think am sorted on the main issue I posted now, he just going use firefox.
  2. update issue is related to google chrome only , must be one of his extensions that for some reason is blocking the $SESSION working on one page
  3. its deff not anything to do with my coding, it something on the customers end but for life of me can't find out why $SESSION is not being picked up on this one page but is on all other pages I added this to top of page session_start();$id = session_id();echo "<strong>ID IS:</strong> $id<br>"; he does see the id value , but for some reason $SESSION['logname'] and $SESSION['auth'] aren't setting on that one page
  4. The attached image is what the customer sees when going to the one page that not working for him. On first glance , it does look really bad. All the undefined variables are due to $_SESSION['auth'] and $_SESSION['logname'] being null (no values) When it should contain yes for auth and login name for logname All other pages on site using the same code are working fine for him, it is just this one page. Which is very weird and completely puzzling to me, hence why I posted this thread.
  5. http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059 came across above this sucks they stopping mysql_ and also doesn't make any sense why the stop supporting it all together. in whole time using it, i never had any issues with it. regarding initial reason for thread, still not heard from customer but have moved the error stuff above session_start();
  6. ah so its how u connect to database that will not work in future so how do I change below to something that will be supported. $connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to server.");$db = mysql_select_db($database, $connection) or die ("Couldn't select database");$sql = "SELECT * FROM memberInfo WHERE wrestlerName='{$_SESSION['logname']}'";$result = mysql_query($sql) or die("Couldn't execute query 1.");$row = mysql_fetch_array($result,MYSQL_ASSOC);extract($row);
  7. ok I put ini_set('display_errors', 1); error_reporting(E_ALL); at top of the page below session_start(); and nothing came up for me I doesn't seem like customer who having issues is around right now, so get him to check what he seess later, an report back. an yes, should have put exit(); in Am not sure what you mean by a problem with mysql extension.
  8. You won't see anywhere the $_SESSION variables are being set to blank, as there no code to set them to blank. the person is logged in and the $_SESSION variables are filled in then for some reason this one person can't view one page because the $_SESSION variables are showing as blank, when they shouldn't be. In any other page for him, the $_SESSION variables are filled in correctly and he can view page fine.
  9. I have the strangest problem and quite honestly, am completely and utterly mystified by this, so really hoping someone here can help me find a solution. I have a community based game which requires people to sign up and login to use. I use $_SESSION['auth'] and $_SESSION['logname'] and session_start(); at the beginning of every page to correctly get visitors account information and display content based on there account. This has always worked well for me and is working for everyone else currently signed up and myself. However, I have one customer who it works for on all pages, accept one page. On this page, he is meant to see his own wrestling moves within combos and his color theme he selected, but he doesn't. I have tracked the bug down to $_SESSION variables , for some reason on this one page , the $_SESSION variables are blank, which is why no content is showing for him. For the life of me, I can't figure out why $_SESSION variables have values on all other pages for him, but don't on this page, the coding is no different from other pages. Below is the code that is on all pages and works for the customer on all other pages, accept this one page. After the $visitid line there is a lot more coding related to the game, but don't need to show it. the $_SESSION['auth'] and $_SESSION['logname'] are empty on this one page for customer, so the issue is there. session_start();if (@$_SESSION['auth'] == "no"){ $mess = "You must be logged in to view that page."; header("Location: ../index.php?message=$mess"); }if (@$_SESSION['auth'] == "yes"){/*took line out here that gets mysql login info */ $connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to server.");$db = mysql_select_db($database, $connection) or die ("Couldn't select database");$sql = "SELECT * FROM memberInfo WHERE wrestlerName='{$_SESSION['logname']}'";$result = mysql_query($sql) or die("Couldn't execute query 1.");$row = mysql_fetch_array($result,MYSQL_ASSOC);extract($row);/*Below is variable containing the ID for person viewing the page */$visitID = "$memid";} really hope someone has came across this issue before and can give me a fix, or can point me in a direction of getting a fix, because am really confused on this one. Makes no sense why the $_SESSION variables are setting on every other page but not on one page. Also I have logged into my site via his login details and it worked fine for me.
  10. sadly I went to end of that page niche, copied the coding into a page, and added the script tags around it, didn't work for me. didn't really fill me with confidence when the end code on page doesn't work, so I moved on. did come across this yesterday http://keith-wood.name/countdown.html , which did get working. coding is similar to website u linked, an does work like it says, hard for me to recode it to do what I want though, as am not a javascript coder. Also I realized today, I actually want timer for player to stop and only start again when it there turn. I did work out coding for a "match timer" today and it works perfectly, used the timestamp function above to do that. so got an option to use a match timer instead of individual player timers. It not really what I wanted but does fit with wrestling, as time limits are usually on matches and not individuals. I also came across this today http://snipplr.com/view/1524/ Certainly know using time() and storing it in a database is way to go on this. its just how to use that timestamp after retrieving it from database.
  11. the website you linked in niche shows coding I saw on some other web pages , but that one walks you through it step by step, which could help me.
  12. I did think of using time(); use that on any posts on sites, an use the following code to change time. function timestampsw($original) { // array of time period chunks $chunks = array( array(60 * 60 * 24 * 365 , 'year'), array(60 * 60 * 24 * 30 , 'month'), array(60 * 60 * 24 * 7, 'week'), array(60 * 60 * 24 , 'day'), array(60 * 60 , 'hour'), array(60 , 'minute'), ); $today = time(); /* Current unix time */ $since = $today - $original; // $j saves performing the count function each time around the loop for ($i = 0, $j = count($chunks); $i < $j; $i++) { $seconds = $chunks[$i][0]; $name = $chunks[$i][1]; // finding the biggest chunk (if the chunk fits, break) if (($count = floor($since / $seconds)) != 0) { // DEBUG print "<!-- It's $name -->n"; break; } } $print = ($count == 1) ? '1 '.$name : "$count {$name}s"; if ($i + 1 < $j) { // now getting the second item $seconds2 = $chunks[$i + 1][0]; $name2 = $chunks[$i + 1][1]; // add second item if it's greater than 0 if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0) { $print .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s"; } } return $print;} I include that page in and use below coding on page. $timePost = timestampsw($testtime2); I then get output like 3months, 2 weeks and so on. $testtime2 would be filled with database field , which $time() would be added to.
  13. Hope I explain this well enough for people to understand what am trying to do. Am mostly a PHP developer and use mySql for database storage, so out of my element here. I am working on a wrestling game and think I mostly got it worked out, however am struggling on "match countdown times" I been Google searching on countdown timers and did suspect, that javascript would be needed and possible ajax. There going be 2 to 4 players and each player will have a certain time before being counted out. When the match is setup by someone, they can select from a variety off options for match length, 5mins, 1 day, 3 days, 5 days, 7 days etc. Am trying to find a way to store a timer for each player in a database table, then output it on a page and show the time remaining for the player. lol I realize it not exactly an easy thing am trying to do, but really am at a lose on where to start here. So any advice anyone can give me will be greatly appreciated. I do need a way to convert the variables with the timer information over to PHP though.
  14. yup that worked, knew it be most likely something simple I was missing, usually always is when staring at code that not working for ages lol thanks all
  15. ahhh now I see, as me said in opening post, only a little bit familiar with Javascript , mostly PHP I use. sorry justsomeguy and thank u thanks thescientist Imagine that would fix it...I hope.
  16. you want to block someone manually adding #pagetwo to the address bar and not clicking the link? If so, i don't understand why that an issue, it's not like manually adding #pagetwo is doing any damage, however, maybe am missing something. I would think anything that is done to prevent #pagetwo being added to the address bar , could also effect the link working.
  17. var playTurn = document.getElementById('playTurn').value; var selMove = document.getElementById('selMove').value; sorry it seems you are saying the names of form elements are not the same but they are
  18. <input name="playTurn" type="hidden" value="<?php echo "$playerTurn"; ?>"><select name="selMove" onChange="showUser(this.value)"> sorry forgot to change User to SelMove when i reedited to post but they are in form
  19. hello everyone, been using W3Schools for ages now but never had the need to sign up here, as tutorials are always well explained, an always guide me on what am trying to do. This tutorial here is no different , it works like it should. http://www.w3schools.com/php/php_ajax_database.asp I have got the coding working fine , an been able to pick up the one variable I sent across, an get information from database, then send it back without page refreshing. However am looking to send multiple variables across, anytime I add to the coding, it just stops working, which is weird. Below is the code that I have for the function. <script>function showUser(str) { if (str=="") { document.getElementById("txtHint").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("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","theme/getmove.php?q="+str,true); xmlhttp.send();}</script> I tried building my own query string (str) which is below, for some reason it didn't work var playTurn = document.getElementById('playTurn').value; var selMove = document.getElementById('selMove').value; var queryString = "?q=" + selmove + "&playTurn=" + playTurn; xmlhttp.open("GET","theme/getmove.php"+queryString,true); I must admit am not really a javaScript coder, always use PHP but from JavaScript snippets of code I use, I know a little bit. also here is rest of code on page , could also show the getmove page coding if needed but already a long post. <?phpif ( $playerTurn == "" ) { $playerTurn = "one"; }?><form><input name="playTurn" type="hidden" value="<?php echo "$playerTurn"; ?>"><select name="users" onChange="showUser(this.value)"><option value="">Select a move:</option> <?php $moveTier = "1"; include("theme/mem.inc");$connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to server.");$db = mysql_select_db($database, $connection) or die ("Couldn't select database");$sql3 = "SELECT * FROM moveStats WHERE moveTier='1' ORDER BY moveName";$result3 = mysql_query($sql3) or die("Couldn't execute tier 1 move get."); /* start of main member loop */ while ( $row3 = mysql_fetch_array($result3)) { extract($row3); if ( $q == "$moveName" ) { echo "<option value='$moveID' selected='_selected'>$moveName</a>"; } else { echo "<option value='$moveID'>$moveName</a>"; } } ?></select></form><br><div id="txtHint"><b>Person info will be listed here.</b></div> hope someone can help me here, no doubt as always, it probably something simple am missing but beyond frustrated with this now. while am here, like to take the chance of thanking all the staff at W3 Schools, awesome resource/website.
×
×
  • Create New...