Jump to content

TecTao

Members
  • Posts

    145
  • Joined

  • Last visited

Everything posted by TecTao

  1. In a membership, I want to be able to delete database entries as well as images with a particular member. When the member is created and uploads images, they are uploaded to a folder created at the time of approval with the folder name same as member ID number. When I want to delete the member from the DB, I also want to delete the directory with their images. I found a Recursive_Remove_Directory function that seems to be written pretty good, but don't seem to be able to direct it to the path. I created the path as a variable but still not working. any ideas? $directory = "home/blabla/public_html/query/media/$id"; echo $directory; function recursive_remove_directory($directory, $empty=TRUE) { // if the path has a slash at the end we remove it here if(substr($directory,-1) == '/') { $directory = substr($directory,0,-1); } // if the path is not valid or is not a directory ... if(!file_exists($directory) || !is_dir($directory)) { // ... we return false and exit the function return FALSE; // ... if the path is not readable }elseif(!is_readable($directory)) { // ... we return false and exit the function return FALSE; // ... else if the path is readable }else{ // we open the directory $handle = opendir($directory); // and scan through the items inside while (FALSE !== ($item = readdir($handle))) { // if the filepointer is not the current directory // or the parent directory if($item != '.' && $item != '..') { // we build the new path to delete $path = $directory.'/'.$item; // if the new path is a directory if(is_dir($path)) { // we call this function with the new path recursive_remove_directory($path); // if the new path is a file }else{ // we remove the file unlink($path); } } } // close the directory closedir($handle); // if the option to empty is not set to true if($empty == FALSE) { // try to delete the now empty directory if(!rmdir($directory)) { // return false if not possible return FALSE; } } // return success return TRUE; } }
  2. How do you keep from re-submitting information into a DB if the viewer hits the refresh button. Page 1 form is filled out and submitted. Page 2, inserts information into DB and displays the information. Viewer click the browser refresh and information is re-submitted into database.
  3. Thanks, i've read up in google and a couple of my programming books. The lightbulb just hasn't clicked on yet the way it works from one page to the next in verifying if the variable has been passed. Regarding Login, yes, I've used in login but this isn't a login. Although it's a membership purchase, the member doesn't establish a un and pw. They pay from a purchase.php page, which if approved to to the thankyou.php page which has three choices to select to fill out an informational form. I'm trying to keep access to the thankyou.php page except by way of the purchase.php page.
  4. I need some help with page security. I am not sure if the session variable is the way to go or not. I have pages, for example: page1.php page2.php page3.php I do not want someone to be able to got to page2 or page3 without first going to page1. I thought using a session variable would work, but I don't think I understand how to set the variable and then pass and check it on the next pages.
  5. thanks for the ampersand, learned something new today, that's great. about the $_GET haveing some difficulty makeing it work but used some other code the thumbnail code is: <a href="JavaScript:jsNewWindow('media/showimage.php?id=<? echo"$i_Mid"?>&file=<? echo $img_2 ?>',500,500);"> <img src="media/<? echo"$i_Mid"?>/gick.php/<? echo $img_2 ?>?resize(200x200)" border="0"></a> the popup page is: <input type="hidden" name="ud_id" value="<? echo "$id" ?>"> <input type="hidden" name="ud_file" value="<? echo "$file" ?>"> I tried $id = $_GET[id]; $file = $_GET[file]; but it didn't work. thanks fot the help, it really paid off.
  6. My problem is passing two variables a thumbnail image to a pupup window. The thumbnail image is displayed from the image name stored in the DB identified by a member ID. In the row or this member ID is a number of columns with image file names. When you click on the thumbnail I can pass the member ID to use in the pupup query, but I can't seem to figure out how to pass the particular variable for the image name. I'm using a java script to open a popup window displaying in image in a new window from a table of thumbnails. The thumbnails and image are stored in a file on the server and called from a table in a DB with a member ID number and image file names. The image names are in the DB in a row for a particular member. In the Image table there are colums: m_id, img1, img2, img3. member 2 has the same, member 3 has the same, and so on. The page of thumbnails is called by a query where ID = $id, display image names from column img1, img2, img3 the java script code to open the pupup window is: <a href="JavaScript:jsNewWindow('media/showimage.php?id=<? echo"$id"?>',500,500);"> <img src="http://www.worldboxingnetwork.com/query/media/<? echo $img_2 ?>?resize(200x300)" </a> The popup window passes the the id. I can't get the img file name to pass. This is what i'm trying: <input type="hidden" name="ud_id" value="<? echo "$id" ?>"> <? include($DOCUMENT_ROOT .'/include/db_connect.php') ?> <?php $result = mysql_query( "SELECT * FROM network_members_media WHERE i_Mid='$id' " ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { extract($row); ?> <img src="http://www.worldboxingnetwork.com/query/media/Variable Missing"> The blue Variable Missing"> is the variable I'm trying to pass when you click on the thumbnail.
  7. I'm needing to upload videos as part of a membership. The upload script I'm using for jpg works fine. When I change the extension and change the max size to 2mgb, nothing uploads. Here's the script on the form page: <input name="id_7" type="hidden" value="<? echo "$id_7" ?>"> <input type="hidden" name="MAX_FILE_SIZE_7" value="5000000"> <input name="upfile_7" type="file" size="60"></td> Here's the post page script: $lid_7=$_POST['id_7']; $uploaddir_7 = "../query/media/$boxDir/"; $filename_7 = trim($_FILES['upfile_7']['name']); $filename_7 = substr($filename_7, -80); $filename_7 = ereg_replace(" ", "", $filename_7); if ((ereg(".jpg", $filename_7)) || (ereg(".wmv". $filename_7))) { $uploadfile_7 = $uploaddir_7 . $filename_7; if (move_uploaded_file($_FILES['upfile_7']['tmp_name'], $uploadfile_7)){ chmod($uploadfile_7, 0644); print("Sixth File upload was successful"); mysql_query(" UPDATE network_members_media SET vid_1='$filename_7', vid_1_app = 'No' WHERE i_Mid='$lid_7'"); } else { print("Sixth File upload failed"); } } else { print("<B>WARNING INDICATES THERE WAS NO FILE TO UPLOAD "); } As you can see, part of the upload's success is inserting the file name into the database. The reason I'm using an UPDATE, is that there are seven inserts with the first INSERT setting up the row of the DB With the member ID number and the each image and video Updating the row with the name and an approval. As mentioned, the problem is the wmv files won't upload. Thanks in advance. Mike TecTao Designs
  8. I'm needing to upload videos as part of a membership. The upload script I'm using for jpg works fine. When I change the extension and change the max size to 2mgb, nothing uploads. Here's the script on the form page: <input name="id_7" type="hidden" value="<? echo "$id_7" ?>"> <input type="hidden" name="MAX_FILE_SIZE_7" value="5000000"> <input name="upfile_7" type="file" size="60"></td> Here's the post page script: $lid_7=$_POST['id_7']; $uploaddir_7 = "../query/media/$boxDir/"; $filename_7 = trim($_FILES['upfile_7']['name']); $filename_7 = substr($filename_7, -80); $filename_7 = ereg_replace(" ", "", $filename_7); if ((ereg(".jpg", $filename_7)) || (ereg(".wmv". $filename_7))) { $uploadfile_7 = $uploaddir_7 . $filename_7; if (move_uploaded_file($_FILES['upfile_7']['tmp_name'], $uploadfile_7)){ chmod($uploadfile_7, 0644); print("Sixth File upload was successful"); mysql_query(" UPDATE network_members_media SET vid_1='$filename_7', vid_1_app = 'No' WHERE i_Mid='$lid_7'"); } else { print("Sixth File upload failed"); } } else { print("<B>WARNING INDICATES THERE WAS NO FILE TO UPLOAD</b> "); } As you can see, part of the upload's success is inserting the file name into the database. The reason I'm using an UPDATE, is that there are seven inserts with the first INSERT setting up the row of the DB With the member ID number and the each image and video Updating the row with the name and an approval. As mentioned, the problem is the wmv files won't upload. Thanks in advance. Mike TecTao Designs
  9. I am writing a member application (worldboxingnetwork.com) where the members are allowed to upload images and video. The second stage of the signup is uploading a primary image. Part of the upload function is to create a subdirecty with the folder name a unique number which is the same as the unique Member ID number created when the member info is submitted. I use an image magik image applicaton to alter and resize images. I call it glick.php so that an image might be gick.php/<? //echo $img_file ?>?resize(300x300) since the new subdirectories are created on submission with mkdir function, I need to copy glick.php in the root up to the new subdirecory. Any ideas or help is appreciated, thanks in advance. Mike TecTao Designs
  10. I've been reading up on the trim() and the ltrim() and that makes sense. I'm not sure where I would place it. The form with the text field is passing the variable. The second page inserts the name in the db with an insert query. The search page is an alphabetical search with list of hyperlinks such as: <a href="b_query_name.php?letter=A">A</a> the b_query_name.php page has this code: <input type="hidden" name="ud_id" value="<? echo "$letter" ?>"> <? include($DOCUMENT_ROOT .'/include/db_connect.php') $result = mysql_query( "SELECT * FROM network_members WHERE lName LIKE '$letter%' ORDER BY lName ASC" ) ?> Is the trim() placed in the sql statement or of the select or insert. Sorry, but a bit confused because if there is a space before a last name such as Adams, Adams won't be returned since the query doesn't see the "A". I hope this makes sense.
  11. I am use to useing the tab key when filling in forms. I've created a form with a Last Name field. When I tab the curser is justified left completely, so when I enter a name and submit there is no space before the letter of the last name. So when I search by letter of the last name, the name comes up in the query. But I found that if I manually put the curser in the field with my mouse, it automatically puts a space before the first letter of the name, so when submitted in the DB, there is a space and when searching my last name the name doesn't come up in the query. What can be done to strip away any spaces prior to submitting int the DB, or forcing a left justify in the form prior to submitting? Thanks for any help or suggestions in advance.
  12. Thanks all.  The post from Jerirose worked perfectly since I was passing a letter veriable from a previous page. Thanks for all the help
  13. I am using a last name query for a list of members in a DB. I'm a bit confused on stripping the letters down and then out to the first letter of the name such as, Smith down to "S" or Brown down to "B" so that the query for the letter "S" or "B" returns the names starting with those e letters. Thanks for any help in advance. Mike
  14. This may seem like a simple question but I can't seem to get a handle on the use of explode. I have a simple script on my pages that emails me with a visitro IP and search info.  But the search info collected from $HTTP_REFERER sends the search phrase with "+" sign between the words and a bunch of stuff before and after the serch string. I want to remove all the stuff and display only the search terms. Any suggestions?
  15. I've go a form on my site which I'm converting to a single page self submitting form with an if argument that if one field is empty ($cName > ' ') it will loop back through to the form. Unfornately, when it does, all of the fields are blank. Is there a way to retain the information so the viewer doesn't have to re-type everything back in again?
  16. I've imported a database file into a mysql database.  All is fine except that the purchased database does not have a customer ID seperate for the primary key ID. I don't want to use the primary ID as the customer ID the column is bizID Any suggestions to either copy the primary key ID column numbers (1,2,3,4 etc) to the bizID column, or to insert or update the table with an uploaded sql or txt file. Thanks for all help in advance. m
  17. Thanks for the input, but having the viewer select on of the buttons isn't the challenge. Each radio button has a corresponding text box to fill in something. One of those boxes must be required along with the radio button selection. So if the pick the first button "number attending" then they have to fill in the corresponding text field. If the select "Check Amount" then they have to fill in that corresponding text field. and the same for the last. None of the radio buttons are selected so they have to select one and fill in the text field info. Currently I'm using a java script to require text fields, but since I haven't been able to write or locate a java script for radio button selections, I'm considering the required field option using a php if else statement.
  18. I'm having a real problem writing part of a form that has three radio buttons to select a method of payment. The three radio buttons are the same name "pay" so that only one can be clicked. Second, they are required so one out of the three must be clicked to submit. Third, each radio button has a small text field to put, number attending, amount of check or phone number. What I need help on is to if one button isn't clicked, then the next or then next but one of the three must be required. thanks for any help m
×
×
  • 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.