Jump to content

spinner0205

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by spinner0205

  1. Okay so I have a time in the format yyyy-mm-dd that is pulled from a MySQL array row and I need to add one month to it then echo that out. I assume it has something to do with the strtotime() and date() functions but I have tried every combination and cannot figure it out. Can I get some assistance please and thank you? Very very very new to php. Here is what I have lol; $row=mysql_fetch_array($result); $ddaterow=$row['donation_date']; Like I said the date will always be in the format yyyy-mm-dd
  2. Hmmm the ordered list option doesn't seem to work. It doesn't show anything. This is what I am trying; while ($get = mysql_fetch_assoc($result)){ if(!$get[userid]=="0") { $username = "<ol><li><b><a style=\"color:#00CC00\" href=/member.php/$get[userid]>$get[username]</a></b> donated <b>$$get[donation_total]</b> total so far!</li></ol>"; } $container[] = "<font size=3>$username</font>"; }
  3. I have never used real escape string so want to make sure I did it correctly. Also, if I can place it anywhere else to make it even more secure please let me know. This is just the action of a just a simple POST html form. Here it is. <?php require ('staffarea/sql.php'); $showform="false"; $mcid = mysql_real_escape_string($_POST['mcid']); $age = mysql_real_escape_string($_POST['age']); $description = mysql_real_escape_string($_POST['description']); if(!mysql_query("INSERT INTO `somedatabase`.`appsubmissions` (`id`, `username`, `age`, `description`, `status`) VALUES (NULL, '$mcid', '$age', '$description', 'Pending');")) { echo '<div class=blockrow><b><font size=4>Submission Error</font><br /><br />Something went wrong. Contact Staff in the Support Forums and give them this information:<br /><br /></b><font color=red>'; echo mysql_error(); echo "</font>"; echo '<br /><br /><a href="/forumdisplay.php?f=14">Support Forums</a></div>'; } else { $lastID=mysql_insert_id(); echo "<div class=blockrow><font size=3><b>$mcid, Thank You for your Building Application!</b></font><br /><br />"; echo "Your Unique Application ID: <b>", $lastID; echo "</b> (save this so you can check the application status later)<br /><br /> Your application was submitted successfully. Please allow Staff 24 hours to accept or deny your application. If after 48 hours you still do not have building rights, assume the application was denied and re-submit with different information. DO NOT submit an application more than every 48 hours, doing so will get your account banned for spamming.<br /><br /> While waiting, you might check out the <a href=/index.php?pageid=mcguide>Ultimate Guide</a>.</div>"; } mysql_close($con); ?>
  4. Actually jcbones had it right on the money. Never thought about just including the file. Duh. Thanks guys.
  5. I needed a server side PHP validation script for my form to use on top of client side Javascript as a backup. I found a nice package where I just include the validator and set a few options then it does the rest. However it doesn't seem to work with the action="whateveraction.php" for the form. It will skip all the validation and immediately go to the action script. So I left that blank as you can see in the form below and figured I would send the post data somehow to the script using PHP when the validation is successful. However I am stumped on how to do that can I get some coding help? This is the small validation script. I will attach the formvalidator.php in this post. <?php require_once "formvalidator.php"; if(isset($_POST['submit'])) { $validator = new FormValidator(); $validator->addValidation("age","req","Please fill in your Age"); $validator->addValidation("mcid","req","Please fill in your Minecraft Username"); $validator->addValidation("description","req","Please fill in a Description"); if($validator->ValidateForm()) { //need something here to have it send the post data to /mcbuildapp/form_submit.php } else { echo "<div class=blockrow><b><font size=5>Form Errors:</font><b></div>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<div class=blockrow><p><font color=red>$inp_err</font></p>\n</div>"; } } } Then the form if it matters.... <div class="blockrow"> <font size=4><b>Minecraft Building Rights Application</b></font> <br /> <br /> <b>Failing to fill in any of these fields sufficiently will result in an automatic denial of your application!</b><br /> <b>Think of it this way, being lazy and applying wrong is only wasting your time. Take the time to do it correctly the first time.</b> <br /> <br /> <b><font color=red>To ensure proper user authentication and security you must first join the server at least once before applying for your building rights to work!</font></b> <br /> <br /> <form action="" id="mcbuilderapp" name="mcbuilderapp" method="post"> <label><b>Your Minecraft Username (required)</b><br /> Use exact capitalization and punctuation that matches your Minecraft.net account!</label> <br /> <br /> <input type="text" name="mcid" id="mcid" maxlength="25"/> <br /> <br /> <label><b>Your Age (required)</b></label> <br /> <br /> <input type="text" name="age" id="age" maxlength="3"/> <br /> <br /> <label><b>Describe Yourself (required)</b><br /> Describe yourself in <b>no less</b> than 3 sentences using <b>correct grammar</b>.</label> <br /> <br /> <textarea name="description" id="description" minlength="10" maxlength="1000" cols=60 rows=5 wrap="physical"> </textarea> <br /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div> MOD EDIT: PHP manual tags changed to code tags . . . [attachment deleted by admin]
  6. The name field datatype is varchar(32). EDIT: Got it working, not quite sure what did between all the suggestions but thanks guys!
  7. Changed to; $query = "SELECT entryid FROM `thatsact_minecraft_permissions`.`PrEntries` WHERE name = '$accepted_username';"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($res); $entryid = $row['entryid']; but doesn't seem to change anything. Same error. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Also, ran the SELECT query in phpMyAdmin, selects the entryid perfectly.
  8. The value for that post is bob just as a test user. And I was figuring on doing the validating stuff after I got it working fully.
  9. Now I get: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource And FYI, the table it is selecting from is very populated. Here is the entire code if it matters; <?php require ('sql.php'); //gather the accepted app username as post data $accepted_username = $_POST['accepted_username']; //insert to prentries (wont if already there) mysql_query("INSERT INTO `thatsact_minecraft_permissions`.`PrEntries` (`entryid`, `name`, `worldid`, `type`) VALUES (NULL, '$accepted_username', '1', '0');"); //get entryid of user for next query $result = mysql_query("SELECT entryid FROM `thatsact_mc_permissions`.`PrEntries` WHERE name = '$accepted_username';"); if(mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $entryid = $row['entryid']; } else { echo "There is no records!"; } //insert to prinheritance using entryid mysql_query("INSERT INTO `thatsact_minecraft_permissions`.`PrInheritance` (`uinheritid`, `childid`, `parentid`, `parentorder`) VALUES (NULL, '$entryid', '1', '0') ON DUPLICATE KEY UPDATE parentid=VALUES(parentid);"); ?>
  10. Thank you for such a fast reply but your code returns: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
  11. I have the following code. $accepted_username comes from a posted form. I would like for it to select a field from the table in the $result query then turn that into a usable variable for the second query. I am very new to PHP so can I get some code examples for the $entryid variable, because every time I try to echo $result I get Resource #19. I know I can't echo a simple mysql query but I am unsure what to do to make it usable. $accepted_username = $_POST['accepted_username']; $result = mysql_query("SELECT entryid FROM `thatsact_mc_permissions`.`PrEntries` WHERE name = '$accepted_username';"); $entryid = ?????????; mysql_query("INSERT INTO `thatsact_mc_permissions`.`PrInheritance` (`uinheritid`, `childid`, `parentid`, `parentorder`) VALUES (NULL, '$entryid', '1', '0') ON DUPLICATE KEY UPDATE parentid=VALUES(parentid);");
  12. Well you are certainly good at, thanks a lot works wonders. Also not important but if possible some code for when the 11 or ,11 is already there then don't insert it? Sorry but MySQL is my down fall and that is why I come to this great site.
  13. Yea I was at work doing multiple things so wasn't paying attention but now I added the whole thing and works great. However I have a new problem. How can I have it insert just the 11 rather than ,11 if there is no data in the membergroupids field yet? If you cant find anything I could do I can just put a 0 in the field for everyone as the default.
  14. The table is part of a huge content system so cant really change it but I appreciate the advice. However the CONCAT function comes back with membergroupids as an unknown system variable. Am I missing something here?
  15. Exactly so that is why I am asking for a better type of query to use.
  16. The INSERT syntax would work but how can I retain the WHERE clause so it executes the query where it matches a certain field?
  17. I guess I call it a list because its a list of numbers in the field that goes by 1,2,3,4,5 etc. And what I want the query to do is add the number 11 to this set of numbers with the comma and everything. Also the query works fine with the period in version 5, already tested it. EDIT: Probably confused you because I pasted the entire code including PHP. Edited for just the MySQL part below. UPDATE thatsact_tag_clan.tag_user SET membergroupids='11' WHERE username='$vbid' thatsact_tag_clan is the database and tag_user is the table. The field is membergroupids.
  18. I have the following MySQL query; mysql_query("UPDATE thatsact_tag_clan.tag_user SET membergroupids='11' WHERE username='$vbid';"); And what I would like to do is change this to a better query that adds the number 11 to the existing list. At the moment it will take any numbers in this table field and overwrite them with 11. What I want it to do is add the number to the list. It is formatted as 1,2,3 and so on, so just have it add 11 to this list. What is a query I can use for this? Thanks in advance.
  19. I have a PHP script that inserts data to a MySQL database. It may sometimes add entries that correspond with duplicate ones by a certain field. So if the 'username' field is already in the database I want it to add the information to that username entry. For example, bob's data is inserted and there is already a bob username field entry so the field 'balance' under this entry has a balance of 4000 and I want to add 200 to the balance. How would I go about doing this? Also if the username does not exist yet, then obviously have it create a new one.
  20. Sorry for some stupid reason I posted the MySQL query. Here is the cron but the error I receive now is ERROR 1102 (42000): Incorrect database name. Is there a specific way to type the database name?
  21. I get the following error with a cron job I have set up: The cron job is: Any thoughts on what I need to fix?
  22. Because its not tied to any sort of other databases or my main website. Its more a separate system where they enter a few pieces of information that are added to the database through Paypal IPN. It doesn't require any logging in or out to do so and actually has nothing to do with a website. They are donating for special privileges on a game server that uses a MySQL table.
  23. Well its for a donations system. When the user donates they get certain benefits that last for 1 month. After which I need the database entry to be removed so that their status as a user is returned to normal. EDIT: This doesn't have anything to do with keeping the database clean or anything.
  24. I have database entries added to a MySQL database table and under one column the date is inserted but plus 1 month (example if it is 2/23/11 then 3/23/11 is inserted). Therefore I would like to have a cron job or something similar that deletes these entries all together when the date on this column matches the current day. How would I go about doing this? Thanks in advance!
×
×
  • 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.