
3raser
Members-
Posts
815 -
Joined
-
Last visited
Everything posted by 3raser
-
http://minecraftservers.comyr.com/search.php <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php echo "<a href='../index.php'>Home</a> | <a href='start_upload.php'>Upload</a> | Search & Browse | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; $search = $_POST['search']; if(!$search) { echo "<form action='search.php' method='POST'>Search: <input type='text' name='search'><input type='submit' value='Search'></form>"; } else { $query = mysql_query("SELECT * FROM mods WHERE name LIKE '%$search%' OR description LIKE '%$search%'"); while ($row = mysql_fetch_assoc($query)) { $x++; echo "#". $x .": ". $row['name'] .".[VIEW]<br/>"; } if($x=="0") { echo "No results found."; } else { echo "<br/>".$x." results."; } } include("includes/footer.php"); ?> Whenever you type in something without spaces, it works perfectly. When you do add a space, it basically goes blank. :/
-
How do I get it so it will check what extension it has? Like if it's .txt, or .zip Thanks.
-
So what goes in {whatever}? Sorry. :/
-
Sure thing. <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } elsea { echo '<form enctype="multipart/form-data" action="upload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000000 byte" /> Choose a Plugin to Upload: <input name="file" type="file" /><br /> <b>Title:</b> <input type="text" name="title"><br/> <b>Description</b><br/><textarea name="description" cols="45" rows="25"></textarea> <br/> <input type="submit" value="Upload Plugin" /> </form>'; echo "<br/><br/>"; echo "NOTE: Uploading any harmful programs and/or files that can invade another users privacy, harm their computer, or uploading any files like malware, viruses, or trojans will result in an INSTANT, PERMANENT, IP Ban."; } ?> <? include("includes/footer.php"); ?>
-
This is my first time ever working with this type of stuff with PHP. So, I basically got this code from a tutorial at Tizag on how to upload files to your webiste. But everytime I do, I get an error message. I don't get a PHP error, I just get it from the code. "There was an error uploading the file, please try again!" <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { $description = $_POST['description']; $description = mysql_real_escape_string($description); $ip = $_SERVER['REMOTE_ADDR']; $date = date('m-d-y'); $title = $_POST['title']; $title = mysql_real_escape_string($title); $query = mysql_query("SELECT COUNT(id) FROM mods"); $finish_query = mysql_fetch_assoc($query); $output = $finish_query['COUNT(id)'] + 1; echo $output; $_FILES['uploadedfile']['name'] = $output; echo $_FILES['uploadfile']['name']; $target_path = "mods/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The mod ". basename( $_FILES['uploadedfile']['name']). " has been uploaded. Check it out HERE."; mysql_query("INSERT INTO mods VALUES('', '$ip', '$date', '$title', '$description', '$user')"); } else{ echo "There was an error uploading the file, please try again!"; } } include("includes/footer.php"); ?>
-
This is EXACTLY WHY I ASKED. Can you stop posting on my threads Thorpe? Everytime you do you always have to be a jerk. Not to pile on, but these are basic metric system prefixes. The kind of stuff one learns in middle school science classes. My county doesn't teach stuff like this in middle school.
-
No worries, I just had that in there to make sure the username variable was working correctly. And this code of yours, is it a fix or just a better code organization? Can you please point out what was wrong with my previous code? It's just the way I code, and I'd love to get a few pointers on how I could improve it.
-
That isn't your IP is it? I wouldn't show off your IP like that. :/
-
This is EXACTLY WHY I ASKED. Can you stop posting on my threads Thorpe? Everytime you do you always have to be a jerk.
-
Yes, and the value comes out correctly. The password you have entered in for Admin is incorrect. Please go back.
-
Yes, I know this. But I don't know the size of bytes. How many bytes does it take to make a MB? Thanks.
-
My MAX_FILE_SIZE form has the max file upload size to 100000. How big is this, in MB?
-
Did all of the above. Still didn't work. Is it something wrong with my extraction query?
-
The password ARE correct. My code keeps saying that the password is INCORRECT. The password is MD5'ed once a user registers, and when they type in a password at the login (as shown), the password is also MD5'ed. Why is it that it's output is incorrect password? <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php if(!$_SESSION['user']) { $username = $_POST['username']; $password = $_POST['password']; $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); if(!$password || !$username) { echo ' <h1>Login</h1> <center><p><form action="login.php" method="POST"> <table border="0"> <tr><th>Username:</th> <td><input type="text" name="username" maxlength="20"><br/></td></tr> <tr><th>Password:</th> <td><input type="password" name="password" maxlength="30"><br/></td></tr> <tr><th></th><td><input type="submit" value="Login"></td></tr> </table></form></p></center> </div> '; } else { $query = mysql_query("SELECT COUNT(username),password,username FROM users WHERE username='$username'"); $check = mysql_fetch_assoc($query); $db_username = $check['username']; $password = md5($password); if($check['COUNT(username)'] < 1) { echo ' <p>No account exists with this username. Please go back.</p> '; } elseif($check['password']==$password && $db_username==$username) { echo ' <h1>Login Successful</h1> <p>You have successfully logged in! Return home.</p> '; $_SESSION['user']=$username; } else { echo ' <p>The password you have enetered in is incorrect. Please go back.</p> '; } } } else { echo ' <p>Your already logged in!</p> '; } ?>
-
Am I just bad at math, or is my calculator wrong?
3raser replied to 3raser's topic in PHP Coding Help
Thank you! Fixed it. -
Am I just bad at math, or is my calculator wrong?
3raser replied to 3raser's topic in PHP Coding Help
No you are correct! The number 306150 remains constant because you don't subtract anything from it. And how do you kill a Black Demon 0.0149175240895 or 0.403253307202 times? You don't need to subtract anything from it. 306150, the amount of the Black Demon, needs to divide into their goal to see how manys time they need to kill it. When it does that, it gives me a number, but even if I change the amount of the goal, it stays the same. -
Am I just bad at math, or is my calculator wrong?
3raser replied to 3raser's topic in PHP Coding Help
But there is no reason to do that, I believe. People just go to the calculator, type in the information, and it's suppose to do the math. They don't actually submit information into the database. -
Website: http://novacms.vacau.com/index.php I'm trying to make a calculator for this game I play, it's fully developed, but with one bug. It doesn't do the math right. $goal = The amount of EXP (Experience Points) someone wants to get $exp = The amount of EXP they currently have $npcs_exp["exp"] = The amount of EXP the monster has But, when they enter in the information, the calculation is all screwed up. When I do it, it seems to give me the same number EACH time. The part where the calculation "goes down". Remember, I'm trying to see how many times you need to kill a NPC to achieve your goal. //math $npc_exp_extract = mysql_query("SELECT exp FROM npcs WHERE name='$npc'"); $npcs_exp = mysql_fetch_assoc($npc_exp_extract); $amount = $goal / $npcs_exp["exp"]; Full code: <?php $exp = $_POST["exp"]; $npc = $_POST["npc"]; $goal = $_POST["goal"]; mysql_connect("removed", "removed", "removed"); mysql_select_db("a2248602_npcs"); if(!$goal || !$npc || !$exp) { echo "<center><form action='index.php' method='POST'>GOAL: <input type='text' name='goal'> Current XP: <input type='text' name='exp'>"; echo "NPC: <select name='npc'>"; $npc_extract = mysql_query("SELECT * FROM npcs"); while($npcs = mysql_fetch_assoc($npc_extract)) { echo "<option name='". $npcs['name'] ."'>". $npcs['name'] ."</option>"; } echo "</select> <input type='submit'></form></center>"; } else { //math $npc_exp_extract = mysql_query("SELECT exp FROM npcs WHERE name='$npc'"); $npcs_exp = mysql_fetch_assoc($npc_exp_extract); $amount = $goal / $npcs_exp["exp"]; if($amount=="1") { echo "You will need to kill a <b/>". $npc ."</b> <b>". $amount ."</b> more time. You earn ". $npcs_exp["exp"] ." XP for each kill from this NPC. | <a href='index.php'>Do another</a><br/><br/>"; } else { echo "You will need to kill a <b/>". $npc ."</b> <b>". $amount ."</b> more times. You earn ". $npcs_exp["exp"] ." XP for each kill from this NPC. | <a href='index.php'>Do another</a><br/><br/>"; } } echo "<center>Made by Zaros from <a href='creation-x.net'>Creation-X</a></center>"; ?> Mod edit: DB credentials removed.
-
I don't see how it could be anymore clearer... How can I get the recent songs list displayed on my website? Example: http://www.zybez.net/radio/
-
It's very possible, and I've seen a website that's done it (http://www.zybez.net/radio/) - They are able to include the recent songs played on there website. The information can be obtained from right here: http://68.168.100.60:7942/played.html But I'm not sure if thats where they get it from. If I login to my Admin section, there will be an option that says get XML stats. But I'm not sure if that shows the recent songs played like it would at http://68.168.100.60:7942/played.html (Everytime I refresh the page, the stats/data/info in the XML change) 1250001522Rockhttp://srbuckey.listen2myradio.comMusicPEAK - RockKings of Leon - Radioactive N/AN/AN/A226153140audio/mpeg1.9.86201901701119000000004013207.144.125.60NSPlayer/11.0.6001.7006 WMFSDK/11.0026101521287587284Kings of Leon - Radioactive 1287586919Three Days Grace - Riot 1287586542Alice In Chains - Here Comes The Rooster 1287586281Green Day - Boulevard of Broken Dreams 1287586277down 1287586075Green Day - American Idiot 1287586044Metallica - Enter Sandman 1287585836ACDC Highway To Hell.mp3 1287585449Metallica - 04 The Unforgiven I.MP3 1287585448[HTTP/1.1 200 OK] http://www.ventsi.com/Music/MetallicA/1991 - Black Album/Metallica - 04 The Unforgiven I.MP3
-
This is what I have: <?php if(!isset($_POST['input'])) { echo ' <b>How many pieces of data do you have?</b> <form action="index.php" method="POST"> <input type="text" name="input"> <input type="submit"></form><br/> <font size="2">Ex: 88.8,92.3,76.5 - That would be 3 pieces of data</font>'; } else { if($_POST["data"]) { $add = $data + $data; $answer = $add / $_POST["amount"]; } else { $data = explode(',', $_POST['input']); echo '<form action="index.php" method="POST">'; $i = 0; foreach($data as $number) { echo ++$i . ': <input type="text" name="data[]" value="'.$number.'" /><br />'; } echo '<input type="hidden" name="amount" value="'. $i .'"><input type="submit" value="Average"></form>'; } } ?> I'm trying to click "Average", and then see the average of all of the numbers. But I don't know how to get all of the numbers from the one form.
-
Can you give me an example of that code in use? I'm a bit confused. :/
-
I want to create a calculator that allows you to type in how many pieces of data you have, or how many averages you have. Once that is done, the amount of boxes pop up correctly - and you can enter in your data. But how can I get all those pieces of data from EACH box using one form? Current Example: http://novacms.vacau.com/ Code: <?php $boxes = $_POST['input']; if(!$boxes) { echo '<b>How many pieces of data do you have?</b> <form action="index.php" method="POST"><input type="text" name="input"><input type="submit"></form><br/><font size="2">Ex: 88.8,92.3,76.5 - That would be 3 pieces of data</font>'; } else { echo '<form action="index.php" method="POST">'; for($i = 0; $i <= $boxes; $i++) { echo '<input type="text"><br/>'; } echo '<input type="submit" value="Get average"></form>'; } ?>