Jump to content

TeroYukio

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by TeroYukio

  1. Hey guys, I'm wondering if there is a way to make a php cronjob only executable by the server. In other words if I go to www.yoururlhere.com/cron/cronjob.php it will execute the script. Is there anyway of preventing that? Maybe with chmod?
  2. *facepalm* I think its time for bed, 2:30 am I can't believe I missed that. Sorry!
  3. Here is my code: <?php include('header.php'); $sql = ("SELECT * FROM users ORDER BY id") or die(mysql_error()); $res = mysql_query($sql); while($rows = mysql_fetch_array($res)){ $id = $rows['id']; $sql2 = ("UPDATE users SET gold = (gold * 5) WHERE id = '$id'") or die (mysql_error()); $res2 = mysql_query($sql); echo "User: $rows[un] now has $rows[gold] gold."; echo "<br>"; } mysql_close(); ?> This is what it displays every time I refresh the page: User: asdfasdf now has 25 gold. User: terukio now has 30 gold. User: bobby now has 0 gold. When I refresh it should updated the first user to 125 gold and the second to 150 gold. However it does not do this and it does not display an error. EDIT: Even if I remove the condition WHERE id = '$id' it still gives me the same result.
  4. Thanks, works as intended: <?php include('header.php'); $sql = ("SELECT * FROM users ORDER BY id") or die(mysql_error()); $res = mysql_query($sql); while($rows = mysql_fetch_array($res)){ echo "$rows[id]"; echo "<br>"; } mysql_close(); ?> Displays: 5 6 7
  5. This is my code: <?php include('header.php'); $sql = mysql_query("SELECT * FROM users")or die(mysql_error()); $rows = mysql_fetch_array($sql); foreach($rows as $row){ echo "$row[id]"; echo "<br>"; } mysql_close(); ?> This is what it displays: 5 5 2 2 In my database currently there are three "id"s: 5, 6, and 7. What is going on?
  6. I would like someone to analyze my website and what could be done to improve it. I know the graphics are blah but I'm not proficient in that and neither am I proficient in coding. So just let me know what could be spruced up. http://www.mildrum.net This website is focused on giving the user more information on the services I offer. My sister is an English major and will be revamping the home page, hours of availability and contact me pages with proper and amazing English like she did to the other pages.
  7. I was wondering if anyone did play this game, I played it about 8-10 years ago. I believe it was called "The Final Battle" or something along those lines and it was a PHP based game where you would train workers, ninjas, siege engines ect and you would "fight" other users. It was determined by your power and defense with a small bit of random included. I was wondering if anyone here still had that open source coding.
  8. Thanks for the replies guys, I'll try working on something a little more sophisticated and see what I can turn up with.
  9. I hate to be a bother, but I am not great at coding...I do it because I enjoy it. With that being said, how would I go about storing it into a session instead?
  10. comment.php $a = RAND(1,20); $b = RAND(1,20); $c = $a + $b; echo "<input type=\"hidden\" value=\"$c\" id=\"botcheck\" name=\"botcheck\">"; echo "<div class=\"typeof\"><b>Spam Filter:<br>$a + $b = ?</b></div><div><input type=\"text\" id=\"botcheckanswer\" name=\"botcheckanswer\"></div><br>"; addcomment.php if($_POST['botcheck'] != $_POST['botcheckanswer']){ echo "You have failed the spam filter. Please try again."; }else.... The coding works fine, if you enter in the correct sum then it will post, if not it will fail to post. My question here is it too basic and will bots get past this line of defense?
  11. I have this code that inserts $_POST['description'] into a database however this is a <textarea> and in the text area I put in "enters" like you would do with BBC. Of course I use <br> to create a new line, but I put an "enter" in the box just for neatness sake but when I insert it into the data base "rn" goes in place of every "enter" i put in. Is there something like stripslashes($variable) I could use to stop the "rn"s from showing up?
  12. Okay so here is my problem, I have an error to be set if the file type isn't specified. if ($type == 0 || !in_array($type,array('sounds','textures','ui'))) { $errors[] = "Please select a valid type!"; } Seems right...right? Well it gets $type from my form: echo "<tr><td>Type</td><td><select name=\"type\"> <option value=\"0\">--Select One--</option> <option value=\"sounds\">Sound Mod</option> <option value=\"textures\">Texture Mod</option> <option value=\"ui\">User Interface Mod</option> </select></td></tr>\n"; The problem is I choose Sound Mod from the options and the error pops up after I click submit saying I didn't specify or choose a type of file. Anyone know why? $type = $_POST['type'];
  13. Thank you very much. I'll test all three of these and see which one works and I'll post back here to say if my problem was solved or not!
  14. I got it able to upload, however I'm trying to restrict what type of files can be uploaded. (I want just .s2z files and .honmod files to be able to be uploaded.) What should I use to restrict something like that because I tried this: if ($uploaded_type =="text/x-generic") { echo "Blah Blah Blah<br>"; $ok=0; } Which did not work. What do you suggest? <?php $target = "/*/*/public_html/upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if ($ok==0) { echo "Sorry your file was not uploaded"; }else{ if(move_uploaded_file($_FILES['uploaded']['tmp_name'],$target)){ echo "The file <b>".basename( $_FILES['uploaded']['name'])."</b> has been uploaded"; }else{ echo "Sorry, there was a problem uploading your file."; } } ?>
×
×
  • 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.