Jump to content

curtis_b

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by curtis_b

  1. Hello, I setup a fileserver for my company's intranet. I want to add a search engine that can find files / folders containing the users input. So let's say the user put in "company", the potential results could be: company logo.gif /45015/Jones_company/ /whatever/blahblahcompany.ini I want the engine to be able to scan all files/folders in my /var/www/html/ folder. I will settle for filenames only if that's the best I can do. I played around with glob(), which seemed to only work for a specified folder, I'm just not sure how I can use it to scan all folders. Any advice is greatly appreciated. Curt
  2. [!--quoteo(post=388907:date=Jun 28 2006, 12:10 PM:name=ivalea)--][div class=\'quotetop\']QUOTE(ivalea @ Jun 28 2006, 12:10 PM) [snapback]388907[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks nogray - I'll give that a try. So is there any other way to accomplish this using PHP? [/quote] It's a browser setting, people can turn off http_referer information in their browser. Yes, there are numerous ways to control content access. One way could be to add a hidden form field with a default value on page 1 (your next button would be a submit button), then on page 2 you could have the script reset the header if that hidden variable doesn't exist / isn't correct. Personally, I wouldn't even bother with multiple php files, you can accomplish the same functionality all in one php script. Your script would first check which 'step' the user is on and grab the relavent content from a database (or hardcoded in conditional includes), at the end of the script you can reset which 'step' the user will go on to the next time the script reloads itself. The 'step' variable could be a session variable or a hidden field in POST. hope that helps, there are many other ways to accomplish the same thing. Curt
  3. fixed. all i had to do was add my db name in the statement: SELECT DISTINCT addby FROM _ypc.T_USERS phpmyadmin already knows what db you are working with so it wasn't necessary in that prog. thanks
  4. I have a query that gets only distinct values from one column in a mysql table. I have my php script set to print out the actual sql that is being sent by the script for debugging. When I copy and paste the output: SELECT DISTINCT addby FROM T_USERS into the phpmyadmin sql sender, it returns exactly what I need. However in the php script I get an error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource the line it references is: while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ and yes, $result is the correct variable for the mysql_query statement in my script. could it be that fetch_array is the incorrect method for a single column result set? Your help is greatly appreciated! Curt
  5. I'm using the libmail class, (http://lwest.free.fr/doc/php/lib/Mail/) rather than paste that entire file along with my code I will give you the printout it gives me on the confirmation page and that will show you all the headers. Mail was sent: To: Curt@7cpco.com From: joe@schmo.com <<fake, but will be filed out by customer through form X-Priority: 4 (Low) CC: Jennie@7cpco.com BCC: curtis.branum@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Php/libMailv1.3 Thanks for your help!
  6. I'm writing a solution that relies on system-generated emails for customer communications. Our company has recently switched webhosts, and I'm noticing that I no longer receive auto-generated email triggered by these scripts. To debug, I Carbon Copy: my gmail account and sure enough, it shows up in gmail, but not through our new host's email accounts (network solutions). I blame this on their built-in spam filter software (symantec brightmail). The quick fix would be to ask N.S. to disable the spam filter for us, but that won't solve the problem for any number of our customers who either use N.S. or have a comparable filter in place. I'm wondering if anyone can give me some advice on how to overcome this issue, certainly every web-based business out there needs to use system-generated emails, what are they doing differently? Thanks for your help. Curt
  7. Thanks for the reply, if anyone has code examples to show, I would greatly appreciate it. Curt
  8. I'm wondering if this is even possible, and if so, can someone point me in the direction of a good example.... Once a select query has been sent to mysql and in the while (fetch array) loop, I want to then send another select query/while loop to a different mysql table based on the current row value for a column in the first query. Sorry if that sounded confusing I don't know how else to explain it. The resulting output I'm trying to acheive would have the following structure: ROW FROM ORIGINAL QUERY -possible match/related row from nested, 2nd query ROW FROM ORIGINAL QUERY -possible match/related row from nested, 2nd query -possible match/related row from nested, 2nd query -possible match/related row from nested, 2nd query -possible match/related row from nested, 2nd query ROW FROM ORIGINAL QUERY ROW FROM ORIGINAL QUERY -possible match/related row from nested, 2nd query ROW FROM ORIGINAL QUERY -possible match/related row from nested, 2nd query -possible match/related row from nested, 2nd query Thanks for your help
  9. Here's the relavent chunk of code: //populate a div full of jobs currently out for proof $query = "SELECT * FROM proofs where Response_y_or_n='n'"; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result); echo '<div id="wrap"><div class="wrapflow">'; echo '<span class="title">Proofs that we are waiting on:</span><br>'; if($num_rows==0){echo '(empty)';}else{ echo '<u><span class="invoice_number">Invoice#</span><span class="customer_orgname">Customer/Org</span><span class="description">Description</span><span class="designer_name">Designer</span><span class="response_target_datetime">Approval Deadline</span><span class="customer_email">Contact</span></u><br>'; while ($row = mysql_fetch_array($result)){ echo '<span class="invoice_number">'.$row['Invoice_Number'].'</span><span class="customer_orgname">'.$row['Customer_OrgName'].'</span><span class="description"> '.$row['Description'].'</span><span class="designer_name">'.$row['Designer_Name'].'</span><span class="response_target_datetime">'.$row['Response_Target_DateTime'].'</span><span class="customer_email"><a href="mailto:'.$row['Customer_Email'].'">'.$row['Customer_Email'].'</span></a><br>'; $row['Invoice_Number'] = $inv; //I only did this because the original $row[''] variable didn't work in query $query2 = "SELECT * FROM proofs_versions where Invoice_Number = '$inv'"; $result2 = mysql_query($query2) or die(mysql_error()); while ($row2 = mysql_fetch_array($result2)){echo $row2['Filename'];} } } echo '</div></div><br>'; //by the way, how do I put this into a php code block in the post Thanks, Curt
  10. I've been banging my head on the wall, trying to figure out why my nested query wasn't working. All the while I've been using mozilla firefox to reload my page. When I open IE - it displays what I've been trying to do this whole time. Immediately I assumed OHHH its a CSS issue IE vs. Mozilla. It's not. When I view the html source in each browser, the 2nd query results show up in IE, yet in mozilla they are non-existant. [a href=\"http://www.7cpco.com/proofs/overview.php\" target=\"_blank\"]http://www.7cpco.com/proofs/overview.php[/a] The html results in question are the filenames of cookies (i was just uploading uniquely named, small files for testing). In the layout, the're scrambled around, I'm not concearned with the layout just yet. I need to understand why the html source is different, css interpretation is one thing, but they should atleast have the same source right?? Server is Windows IIS. Curtis is dumbfounded.
  11. I have two tables. The main table has only unique invoice numbers, the second related table allows multiple instances of invoice numbers. I want to have my web page list one row from the main table and then any related rows from the 2nd table before moving on to the next item on the main table. I assumed I could to a typical select query with a while loop to grab from the main table, which works fine, but inside of the loop I wanted to add the 2nd query which grabs related rows from the 2nd table. It doesn't work. My code is below, can anyone explain to me how I can do this? //populate a div full of jobs currently out for proof $query = "SELECT * FROM proofs where Response_y_or_n='n'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ $row['Invoice_Number'] = $Invoice_Number $query2 = "SELECT * FROM proofs_versions where Invoice_Number = '$Invoice_Number'"; $result2 = mysql_query($query2) or die(mysql_error()); echo '<span class="invoice_number">'.$row['Invoice_Number'].'</span><span class="customer_orgname">'.$row['Customer_OrgName'].'</span><span class="description"> '.$row['Description'].'</span><span class="designer_name">'.$row['Designer_Name'].'</span><span class="response_target_datetime">'.$row['Response_Target_DateTime'].'</span><span class="customer_email"><a href="mailto:'.$row['Customer_Email'].'">'.$row['Customer_Email'].'</span></a><br>'; while ($row2 = mysql_fetch_array($result2)){echo $row2['Filename'].'<br>';} } The error it's giving me is "Parse error: syntax error, unexpected T_VARIABLE in d:\home\sites\7cpco.com\wwwroot\proofs\overview.php on line 41" line 41 is the $query2=......... line
  12. ok, here's a stripped down version of what we're looking at. For the sake of this post, I put questions marks ??? right in the spot where I beleive the problem lies. I don't know how to insert a variable/counter inside of the $_File variables name (should be $_FILE['file_1'], $_FILE['file_2'], etc. I want that number to come from the counter variable.) ============ PAGE 2: ============ <? session_start(); ?> <form action="upload3.php" method="post" enctype="multipart/form-data"> <? $_SESSION['$Num_Versions'] = $Num_Versions_Temp; $Version_Counter = 1; While ($Num_Versions_Temp > 0) { ?> Browse a File to Upload: 50mb limit.<b>Version <? echo $Version_Counter; ?></b> <br> <input type="file" name="file_<? echo $Version_Counter;?>"> << any punctuation or spaces in filename may cause the upload to fail. Use_underscores_if_you_need_to.<br> <input type="hidden" name="MAX_FILE_SIZE" value="<?echo $size_bytes; ?>"> <br> <? $Version_Counter++; $Num_Versions_Temp--; } ?> <input type="Submit" value="Submit Proof"> </form> ================ PAGE 3: ================ <? session_start(); $_SESSION['$Num_Versions'] = $Num_Versions_Temp; $Version_Counter=1; while ($Num_Versions_Temp>0) { /* Description ----------------------------------------------------- The Super Global Variable $_FILES is used in PHP 4.x.x. $_FILES['upload']['size'] ==> Get the Size of the File in Bytes. $_FILES['upload']['tmp_name'] ==> Returns the Temporary Name of the File. $_FILES['upload']['name'] ==> Returns the Actual Name of the File. $_FILES['upload']['type'] ==> Returns the Type of the File. So if I file_1 the file 'test.doc', the $_FILES['upload']['name'] would be 'phptut.doc' and $_FILES['upload']['type'] would be 'application/msword'. ---------------------------------------------------------------------*/ // this is the upload dir where files will go. //Don't remove the / //Chmod it (777) $upload_dir = "d:\\home\\sites\\mywebsite.com\\wwwroot\\proofs\\files\\"; //change to whatever you want. // files less than 50MB $size_bytes = 50248576; //bytes will be uploaded //check if the directory exist or not. if (!is_dir("$upload_dir")) { die ("The directory <b>($upload_dir)</b> doesn't exist"); } //check if the directory is writable. if (!is_writeable("$upload_dir")){ die ("The directory <b>($upload_dir)</b> is NOT writable, Please Chmod (777)"); } //Check first if a file has been selected //is_file_1_file('filename') returns true if //a file was file_1 via HTTP POST. Returns false otherwise. if (is_uploaded_file($_FILES['file_???']['tmp_name'])) { //Get the Size of the File $size = $_FILES['file_???']['size']; //Make sure that $size is less than 1MB (1000000 bytes) if ($size > $size_bytes) { echo "File Too Large. Please try again."; exit(); } // $filename will hold the value of the file name submetted from the form. $filename = $_FILES['file_???']['name']; //this is where you should have the filename inserted to the related row // Check if file is Already EXISTS. if(file_exists($upload_dir.$filename)){ echo "Oops! The file named <b>$filename </b>already exists"; exit(); } //Move the File to the Directory of your choice //move_file_1_file('filename','destination') Moves an file_??? file to a new location. if (move_uploaded_file($_FILES['file_???']['tmp_name'],$upload_dir.$filename)) { } else { //Print error echo "There was a problem moving your file"; exit(); } } $Version_Counter++; $Num_Versions_Temp--; echo "<b>".$filename."</b> has been uploaded.<br><br>"; }
  13. I'm building a system where a variable amount of files (1 to 6) will need to be uploaded depending on the situation. The upload process is currently a 3 page ordeal. I am trying to manipulate this script: [a href=\"http://www.phpfreaks.com/quickcode/A-Simple-File-Upload-trust-me-its-good/335.php\" target=\"_blank\"]http://www.phpfreaks.com/quickcode/A-Simpl...ts-good/335.php[/a] 1st page: basic information is filled out, the number of file uploads is entered in an input field 2nd page: number of file uploads required is stored as session variable, a while loop is used to create that specific number of upload dialogues - so far so good. 3rd page: again, a while loop is used to perform the upload actions, this is where my script seems to be failing. I suspect that it is because I'm trying to stick one variable (a counter) inside of another's name example: $_FILES['file_'.$Version_Counter.' '] I have also tried $_FILES['file_$Version_Counter'] with no luck I realize I could probably do this without a loop since there is a maximum of 6 repititions, but I think the loop would make for cleaner code. Let me know what you think, thanks for your help! Curt
  14. I have been struggling with this command for months. I am following the mysql manual for my version on this one, and I can't get it to work. Any help would be greatly appreciated. for importing a CSV file: "that","looks","like","this" ==== Being sent from the query sender in phpmyadmin: load data local infile 'd:\home\sites\something.com\wwwroot\fmp_mysql\item_list.csv' into table item_list fields terminated by ',' enclosed by ' " ' ==== MySQL said: Documentation #1083 - Field separator argument is not what is expected. Check the manual ==== Manual says: LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name' [REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS [TERMINATED BY 'string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY 'char'] ] [LINES [STARTING BY 'string'] [TERMINATED BY 'string'] ] [IGNORE number LINES] [(col_name,...)] ==== Eventually this will be put in a php script, but I'm just trying to get the query right for now. Thanks
  15. Here's the error I'm getting: 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 'Group = 'KK'' at line 1 The variable $group is being stored in the url as a link from a previous page: [a href=\"http://ecolab.7cpco.com/pricegroups.php?group=KK\" target=\"_blank\"]http://ecolab.7cpco.com/pricegroups.php?group=KK[/a] Here's the php code that's causing the error: $query = "SELECT * FROM item_list_price_groups where Group = '$group'"; I have other pages that work just the same as this is intended to (result based on url-stored variable). I pretty much copied the code verbatim from another application I wrote that works fine. I don't understand what could be wrong with this query. Thanks for your help.
  16. WOW! I do not understand why that is, but you were right. I don't see any solved button, otherwise I'd mark it. Thanks Joe!
  17. I'll post some code below, but I don't believe that's where the problem lies. I'm writing an application for our graphic designers to keep track of proofs online. [a href=\"http://7cpco.com/proofs/overview.php\" target=\"_blank\"]http://7cpco.com/proofs/overview.php[/a] As you can see on the page there are (currently) 2 catagories - and I will be adding more after I get this problem solved. Currently there are 2 results in the top catagory (out for proof) and 1 below (require a revision). The problem is, there really should be 3 in the top and 2 below. The result set I am getting back from mysql is omiting the first line for each query. If I run the identical query (copy and paste) right in phpMyAdmin, I get the correct results, but from my .php web page, [b]each query is skipping one line and returning everything else[/b]. I have checked the page source to make sure this isn't just a CSS formatting issue. The queries are pretty simple. For the first catagory - out for proof- I have a column in mysql called Response_y_or_n that auto fills in 'n' upon creation and is later replaced with 'y' when the customer fills out the response form. To return a list of all jobs out to proof I am simply looking for all rows with 'n' for that column. So my query/loop for that catagory is: //populate a div full of jobs currently out for proof $query = "SELECT * FROM proofs where Response_y_or_n='n'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); echo '<div id="wrap"><div class="wrapflow">'; echo '<span class="title">Proofs that we are waiting on:</span><br>'; //labeling the columns echo '<u><span class="invoice_number">Invoice#</span><span class="customer_orgname">Customer/Org</span><span class="description">Description</span><span class="designer_name">Designer</span><span class="response_target_datetime">Approve by</span><span class="customer_email">Contact</span></u><br>'; while ($row = mysql_fetch_array($result)){ echo '<span class="invoice_number">'.$row['Invoice_Number'].'</span><span class="customer_orgname">'.$row['Customer_OrgName'].'</span><span class="description"> <a href=http://www.7cpco.com/proofs/'.$row['Filename'].'>'.$row['Description'].'</a></span><span class="designer_name">'.$row['Designer_Name'].'</span><span class="response_target_datetime">'.$row['Response_Target_DateTime'].'</span><span class="customer_email"><a href="mailto:'.$row['Customer_Email'].'">'.$row['Customer_Email'].'</span></a><br>'; } echo '</div></div><br>'; Thanks for your help! Curt
  18. Image verification is the way to go, but if you don't want to do that, you can code your own filter if the spam is consistent. For instance, have the script fail if the phone number field contains anything other than numbers, parenthesis, periods, or dashes with an explaination of why it wasn't accepted (spammers are typically bots, not humans as far as I know, and will not make sense of it). Likewise you could have the email field verified (must contain @ symbol and .com or .net or etc...). Finally, if your spam has a consistent subject matter you can block messages that use certain keywords like 'enlarge' or 'prescriptions'. Again, I would recommend a notification message if the sending fails on the off chance that it is an actual customer who is trying to message you. [!--quoteo(post=349889:date=Feb 27 2006, 11:13 AM:name=Charles Andrews)--][div class=\'quotetop\']QUOTE(Charles Andrews @ Feb 27 2006, 11:13 AM) [snapback]349889[/snapback][/div][div class=\'quotemain\'][!--quotec--] I am using the following code to send form content to my email address. I am having problems with spam. What can I do to fix this problem. I would like to avoid image varification. Any code would be very helpful. I am new to PHP <?php $msg = "My Website Online Contact Submission\n"; $msg .= "Name: $name\n"; $msg .= "Comments: $emailAddress\n\n"; $msg .= "Comments: $phone\n\n"; $msg .= "Comments: $message\n\n"; $to = "me@mydomain.com"; $subject = "CONTACT FROM WEBSITE"; $mailheaders = "From: Website Submission Form <$emailAddress>\n"; $mailheaders .= "Reply-To:$Email_Address <$emailAddress>\n\n"; // Mail to address mail ( $to, $subject, $msg, $mailheaders ); ?> [/quote]
  19. Shoz, thanks so much for the response. I haven't had time to get back to this project today, but I will definately make use of your help!
  20. I work for a commercial printing company. Today I started writing an application in php/mysql that our graphic designers will use to keep track of the time they are spending on specific projects - for billing purposes, project tracking, etc. It would be easy for me to let them fill in the time themselves, but that defeats the purpose. My goal is to have it act like a stop watch, they just click a button to start/stop the clock. I have 3 time columns - TimeStart, TimeEnd, and TimeTotal. I have already got to the point where the program auto fills in start and stop time, I'm just stuck on figuring out how to have the TimeTotal (difference of end - start) automatically fill in. I have read the dates + time section in mysql manual over and over. I have scoured the net for posts on this subject. I still can't figure it out. The MySQL manual references a function called TIMEDIFF. Not only can I not get it to work properly, the code examples given in the manual don't even work for me. Originally, I set up all the time columns as 'TIME', I tried switching them to 'TIMESTAMP' with no luck. If anyone out there knows how to do this (meaning you have successfully scripted said function) I would very much appreciate some guidance, and if you will, please dumb it down and be specific. Don't just post links to the mysql manual, I'm not lazy, I have read it, and for the first time - it's not helping. Thanks a lot! Curt
×
×
  • 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.