Jump to content

phpstuck

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by phpstuck

  1. If I am understanding right? Just use a MySQL statement to query the database to see if it exists before adding it. Something like the following example: [code] $sql_word_check = mysql_query("SELECT word FROM define WHERE word='$word'");                          $word_check = mysql_num_rows($sql_word_check); if(($word_check > 0)){   echo "<center><b><font face='tahoma' color='red'>Please fix the following errors: </b><br />";   if($word_check > 0){     echo "The word you have submitted has already been defined in our database.     Please submit a different word or phrase!<br />";           unset($word);    } [/code] Of course use your own details I copies that from a dictionary I built a while back Hope that helps
  2. Try this: <?php $sql = mysql_query( "ALTER TABLE define ORDER BY word"); DEFINE should be replaced with your table name and WORD should be replaced by the column name you want alphabatized. Hope that helps (I use a script that allows the user to pick a letter of the alphabet and see only words starting with that letter, I can share if you would be interested)
  3. Try this and see if it works: [code] //top part cut off for easy reading if (($db_Password)===($Password)) { echo "Welcome back $Username"; echo"<br><br><form action= 'login_display.php' method='post'> <input type='submit' value='Continue'> <input type='hidden' name ='Username' value=$Username> </form>"; ?> } else { echo "<b><centre> Invalid user</centre></b><br><br>"; echo "Please try again <a href=\"index2.php\"> Insert details</a><br>"; } ?> [/code]
  4. Ok that problem is fixed by changing the code as follows, uploads work fine. [code]<?php error_reporting(E_ALL & ~E_NOTICE); $uploaddir = "uploads/"; $filename = trim($_FILES['upfile']['name']); $filename = substr($filename, -15); $filename = ereg_replace(" ", "",$filename); if((ereg(".jpg", $filename)) || (ereg(".gif", $filename))) {     $uploadfile = $uploaddir . $filename;     if (move_uploaded_file($_FILES['upfile']['tmp_name'],     $uploadfile)) {       chmod($uploadfile, 0644);       print("File upload was successful");       } else {         print("File upload failed");       }       } else {         print("Only images in .gif or .jpg extentions are allowed, upload failed!");         } ?> [/code] But I sure would like to know how to change the filename after submission to something unique so I don't ever end up with two files of the same name with one overwritting the other :-)
  5. If you are wanting a whole new page that says thank you for submitting the blah_blah_blah then simply write your thank you page and use include_once on the page that processes your php. In other words make your form in html and make post the method with action set to process.php, make your php page process the posted data (do some checks if you want) and then echo a Thank you message if everything checks out. Only include the form if they forgot something on the form you require.
  6. MySQL will store all the customer details, I recommend storing the PDF files in a protected folder and calling them from a link stored in MySQL with PHP. I can appriciate your background and learning on the fly, that has lead to several disaters for me also. If you are a C++ programmer you should roll into advanced PHP rather easily. Set up your database and keep asking questions. You should be on the run in no time.There are actually built in mods for calling most of the resources you will need for payment processing once you have the site set up and can test the storage and download features. For more on payment processing read the following tutorial right here on PHP Freaks [a href=\"http://www.phpfreaks.com/tutorials/49/0.php\" target=\"_blank\"]payment processing with CURL[/a]
  7. Simple stuff to some I know, but this is my first attempt as I have never needed it before. Before anyone tells me this is insecure I know, I have removed all checks and restrictions to make this as simple as possible for me to break down, I will add security as soon as I can figure out why it says successful yet puts nothing in the server folder. I created a folder named "uploads" on the server and changed the permissions to 777 Then I use this HTML to gather the file for upload uploadtest.html [code] <form method="POST" enctype="multipart/form-data" action="me.php">   <p>   Select a file:   <input type="file" name="upfile"><br>   <br>   <br>   <br>   <input type="submit" value="Upload"></p> </form> [/code] Then I created this to process the posted data me.php [code] <?php $uploaddir = "uploads"; $uploadfile = $uploaddir . $_FILES['upfile']['name']; if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile)) {   print("File upload was successful");   } else {     print("File upload failed");   } ?> [/code] When I run the script live on my server I get the "File upload was successful" message, but when I check the folder on the sever nothing was actually uploaded. Any help would be really appriciated :-)
×
×
  • 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.