-
Posts
518 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by Blade Maker
-
Dude give him his money back ok.
-
Who knows.....Anyways I just want to know am I on the right track of making a username search box? I mean for being a basic one, it might not be secure but I will work on that later.
-
Like legos huh, sounds cool maybe I will use MCCODES soon. You think you can help me start a game?
-
OK I will try to make it more secure.
-
I know this is a noob question but what is MCCodes? And what do the codes look like?
-
OK thanks I will try next time. Anyways how is the script now?
-
I made a basic Username search box for anyone out there looking for a easy to edit script. This script is ready to be installed to your website, will need modifications to suit your needs. I will be willing to install it for you for free and or modify it. <form method="POST"> <input type="text" name="search" /> <input type="submit" name="submit" /> </form> <?php $search = $_POST['search']; $submit = $_POST['submit']; mysql_real_escape_string($search); if(isset($submit)){ if(!strlen($search)){ # Change depending on how you report user errors. die('Please enter a search term.'); exit; } else { $connect = mysql_connect('host', 'username', 'password') or die('Couldn\'t connect!'); mysql_select_db('database') or die('Couldn\'t find db'); $searchsql = mysql_query("SELECT username FROM `users` WHERE username LIKE '%$search%'"); while ($row = mysql_fetch_array($searchsql)) { ?> [url="<?php echo $row['username']; ?>.php"]<?php echo $row["username"]; ?>[/url] <?php } } } ?> I will try to add security hold on.
-
Its pretty nice, let me know if you need anything ok.
-
Hi, I am not a member of mwg I am a member of Make Web Games, LOL. Next is null
-
Happy New Years! 2010 has arrived.
-
Where did you find this? And who made it?
-
I must have been tired, sorry: http://kingdomsarcade.byethost5.com
-
This is a flash game website, I made it from scratch tell me what you think please. Its not finished.
-
I need someone to fix up a logo on a computer within 2 days if possible, its hand drawn and I need someone now.
-
I am calling stuff from my database, and I want to know if when I echo it if I can take out certain characters when I echo it, not from the database but only in the echo, if so how?
-
Well the money goes over the limit and then goes back to the number. Can anyone stop this with my code? I do not want to use die, it messes a lot of things up.
-
Nope the screen is blank.
-
<?php session_start(); $user = $_SESSION['username']; //open my database $connect = mysql_connect('____', '_______', ________') or die('Couldn\'t connect!'); mysql_select_db('______castlewarslogin'); $query = mysql_query("SELECT * FROM `castle wars users` WHERE username = '$user'"); $username = mysql_fetch_array($query); $last = $username['lastupdate']; //timestamp from db $extraTime = time() - $last; $money = floor($extraTime / 60); if (($username['money']<500&&$username['bank']==0) || ($username['money']<600&&$username['bank']==1) || ($username['money']<700&&$username['bank']==2)) { if ($money > 0) { //lets update users table mysql_query("UPDATE `castle wars users` SET money=money+$money WHERE id= '$username[id]'") or die(mysql_error()); } echo 'user\'s money:'. ((int)$username['money']+(int)$money) .'money.'; } else echo 'user\'s money:'. ((int)$username['money']+(int)$money) .'money.'; //lets update users table mysql_query("UPDATE `castle wars users` SET lastupdate=lastupdate+$extraTime WHERE id= '$username[id]'") or die(mysql_error()); ?> Does anyone know why the number/money goes over the limit, if the bank is at 0 it is suppose to stay at 500 not over, but it goes over the limit anyone know why?
-
What is the easiest way to do this, is it possible for a number the increase by one every 1 minute without refreshing the page, preferably in php.
-
<?php session_start(); $user = $_SESSION['username']; //open my database $connect = mysql_connect('_______', '___', '____') or die('Couldn\'t connect!'); mysql_select_db('__________'); $query = mysql_query("SELECT * FROM `castle wars users` WHERE username = '$user'"); $username = mysql_fetch_array($query); echo 'Logged user has: '.$username['money'].' money'; //money amount to add for each round $add_money = 1; //time now, and round time in seconds (1h=60*60seconds=3600) $time_now = time(); $round = 3600; //time of last update+time needed must be smaller then time now to update if (($username['lastupdate']+$round) <= $time_now) { //see how many rounds (hours) were there from last update $nr_rounds = floor(($time_now-$username['lastupdate'])/$round); //calculate how much money user gained $all_money = $nr_rounds * $add_money; //calculate how many rounds in seconds (how many hours in seconds) $add_time = $nr_rounds * $round; //lets update users table mysql_query("UPDATE `castle wars users` SET lastupdate=lastupdate+'$add_time', money=money+'$all_money' WHERE id = '$username[id]'") or die(mysql_error()); //here you can refresh page (so you can see progress) or select user again using login } ?> OK now as soon as I log in I get so much money! How can I make so I get 1 dollar every 5 seconds.
-
Ill do the coding. Email me [email protected]
-
Thanks guys but I already fixed it. I used the w3schools forum.
-
OK in the video I am suppose to move on this script is not done. ...... is what I just put in until the next video. Now I noticed the <php did not have the ? so I put that in now the code is not showing. So what do I need to fix, I believe I did what the video says.
-
I watched the php academy videos and I watched the one where you make a register script. Here is the code I made while watching it: <php echo "<h1>Register</h1>"; $submit = strip_tags($_POST['submit']); $firstname = strip_tags($_POST['firstname']); $username = strip_tags($_POST['username']); $password = strip_tags($_POST['password'])); $repeatpassword = strip_tags($_POST['repeatpassword'])); $date = date("Y-m-d"); if ($submit) { if ($firstname&&$username&&$password&&$repeatpassword) { $password = md5($password); $repeat = md5($repeatpassword); if ($password==$repeatpassword); { if (strlen($firstname)>25||strlen($username)>25) { echo "Max character length for first name or username is 25."; } else { if (strlen($password)>25||strlen(password)<6) { echo "Password is only allowed 6-25 characters long."; } { .... } } else echo "Your passwords do not match."; } else echo "Please fill in all fields."; } ?> <html> <form action='register.php' method='POST'> <table> <tr> <td> Your first name: </td> <td> <input type='text' name='register'> </td> </tr> <tr> <td> Choose a username: </td> <td> <input type='text' name='username'> </td> </tr> <tr> <td> Choose a password: </td> <td> <input type='password' name='password'> </td> </tr> <tr> <td> Repeat your password: </td> <td> <input type='password' name='repeatpassword'> </td> </tr> </table> <input type='submit' name='submit value='register'> </form> </html> What is the problem with this code, here is the link to the video thanks. http://www.youtube.com/user/phpacademy#p/s...h/0/IUCEEh-ASH8 this is only the 3rd tutorial on this, but this is where I got stuck.