Jump to content

spinner0205

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by spinner0205

  1. Here is the form part of the index.php file: <form enctype="multipart/form-data" action="scripts/admin_save_sm_db.php" method="post"> <h3><i>Auth. Type</i></h3> <input name="authtype"/><br /> <div class="form_help">Must be 'steam' or 'ip'</div><br /> <h3><i>Steam ID or IP Address</i></h3> <input name="identity" /><br /> <div class="form_help">Steam ID or IP Address of the player you wish to add. <br /> STEAM ID must be in the format STEAM_0:X:XXXXXXXX. Visit www.steamidfinder.com</div><br /> <h3><i>Admin Flags</i></h3> <input name="flags"/><br /> <div class="form_help">Must include 'o' for donator and any other flags applicable, no spaces.</div><br /> <h3><i>Name</i></h3> <input name="name" value="Donator"/><p> <div class="form_help">Name of the new admin. Optional</div><br /> <h3><i>Immunity Level</i></h3> <input name="immunity" value="0"/><p> <div class="form_help">Immunity level between 0 and 99.</div><br /> <h3><i>User Email Address</i></h3> <input name="user_email"/><br /> <div class="form_help">The email address of the user for security purposes.</div><br /> <input name="Submit" type="submit" value="Submit" class="form_submit" /> </form> And the admin_save_sm_db.php file which performs the actions: <?php session_start(); if(!isset($_SESSION["username"])) { header('Location: login.php'); exit; } @require("../sm_admin_db.php"); $authtype = $_POST['authtype']; $identity = $_POST['identity']; $flags = $_POST['flags']; $name = $_POST['name']; $immunity = $_POST['immunity']; $user_email = $_POST['user_email']; $expire = $_POST['expire']; $link = mysql_connect(_HOST,_USER,_PASS); mysql_select_db(_DB); $sql = mysql_db_query(_DB,"INSERT INTO "._TBL." (`authtype`, `identity`, `flags`, `name`, `immunity`, `user_email`) VALUES ('$authtype', '$identity', '$flags', '$name', '$immunity', '$user_email')") OR die(mysql_error()); $okay = mysql_affected_rows(); if($okay > 0) { header( "Location: ../index.php?value=success" ); } else { header( "Location: ../index.php?value=fail" ); } mysql_close($link); ?>
  2. I need to know what command to use for a cron job that checks the creation date of a database entry and if it is older than 30 days, it is removed. How can this be done? Also, I would need to know what to put in the php form to add in the creation date automatically to the database when the user submits it. Thanks in advance!
  3. Alright so I am trying to code a very simple form that adds a user to my SQL database with certain information filled in and certain information kept hidden with default values in a form. My index.php file is as follows (not all of the code but just the form part): <?PHP $submitMessage = $_GET['value']; if ($submitMessage == success) { echo '<div class="congratulations"><font color="#84d20c"><strong>Congratulations:</strong></font> The user has been added.</div>'; }else if($submitMessage == NULL){ }else if($submitMessage == fail){ echo '<div class="error"><font color="#d3430c"><strong>Error:</strong></font> An error occurred please check the error details below:</div>'; echo 'ERROR DETAILS:'; echo mysql_error(); } ?> <h1><i>Add User</i></h1> <p>This page is where you would manually add a user to the donations databases (for example you or a member of the community with elevated status that does not need to pay).</p> <br/> <form enctype="multipart/form-data" action="scripts/admin_save_sm_db.php" method="post"> <input name="authtype" value="steam"/><br /><br /> <h3><i>STEAM ID:</i></h3> <input name="identity" value="STEAM_0:X:XXXXXXXX"/><br /> <div class="form_help">Steam ID of the player you wish to add. Must be in the format STEAM_0:X:XXXXXXXX</div><br /> <input name="flags" value="o"/><br /><br /> <input name="name" value="Donator"/><br /><br /> <input name="immunity" value="0"/><br /><br /> <h3><i>Your Email Address</i></h3> <input name="user_email"/><br /> <div class="form_help">Your Email Address for security purposes.</div><br /> <input name="Submit" type="submit" value="Submit" class="form_submit" /> </form> My admin_save_sm_db.php file is as follows: <?php session_start(); if(!isset($_SESSION["username"])) { header('Location: login.php'); exit; } @require("../sm_admin_db.php"); $authtype = $_POST['authtype']; $identity = $_POST['identity']; $flags = $_POST['flags']; $name = $_POST['name']; $immunity = $_POST['immunity']; $user_email = $_POST['user_email']; $link = @mysql_connect(_HOST,_USER,_PASS); @mysql_select_db(_DB); $sql = @mysql_db_query(_DB,"INSERT INTO "._TBL." (`authtype`, `identity`, `flags`, `name`, `immunity`, `user_email`) VALUES (NULL, '$authtype', '$identity', '$flags', '$name', '$immunity', '$user_email')"); $okay = @mysql_affected_rows(); if($okay > 0) { header( "Location: ../index.php?value=success" ); } else { header( "Location: ../index.php?value=fail" ); } @mysql_close($link); ?> And finally my sm_admin_db.php file is as follows: <?PHP //host loaction define("_HOST", "localhost", TRUE); //database username define("_USER", "thatsact_admin", TRUE); //database username`s password define("_PASS", "*********", TRUE); //database name define("_DB", "thatsact_sadadmins", TRUE); //database table name change this to install multiple version on same database define("_TBL", "sm_admins", TRUE); //This is the email that you will recieve emails when someone signs up. define("_EMAIL", "admin@tag-clan.com", TRUE); ?> All of this together does not work and gives the echo error code, however the mysql_error() string does not return anything. Nothing is inserted into the database. Can I get some help on where I went wrong and please keep in mind I am VERY new to php and didn't write most of this script so just tell me what to edit and exactly how to do it please. Thanks in advance.
  4. Works fine as a basic PHP form with some invisible fields, just doesn't connect to my database, because it is showing the "Thank you, you information..." message even before submitting anything. No errors or anything. Besides that, I just would like to know how to use it to submit only after a PayPal confirmation, and have it expire after 1 month.
  5. Lets just say I know close to NOTHING with php so I am more looking for some help with coding from the ground up. That was just a very basic php form from a tutorial, the other things I would like to do I cannot find anywhere.
  6. I need some helping with writing code for a web page that allows users to enter information in a PHP form along with proceeding to a PayPal payment page after entering the info. The information entered will be added to an SQL database, and only added after payment confirmation, then have those database entries expire after 1 month. This is what I have got so far, not sure if it is even correct. If it is, then I just need to added PayPal payment and SQL database expiration code. <html> <head> <title>Server Donation Page</title> </head> <body> <?php $hostname = "hostname"; $db_user = "dbuser"; $db_password = "dbpassword"; $database = "database"; $db_table = "table"; $db = mysql_connect($hostname, $db_user, $db_password); mysql_select_db($database,$db_table); if (isset($_REQUEST['Submit'])) { $sql = "INSERT INTO $db_table(id,user_email) values ('".mysql_real_escape_string(stripslashes($_REQUEST['id']))."','".mysql_real_escape_string(stripslashes($_REQUEST['user_email']))."')"; if($result = mysql_query($sql ,$db)) { echo '<h1>Thank you,</h1> your information has been entered into our database sucessfully.<br><br><img src=""'; } else { echo "ERROR: ".mysql_error(); } } else { ?> <h1>Server Donation Page</h1><hr> <form method="post" action=""> Steam ID (format STEAM_0:x:xxxxxxxx, go to <a href="http://www.steamidfinder.com">Steam ID Finder</a>):<br> <input type="text" name="id"> <br> Your Email: <br> <input type="text" name="user_email"> <br><br> <input type="hidden" name="authtype" value="steam" /> <input type="hidden" name="flags" value="o" /> <input type="hidden" name="immunity" value="0" /> <input type="hidden" name="identity" value="donator" /> <input type="submit" name="Submit" value="Submit"> </form> <?php } ?> </body> </html> 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.