Jump to content

newbtophp

Members
  • Posts

    631
  • Joined

  • Last visited

Everything posted by newbtophp

  1. I looked over my code and it still displays a blank page, the sql and table is defined correctly; <?php include 'config.php'; ?> <style type="text/css"><!-- div.message { display: block; margin: 10px 40px; padding: 5px 10px; } div#error.message { background-color: #fcc; border: 1px solid #f00; color: #f00; font-weight: bold; } form table.data-grid { border: 1px solid #d0e0ed; border-collapse: collapse; width: 100%; } form table.data-grid thead tr { background-color:#77003c; border: none; } form table.data-grid thead tr th { color: #fff; text-align: center; } form table.data-grid tr .input-col { text-align: center; width: 10%; } form table.data-grid tr .url { width: 40%; } form table.data-grid tr .link { width: 40%; } form table.data-grid tr .visits { width: 10%; } form table.data-grid tr td input[type="submit"] { background-color: #3893b2; border: 1px solid #166687; color: #fff; font-weight: bold; } --></style> <?php if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit") { if (!isset($_POST["submit"])) { $id = $_GET["id"]; $sql = "SELECT * FROM downloads WHERE 'id'"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); } $data = mysql_query("SELECT * FROM `downloads`"); if(!$data) { echo '<div style="background-color: #fcc; border: 1px solid #f00; color: #f00; font-weight: bold; padding: 5px 10px;"> No data returned. </div>'; if(mysql_error()) { echo '<div style="background-color: #fcc; border: 1px solid #f00; color: #f00; font-weight: bold; padding: 5px 10px;"> MySQL Error (#'.mysql_errno().'): '.mysql_error().' </div>'; } exit; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="data-grid-form"> <table class="data-grid" cellspacing="0" cellpadding="0"> <thead> <tr> <th class="input-col"> <input type="checkbox" onclick="toggleAll(this);" id="checkAllBox" /> </th> <th class="website">Website</th> <th class="reason">Reason</th> <th class="status">Status</th> </tr> </thead> <tbody> <?php while($row = mysql_fetch_assoc($data)): ?> <tr> <td class="input-col"> <input type="checkbox" name="ids[]" value="<?php echo $row['id']; ?>" /> </td> <td class="website"><?php echo $row['website']; ?></td> <td class="reason"><?php echo $row['reason']; ?></td> <td class="status"><?php echo $row['status']; ?></td> </tr> <?php endwhile; ?> <tr> <td colspan="4" style="text-align: center;"> <input type="submit" name="cmd" value="edit" /> </td> </tr> </tbody> </table> </form> <? if ($_POST["$submit"]) { $website = $_POST["website"]; $reason = $_POST["reason"]; $status = $_POST["status"]; $sql = "UPDATE downloads SET website='$website',message='$reason',who='$status' WHERE id=$id"; //replace news with your table name above $result = mysql_query($sql); echo "Thank you! Information updated."; } } ?> <script type="text/javascript"><!-- // --><![CDATA[ function toggleAll(input) { // Will the inputs be checked or not? var checked = input.checked; var form = document.getElementById('data-grid-form'); if(form.elements.length) { for(var i=0; i<form.elements.length; i++) { var input = form.elements[i]; if(input.type == 'checkbox') { input.checked = checked; } } } } // ]]></script> Anyone can help me please? Cheers
  2. works great here
  3. I have but still appears as blank page.
  4. Anyone can tell me what I did wrong?. It dont display or function.
  5. This is what I've come up with; Select the checkbox then click the edit button, which opens an edit form for the row. On the form the field reason and status is a drop down. It dont display though? <?php include 'config.php'; ?> <style type="text/css"><!-- div.message { display: block; margin: 10px 40px; padding: 5px 10px; } div#error.message { background-color: #fcc; border: 1px solid #f00; color: #f00; font-weight: bold; } form table.data-grid { border: 1px solid #d0e0ed; border-collapse: collapse; width: 100%; } form table.data-grid thead tr { background-color:#77003c; border: none; } form table.data-grid thead tr th { color: #fff; text-align: center; } form table.data-grid tr .input-col { text-align: center; width: 10%; } form table.data-grid tr .url { width: 40%; } form table.data-grid tr .link { width: 40%; } form table.data-grid tr .visits { width: 10%; } form table.data-grid tr td input[type="submit"] { background-color: #3893b2; border: 1px solid #166687; color: #fff; font-weight: bold; } --></style> <?php if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit") { if (!isset($_POST["submit"])) { $id = $_GET["id"]; $sql = "SELECT * FROM downloads WHERE 'id'"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); } $data = mysql_query("SELECT * FROM `downloads`"); if(!$data) { echo '<div style="background-color: #fcc; border: 1px solid #f00; color: #f00; font-weight: bold; padding: 5px 10px;"> No data returned. </div>'; if(mysql_error()) { echo '<div style="background-color: #fcc; border: 1px solid #f00; color: #f00; font-weight: bold; padding: 5px 10px;"> MySQL Error (#'.mysql_errno().'): '.mysql_error().' </div>'; } exit; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="data-grid-form"> <table class="data-grid" cellspacing="0" cellpadding="0"> <thead> <tr> <th class="input-col"> <input type="checkbox" onclick="toggleAll(this);" id="checkAllBox" /> </th> <th class="website">Website</th> <th class="reason">Reason</th> <th class="status">Status</th> </tr> </thead> <tbody> <?php while($row = mysql_fetch_assoc($data)): ?> <tr> <td class="input-col"> <input type="checkbox" name="ids[]" value="<?php echo $row['id']; ?>" /> </td> <td class="website"><?php echo $row['website']; ?></td> <td class="reason"><?php echo $row['reason']; ?></td> <td class="status"><?php echo $row['status']; ?></td> </tr> <?php endwhile; ?> <tr> <td colspan="4" style="text-align: center;"> <input type="submit" name="cmd" value="edit" /> </td> </tr> </tbody> </table> </form> <? if ($_POST["$submit"]) { $website = $_POST["website"]; $reason = $_POST["reason"]; $status = $_POST["status"]; $sql = "UPDATE downloads SET website='$website',message='$reason',who='$status' WHERE id=$id"; //replace news with your table name above $result = mysql_query($sql); echo "Thank you! Information updated."; } } ?> <script type="text/javascript"><!-- // --><![CDATA[ function toggleAll(input) { // Will the inputs be checked or not? var checked = input.checked; var form = document.getElementById('data-grid-form'); if(form.elements.length) { for(var i=0; i<form.elements.length; i++) { var input = form.elements[i]; if(input.type == 'checkbox') { input.checked = checked; } } } } // ]]></script>
  6. Heres the code, I assembled it by following mysql tutorials: Im new to php and sql, so Im confused of which lines to edit and replace <?php //Include mysql config include "config.php"; include "password_protect.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?php echo $name; ?></title> <LINK href="includes/style.css" rel="stylesheet" type="text/css"> </head> <center> <table width="600" cellspacing="0" cellpadding="0" id="main"> <tr><td><center> <h1><?php echo $name; ?></h1> <table width="100%" border="0" cellspacing="5" cellpadding="5" id="result"> <a href="index.php">Home</a> <a href="manage.php">Manage</a> <a href="index.php?logout=1">Logout</a> <tr> <body> <div align="center"> <table width="50%" height="100%" border="0" align="center"> <tr valign="middle"> <td><div align="center"> <p> <?php echo"<br>"; if($_POST["posting"] == "yes") { if(empty($_POST["reason"]) || empty($_POST["website"]) || empty($_POST["status"])) { echo "Please fill all the fields."; } else { $md5 = md5($_POST["name"].time()); $sql = "INSERT INTO downloads (md5, reason, website, status) VALUES ('".$md5."','".$_POST["reason"]."','".$_POST["website"]."','".$_POST["status"]."');"; sql($sql); $md5 = $rewrite.$md5; echo "Sucessfully Added!<br>"; } } if($_GET["delete"]) { $sql = "DELETE FROM downloads WHERE id = '".$_GET["delete"]."'"; sql($sql); } $sql = "SELECT * FROM downloads"; $fieldarray = array("reason","website","status"); ?> <table width="100%" bgcolor="#333333" style="text-align:center;"> <?php echo maketable($sql, $fieldarray, "md5", 0, 1); ?> </table> <br /> </p> <?php //Submit form ?> <form id="login" name="login" method="post" action="manage.php"> <input name="posting" type="hidden" id="posting" value="yes" /> Reason:<BR> <select name="reason" id="reason" > <option value="Nulled">Nulled</option> <option value="Reselling">Reselling</option> <option value="No License">No License</option> </select> <BR>Website Url:<BR> <input name="website" type="text" id="website" value="http://www." /> <BR>Status:<BR> <select name="status" id="status" > <option value="Pending Action">Pending Action</option> <option value="DMCA Sent">DMCA Sent</option> <option value="CLOSED">CLOSED</option> </select><BR> <BR> <input type="submit" name="submit" value="Add" class="submit" /></p> </form> <p> This the submit form which contains the predifined drop down options: <?php //Submit form ?> <form id="login" name="login" method="post" action="manage.php"> <input name="posting" type="hidden" id="posting" value="yes" /> Reason:<BR> <select name="reason" id="reason" > <option value="Nulled">Nulled</option> <option value="Reselling">Reselling</option> <option value="No License">No License</option> </select> <BR>Website Url:<BR> <input name="website" type="text" id="website" value="http://www." /> <BR>Status:<BR> <select name="status" id="status" > <option value="Pending Action">Pending Action</option> <option value="DMCA Sent">DMCA Sent</option> <option value="CLOSED">CLOSED</option> </select><BR> <BR> <input type="submit" name="submit" value="Add" class="submit" /></p> </form> <p>
  7. The code which I posted currently looks like (When I submit data from the form, it has a drop down field for reason and status, but it cant be changed when submitted): So I want, to remove the delete column, and make some of the (reason, status) collumns be editable via a drop down menu. Like below (but obviously neater then my paint skills, by css)
  8. Can anyone help please?. :-\ Cheers
  9. I get an error after upload: Parse error: syntax error, unexpected '}' in /home/rc4host/public_html/decoder.php(44) : eval()'d code on line 1 For the results i mean the decrypted code.
  10. Cheers, its all functional now, thanks too you!. I recomend you!. :s Is their a way the result can be shown in a text area? and is their a way on upload the file _ENCRYPTED_CODE_ is automatically placed within the decoder .php _ENCRYPTED_CODE_ variable. So I wouldnt need to edit the file manually. Thanks again.
  11. Solved. Thanks
  12. Thanks alot I uploaded the encoded example and it decodes fine, whereas I uploaded another encoded file and it wouldnt decode. I also got an error message: Parse error: syntax error, unexpected $end in /home/rc4host/public_html/decoder.php(46) : eval()'d code on line 1[code]
  13. Urls like ?p=3 is non seo friendly.
  14. <?php include("/content/?p=3");?> Try without the domain, or modify the path.
  15. I've completed a way to delete data from my msqyl. But im having trouble, whenever I want to edit data i have to delete the whole line and resubmit. Is their a way I can add a drop down on the "Status" and "Reason" column, the drop down would contain the same options as the submit form. Heres my manage.php: <?php //Include mysql config include "config.php"; include "password_protect.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?php echo $name; ?></title> <LINK href="includes/style.css" rel="stylesheet" type="text/css"> </head> <center> <table width="600" cellspacing="0" cellpadding="0" id="main"> <tr><td><center> <h1><?php echo $name; ?></h1> <table width="100%" border="0" cellspacing="5" cellpadding="5" id="result"> <a href="index.php">Home</a> <a href="manage.php">Manage</a> <a href="index.php?logout=1">Logout</a> <tr> <body> <div align="center"> <table width="50%" height="100%" border="0" align="center"> <tr valign="middle"> <td><div align="center"> <p> <?php echo"<br>"; if($_POST["posting"] == "yes") { if(empty($_POST["reason"]) || empty($_POST["website"]) || empty($_POST["status"])) { echo "Please fill all the fields."; } else { $md5 = md5($_POST["name"].time()); $sql = "INSERT INTO downloads (md5, reason, website, status) VALUES ('".$md5."','".$_POST["reason"]."','".$_POST["website"]."','".$_POST["status"]."');"; sql($sql); $md5 = $rewrite.$md5; echo "Sucessfully Added!<br>"; } } if($_GET["delete"]) { $sql = "DELETE FROM downloads WHERE id = '".$_GET["delete"]."'"; sql($sql); } $sql = "SELECT * FROM downloads"; $fieldarray = array("reason","website","status"); ?> <table width="100%" bgcolor="#333333" style="text-align:center;"> <?php echo maketable($sql, $fieldarray, "md5", 0, 1); ?> </table> <br /> </p> <?php //Submit form ?> <form id="login" name="login" method="post" action="manage.php"> <input name="posting" type="hidden" id="posting" value="yes" /> Reason:<BR> <select name="reason" id="reason" > <option value="Nulled">Nulled</option> <option value="Reselling">Reselling</option> <option value="No License">No License</option> </select> <BR>Website Url:<BR> <input name="website" type="text" id="website" value="http://www." /> <BR>Status:<BR> <select name="status" id="status" > <option value="Pending Action">Pending Action</option> <option value="DMCA Sent">DMCA Sent</option> <option value="CLOSED">CLOSED</option> </select><BR> <BR> <input type="submit" name="submit" value="Add" class="submit" /></p> </form> <p>
  16. To create a MySql database. Theirs a link when you login to your cpanel named "MySql". Just follow the instructions and input the fields (database name). When your done, you can use php and add the following code your form. (Input the mysql info within each variable) <?php //Database Host, Usually localhost $db_host="localhost"; //Database Username $db_user="Your database username"; //Database Password $db_password="Your password"; //Database $db="Database name"; //Connection to the Database mysql_connect($db_host,$db_user,$db_password) or die ("No connection possible"); mysql_select_db($db) or die ("The database does not exist"); ?> Make sure to name the file as a .php extension. If you need further help post here, or use google theirs some good tutorials.
  17. Are you looking for a form which will edit the config variables?. Like an installation file?. If yes use $_POST
  18. lmfao! lol, i just had to reply, I agree nrg_alpha I recomend a doberman.
  19. Anyone can help?. The form submits and it dont show the decoded file, it shows "Decoding error!".
  20. OK, I've managed to fix the errors and clean up the code: Everything functions, but after I submit I dont see the decoded text, just says "Decoding error!" index.php: <form method="post" action="decoder.php" enctype="multipart/form-data"> <input type="file" name="data" value="Upload" /> <input type="submit" value="data" /> <br /> decoder.php: <?php include 'class.php'; if (isset($_FILES['data'])) { $file = file_get_contents($_FILES['data']['tmp_name']); function decrypt( $key, $data ) { return $this->endecrypt( $key, base64_decode( $data ), "decrypt" ); } function encrypt( $key, $data ) { return base64_encode( $this->endecrypt( $key, $data, "encrypt" ) ); } if ( defined( "_ENCRYPTOR_KEY_" ) && defined( "_ENCRYPTED_CODE_" ) ) { if ( strlen( _ENCRYPTOR_KEY_ ) == "32" ) { $Var_0->rc4crypt( ); $rc4 = $Var_0; eval( $rc4->decrypt( _ENCRYPTOR_KEY_.strrev( _ENCRYPTOR_KEY_ ), _ENCRYPTED_CODE_ ) ); } else { echo "Invalid key entered!"; } } else { echo "Decoding error!"; } } ?> class.php: <?php class rc4crypt { function endecrypt ($pwd, $data, $case) { if ($case == 'decrypt') { $data = urldecode($data); } $key[] = ""; $box[] = ""; $temp_swap = ""; $pwd_length = 0; $pwd_length = strlen($pwd); for ($i = 0; $i <= 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length), 1)); $box[$i] = $i; } $x = 0; for ($i = 0; $i <= 255; $i++) { $x = ($x + $box[$i] + $key[$i]) % 256; $temp_swap = $box[$i]; $box[$i] = $box[$x]; $box[$x] = $temp_swap; } $temp = ""; $k = ""; $cipherby = ""; $cipher = ""; $a = 0; $j = 0; for ($i = 0; $i < strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $temp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $temp; $k = $box[(($box[$a] + $box[$j]) % 256)]; $cipherby = ord(substr($data, $i, 1)) ^ $k; $cipher .= chr($cipherby); } if ($case == 'decrypt') { $cipher = urldecode(urlencode($cipher)); } else { $cipher = urlencode($cipher); } return $cipher; } } ?> encoded example: <?php define("_ENCRYPTED_CODE_", "eG1mJUIwJUYyJTkyTC5nel8lM0MlMkElMDYlRjglOUYlMDklQjYlM0IlRDcwJUNEJTNEWiVCNyVGNCVBOSU1RCVCNSVBMkslMjclRDglM0ElREFjJUFFJTI2JUQz"); define("_ENCRYPTOR_KEY_", "cfcd208495d565ef66e7dff9f98764da"); define("_DECODER_PATH_", "decoder.php"); //You can change this path to point to the decoder file in another location. if(file_exists(_DECODER_PATH_)){include_once(_DECODER_PATH_);} else{echo"Decoder file does not exist";} // Relative or absolute path to the decoder file ?>
  21. Any progress? I've tried modifiying the decoder.php further but it just leads to more syntax errors, it because im still learning. So I left it as it is to avoid further errors. So I really hope someone can help me?. I learn from you
  22. Can you post a solution so it acts as if the file is uploaded? Thanks
  23. My advice: -Scan your site with http://phpantivirus.sourceforge.net/ -If your using a public/retail script use google to see if theirs any exploits and then patch them. -Set directories to suitable permissions. -Install a firewall?. -Manipulate the use of .htaccess.
  24. What errors? Also, don't stick your class declaration inside of an if statement. That's just silly. It's best to break the class declaration off into it's own file and include it. Parse error: syntax error, unexpected $end in /home/rc4host/public_html/decoder.php on line 93
  25. Anyone who can help please? Cheers
×
×
  • 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.