Jump to content

Speedysnail6

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by Speedysnail6

  1. This is my php code if(mysqli_query($con,"INSERT INTO transactions (ID, Amount, To, From, Description, Type) VALUES ('23', '46', 'hello', 'hello', 'hell1', 'asddsa')")) { return "success"; } echo mysqli_error($con); I get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'To, From, Description, Type) VALUES ('23', '46', 'hello', 'hello', 'hell1', 'asd' at line 1 What am i doing wrong?
  2. Is it still safe if I dont use the $allowedExts in the if statement?
  3. Ah... I se what you mean Ch0cu3r I had $allowedExts = array("gif", "jpeg", "jpg", "png"); but i forgot about css. Thanks
  4. Thanks! I decided to use Psycho's code instead and it worked. Thanks so much though.
  5. Should I use a different set of code? Because the code I used worked for everything I needed BUT css...
  6. What other code do you need? I thought that that was all that was important
  7. That's strange. It says Invalid file Array ( [file] => Array ( [name] => bootstrap-theme.css [type] => text/css [tmp_name] => /tmp/php9QKeIm [error] => 0 [size] => 17202 ) ) but my code is || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "text/css") || ($_FILES["file"]["type"] == "image/png")) I don't see what's going wrong
  8. Hi. I have a file upload script and I want to allow css files to be uploaded as well. Here is my code allowing the certain filetipes allowed to be uploaded. || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png")) When I tried doing this code to allow css files through || ($_FILES["file"]["type"] == "text/css")) it didn't work. Should it? If not, what did I do wrong?
  9. There are many ways to make a registration script in PHP. Does your site have a mysql database. I suggest if you're new, to install a premade script.
  10. Hi. I don't know how to have the code </textarea> INSIDE of a textarea using PHP. $edit_content_de = "<textarea>Text</textarea>asd"; <p><?php echo '<textarea name="content" id="codeTextarea" style="width:90%; height:500px;">'. $edit_content_de; .'</textarea>'; ?></p> But obviously what happens is the textarea ends and BELOW the textarea it says "asd". How do I stop this and have it say </textarea> INSIDE textarea instead of closing it?
  11. Thanks! I used trim() and it worked. New code is... //Decryption Function function decrypt($mprhase) { global $encryptionkey; $MASTERKEY = $encryptionkey; $td = mcrypt_module_open('tripledes', '', 'ecb', ''); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $MASTERKEY, $iv); $decrypted_value = mdecrypt_generic($td, base64_decode($mprhase)); mcrypt_generic_deinit($td); mcrypt_module_close($td); return trim($decrypted_value); }
  12. Hi. This is a function to decrypt text. Please do not worry about the masterkey, that is called upon from outside. //Decryption Function function decrypt($mprhase) { global $encryptionkey; $MASTERKEY = $encryptionkey; $td = mcrypt_module_open('tripledes', '', 'ecb', ''); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $MASTERKEY, $iv); $decrypted_value = mdecrypt_generic($td, base64_decode($mprhase)); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $decrypted_value; } Although this works normally, it does decrypt text with some weird encoding or something. I've tried decrypt() multiple times in an IF statement and was very confused why it does not work. It seems to look alike in code and in words when I echo it directly on a page, but when I tried putting the decrypt content in a textarea, and I get Decrypted Text��� in the textarea. What is my decription function doing with the encoding or whatever, and please tell me how to correct it. Thanks in advance and please tell me if I am not being clear enough.
  13. Sorry about last comment... I still need help!
  14. Wait a sec... I think I got it... Thanks for your help!
  15. I appreciate your help, but that isn't the problem. In the function page, BELOW the function log_in, I put $_SESSION['logged_in'] = 'true'; $_SESSION['username'] = $username; and it worked. It may be a problem with the log_in() being called, but I doubt it. Are you sure sessions can be set INSIDE a function?
  16. Hi, I'm not sure if either I just have had a stupid error or what. Here is my code on the page with the functions for my script, which is called using require_once() on my other page. session_start(); function log_in($username, $password) { global $ss_con; $_SESSION['logged_in'] = 'true'; $_SESSION['username'] = $username; } This is the code for the other page that has require once... require_once('firstpage.php'); log_in(); if ($_SESSION['logged_in'] != 'true') { echo $_SESSION['logged_in']; echo 'fail!'; } The responce I get is "fail!" Don't worry about log_in() being set. I did that on another page on the same host that just forwards to this. Please help me!
  17. Okay well thank you. I was wondering if it was possible without date, because it seemed to do a fine job making the newest last . Thank you. I created a data field, and I chose the default value to Current Timestamp using phpmyadmin
  18. Name Owner ShortDescription Content SwagTutorial Speedysnail6 This tutorial is cool! TWUgdG9vIQ==
  19. I do not have a date column. I could create one, but is is possible without?
  20. Hello. This is my PHP/MySQL code <?php $result = mysqli_query($con,"SELECT * FROM tutorials"); ?><table border="1"> <?php while($row1 = mysqli_fetch_array($result)) { echo '<tr>'; echo '<td><p>'; echo $row1['Name'] . "</p></td><td>" . $row1['ShortDescription']; echo '</p></td>'; echo '</tr>'; } ?></table> When it displays, it shows the newest columns in the table last. How do I reverse that.
  21. Thank you! That worked! I appreciate it
  22. Hello, This is my PHP/MySQL code. $result = mysqli_query($con,"SELECT MAX(ID) FROM lessons"); while($row = mysqli_fetch_array($result)) { echo $row['ID']; } And yet, nothing is entered on the page. What am I doing wrong?
×
×
  • 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.