Jump to content

Ryflex

Members
  • Posts

    115
  • Joined

  • Last visited

Everything posted by Ryflex

  1. Hi all, I have an authentication part on my website that checks every page through a session variable if a user is logged in and which user it is. When I test my code on my computer it works perfectly registration and login goes smooth but when someone on another computer tries it they get the acces denied page.... does anyone know why??? Greets Ryflex
  2. Hi all, Found a great script: <script language="JavaScript"> var tijd= <?php echo "$time"; ?> function countdown(){ if(tijd>0){ if(tijd>86399){ dagen=Math.floor(tijd/3600/24) uren=Math.floor((tijd-dagen*3600*24)/3600) minuten=Math.floor((tijd-dagen*3600*24-uren*3600)/60) seconden=Math.floor(tijd-dagen*3600*24-uren*3600-minuten*60) if( uren < 10 ) { uren = '0'+uren ;} if( minuten < 10 ) { minuten = '0'+minuten ;} if( seconden < 10 ) { seconden = '0'+seconden ;} var zichttijd=dagen+":"+uren+":"+minuten+":"+seconden } else{ uren=Math.floor(tijd/3600) minuten=Math.floor((tijd-uren*3600)/60) seconden=Math.floor(tijd-uren*3600-minuten*60) if( uren < 10 ) { uren = '0'+uren ;} if( minuten < 10 ) { minuten = '0'+minuten ;} if( seconden < 10 ) { seconden = '0'+seconden ;} var zichttijd=uren+":"+minuten+":"+seconden } document.getElementById("countdown").innerHTML=zichttijd; countdownTimer=setTimeout("countdown()",1000); tijd=tijd-1 } else{ document.write("Ready for Upgrade") } } </script> <SPAN id="countdown"></SPAN> <SCRIPT language="JavaScript">countdown();</SCRIPT> Thanx for the replies. Ryflex
  3. Thanks for the reply, I tested the code but all I get as output is "X" Ryflex
  4. Hi all, I'm looking for a countdown clock where the input is an amount of seconds, instead of going towards a targetdate. Is anyone able to help me out here??? Ryflex
  5. @JTallis The point is indeed that with a GET people could input just in the adressbar. That's why I'm looking for something with POST. Ryflex
  6. @JTallis What I mean is that I have say 10 cities named in the Dropdown list each with a number value. When I select say city 2 I need the script to go to another page which uses the value of that city in a php $_POST variable. Thnx Ryflex
  7. Hi all, I have a Dropdown menu and I want to have an onclick event in it. So basicaly there's value 1 and value 2 and when I select value 2 the page goes to the link behind it. I guess this is javascript and I'm a total noob in javascript so I hope anyone can help me out. Thnx Ryflex
  8. Hi all, A little addition to my question... Is it possible to make the dropdown menu in a way that when I click one of the entries it automaticaly uses that value as a submit. So if I click value 2 the page reloads and $_post the value 2. Thnx Ryflex
  9. @ngreenwood6 Thnx works perfectly now Ryflex
  10. Hi all, Does anyone know if it's possible to generate a dropdown list filled with database information. I use the following to get the information from the database: $query = "SELECT Name FROM city WHERE member_ID = '$member_ID'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { echo $row['Name'] . '<br>'; } Thnx Ryflex
  11. @Pikachu2000 Thnx very much for the solution it works perfectly @mikosiko I tried what you said and added the MYSQL_ASSOC in the mysql_fetch_array, but it only made sure I only got the result only once. I thought it was the meaning an array would be able to contain the information of multiple rows. Anyway I do thank you also for giving me more understanding in the working of arrays. Ryflex Burn Rubber not Your Soul
  12. Hi all, Since I'm still failing to see the problem I'm putting about every scrap of info about this problem on here. Database Table: Code: $query = ("SELECT * FROM city WHERE member_ID = '$member_ID'"); $result = mysql_query($query); $array = mysql_fetch_array($result); function print_all($array) { foreach ($array as $value) { print("$value<br>"); } } print_all($array); Output: 1 1 1 1 Amsterdam Amsterdam 0 0 0 0 Is there anyone out there who might have a clue what's wrong here.... I changed the member_ID of Amsterdam to 2 and then you get 2 2 1 1 Leiderdorp Leiderdorp 0 0 0 0 About now I'm starting to think about hammers and my laptop..... Anyone HELLLPPPPP Ryflex
  13. This is better deleted a part with commentary slashes but still it seems stuck on the first row of the database table Ryflex
  14. @yaMz Hi, thnx for the nudge ;-) I made this out of it but it only gives me the first row in the database twice. $result = mysql_query("SELECT * FROM city WHERE member_ID = '$member_ID'"); $array = mysql_fetch_array($result); foreach ($array as $value) { echo $value . "<br />"; //echo "city = $city <BR> // cityname = $cityname <BR> // X = $x <BR> //Y = $y"; } unset($value); ?> What did I do wrong Thnx Ryflex
  15. @flemingmike Ok got the code working but it only outputs the last city in the table... How will I be able to make to my code output al entries??? Thnx Ryflex
  16. Hi all, I'm trying to figure out how I can get my code to get me some information in a table from the database. The information from the database are a few city names. In the table will be a lot of city names from a lot of different users. I want the code to only print the city's of the specified user ($member_id). Can anyone give me hint (not immediately all the code want to try myself but I do need a nudge in the right direction). Btw table in database has the columns: ID, member_ID, X, Y Where ID is the unique CityID and the rest speaks for itself (X,Y is coördinates) Thnx Ryflex
  17. Hi all, I got a javascript of the net and integrated it within my php file. After refreshing the page the timer gets higher everytime. I echo'd the input variable on the same page and that gives the correct input in seconds. Script: <script type="text/javascript"> var nIndex = '<?php echo "$time_difference"; ?>'; // 35 days, in seconds; var GMToffset = 0; // your current GMT offset; var refDate = new Date(); // start date; refDate = new Date(refDate.getFullYear(), refDate.getMonth(), refDate.getDate(), refDate.getHours(), refDate.getMinutes(), refDate.getSeconds()+nIndex, 0); var done = false; function init(){ var currDate = new Date(); currDate.setHours(GMToffset+currDate.getHours()+currDate.getTimezoneOffset()/60); if (refDate < currDate) { document.getElementById('display').innerHTML = "This auction is closed."; done = true; } var remTime = refDate-currDate; var nDays = parseInt(remTime/86400000); var nHours = parseInt((remTime-(nDays*86400000))/3600000); var nMin = parseInt((remTime-(nDays*86400000)-(nHours*3600000))/60000); var nSec = 0; if (refDate > currDate) { nSec = 60-(currDate.getSeconds()); } else { nSec = currDate.getSeconds(); } var nMonths = parseInt(nDays/30); var rDays = parseInt(nDays-(nMonths*30)); if (!done) { setTimeout("init()", 1000); document.getElementById('display').innerHTML = nMonths + " Months, " + rDays + " Days, " + nHours + " Hours, " + nMin + " Minutes, " + nSec + " Seconds"; } } navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false); </script> <style type="text/css"> body {margin-top: 0px;} .timer_countdown {width: 460px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: center; font-family: 'times new roman'; font-size: 12pt; color: #FFFFFF; background-color: #002b4d; padding-bottom: 3px;} </style> </head> <body> <center><h1><?php echo"$building" ?></h1></center> <table width="500" border="1" align="center" cellpadding="2" cellspacing="0"> <tr> <td><b>Building</b></td> <td><b>Level</b></td> <td><b>Upgrade</b></td> </tr> <tr> <td><a href="link"><?php echo"$building" ?></a></td> <td><?php echo "$building_level";?></td> <td><div class="timer_countdown" id="display"></div></td> <td><a href="link">Upgrade!</a></td> </tr> </table> </body> </html> thnx Ryflex
  18. @ PFMaBiSmAd and mikosiko Thnx for the solution. I didn't know you should make aliases (Didn't know they existed) but it works perfectly now. Ryflex
  19. @ MrAdam $count_query = "Select count(upgrading) From buildings Where upgrading = '1'"; $count_mysql = mysql_query($count_query); $count_array = mysql_fetch_array($count_mysql); $count_upgrading = $count_array['count']; Sorry just starting so still trying to find shortcuts where there aren't any. This better??? Because now I'm not able to upgrade anything anymore.... Thnx Ryflex
  20. @ MrAdam I tried the following but still it upgrades when it's supossed not to. $count_query = "Select count(upgrading) From buildings Where upgrading = '1'"; $count_upgrading = mysql_query($count_query); // Data CHECK if($count_upgrading > '0') Thnx Ryflex
  21. building finish upgrading house 1284944810 1 shed 0 0 mall 0 0 In my code it says when the time now exceeds the finish in the table set it 0 and set upgrading 0. While house is upgrading the other 2 shouldn't be able to. What I need is a simple SELECT that gives me how much 1's there are (because later on it will be possible to upgrade 2 at a time. Thnx again Ryflex
  22. @ Colleyboy thnx for the quick reply but that won't be the answer since it's about the column in the database. After a while there will be a 1000 or more records.... I need a more universal solution I guess... Thnx anyway Ryflex
×
×
  • 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.