[PHP] Calendar/Date
Hi All, Does anyone have code and/or advice for how to get get the current week (with a passed current day, say) and what then end date is at Saturday. So take today: Tuesday March 17, 2009 I want to get: Sunday March 15, 2009 Monday March 16, 2009 Tuesday March 17, 2009 Wednesday March 18, 2009 Thursday March 19, 2009 Friday March 20, 2009 Saturday March 21, 2009 Thanks! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] password field validation
Hi All, I have an input field with type=password. I am trying to do some error checking to see if the user puts a value in after they submit the form (i.e not left it blank) Here is what I have: on form: Password: input id=PASSWORD name=PASSWORD type=password size=15 In PHP error checking: if (empty($_POST[PASSSWORD])) { $GERROR=TRUE;} even though I am putting characters in the field before I submit I am always getting TRUE returned. This same tactic works for other fields I have that I need to make sure they put values in, just I have never done this before with a password field. What am I doing wrong? I just want to make sure they put something there! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] password field validation
if (empty($_POST[PASSSWORD])) { $GERROR=TRUE;} If that's a direct copy/paste from your actual code, there is an extra S in PASSWORD. Also, you should enclose the array key in quotes: if (empty($_POST['PASSWORD'])) { $GERROR='TRUE'; } It is official I am a DOPE! Thank you, yes, I did not see the SSS in an hour of looking! Why enclose in quotes? I have never done this! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Daily and Weekly Calendar classes
Hi All, Does anyone have classes for creating a nice daily calendar? I can put the data in MySQL and be queried, etc. Something that when I add events to the calendar it puts them in the right time slot, etc, etc. I can do the rest of the coding Free is best! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Content Management
Hi All, I am looking for an open-sourced CMS that is PHP/MySQL based. I would like something simple to setup, but also would be good for a storefront as I want to use it for my indie business. Thoughts? -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR Help
Hi All, I installed PEAR fine. How I need to install OLE and Spreadsheet_Excel_Writer and I dont see how pear install . fails every time with channel errors and not found errors. I have downloaded the .tgz files, but I dont know where to put the contents. Any thoughts? -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Uploads Help!!!
Hi All, I am uploading a file and it says it worked, but I dont see it in the directory Here is my code so far: $allowed_ext = array('csv','xls'); $ext = end(explode('.',$_FILES['uploadedfile']['name'])); $ran2 = rand()..; $target = tempUploads/; $target = $target . $ran2.$ext; if($_FILES['uploadedfile']['size'] 200){ $message = 'File over 2MB'; echo $message; exit; } if($message == NULL !in_array($ext,$allowed_ext)){ $message = 'File extension not allowed'.' extension is:'.$ext; echo $message; exit; } if($message == NULL) { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target)) { $message = Uploaded The File.; echo $message; // upload was successful, now lets work with it include '_functions.inc'; // Utility Functions include '_fileHeaders.inc'; // CSV File Headers that we expect, in the proper order include '_fileParse.inc'; // CSV File Parsing } else { $message = Sorry, there was a problem uploading your file.; echo $message; } } How can I verify it is there? I ftp in and I dont see it. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Uploads Help!!! --Forgot
Here is the output I am printing: 'tempUploads/1425182872.xlsUploaded The File.' What is the issue? -Jason On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote: Hi All, I am uploading a file and it says it worked, but I dont see it in the directory Here is my code so far: $allowed_ext = array('csv','xls'); $ext = end(explode('.',$_FILES['uploadedfile']['name'])); $ran2 = rand()..; $target = tempUploads/; $target = $target . $ran2.$ext; if($_FILES['uploadedfile']['size'] 200){ $message = 'File over 2MB'; echo $message; exit; } if($message == NULL !in_array($ext,$allowed_ext)){ $message = 'File extension not allowed'.' extension is:'.$ext; echo $message; exit; } if($message == NULL) { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target)) { $message = Uploaded The File.; echo $message; // upload was successful, now lets work with it include '_functions.inc'; // Utility Functions include '_fileHeaders.inc'; // CSV File Headers that we expect, in the proper order include '_fileParse.inc'; // CSV File Parsing } else { $message = Sorry, there was a problem uploading your file.; echo $message; } } How can I verify it is there? I ftp in and I dont see it. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Uploads Help!!! --Forgot
Hi Eric, 'tempUploads/1425182872.xlsUploaded The File.' http://us2.php.net/manual/en/function.is-uploaded-file.php http://us2.php.net/manual/en/features.file-upload.errors.php So do I still use move_uploaded_file? -Jason
Re: [PHP] File Uploads Help!!! --Forgot
Hi Eric, So do I still use move_uploaded_file? Absolutely. I just didn't see anywhere in your code where you were checking for an error with the file upload itself or that it did exist on the server before moving it. Got it, thanks!! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing Strings
OK, making good learning progress today. I have a string that is: Jason Slack and I want it broken at the space so i get Jason and then Slack I am looking at parse_str, but I dont get how to do it with a space. The example is using []=. Then I want to assign like: $fname = Jason; $lname = Slack; Any ideas? -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing Strings
How might I also parse and address like: SCOTTSDALE, AZ 85254 It has a comma and a space -Jason On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote: OK, making good learning progress today. I have a string that is: Jason Slack and I want it broken at the space so i get Jason and then Slack I am looking at parse_str, but I dont get how to do it with a space. The example is using []=. Then I want to assign like: $fname = Jason; $lname = Slack; Any ideas? -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Parsing Strings
Konrad, On Dec 5, 2008, at 4:22 PM, Konrad Priemer wrote: $array = explode( , Jason Slack); Awesome, thanks, yup that does it. Can you explain how to do an address now into City, State, Zip Like: cortland, ny 13045 It has a comma and a space! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Parsing Strings
Conny, Can you explain how to do an address now into City, State, Zip Like: cortland, ny 13045 $string = cortland, ny 13045; $search = array(, , ,); $replace = array( , ); $newString = str_replace($search, $replace, $string); $array = explode( , $newString); Ah ha! Nice that makes sense, why did I not think of that! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MkDir Help
Hi All, I want to make a directory on my web server programatically when my code to create a new user runs. I am running PHP 5.2.5 on Linux. I am running: $dirToCreate = ...$_SESSION['s_USER_URL']; mkdir($dirToCreate, 0777, TRUE); // create the directory for the user $dirToCreate is: ../people/jason as an example When I create this I am in wwwroot/admin and I want to create wwwroot/people/jason wwwroot/people already exists. I get an error: Warning: mkdir() expects at most 2 parameters, 3 given in /home/net1003/public_html/admin/_createPage.inc on line 5 Even without TRUE this operation does not work. Does anyone have any thoughts? -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MkDir Help
Hi, Well, as your mkdir is saying you can only have 2 parameters, I'm guessing you're not yet running PHP 5. Also, as 0777 is the default mode, you can omit this from your code to leave only one argument. You didn't say the exact error you're getting when you omit the third argument. My guess is it's a permission denied error, which is the most common pitfall for file functions. Does Apache have access to your wwwroot directory? Either make Apache the owner of the directory, add the Apache group (the name varies from OS to OS, usually wwwrun, or www) to the directory and allow group write permissions. You could chmod 777 the directory, but this isn't very safe at all, and I doubt you'll find anyone on this list who'd recommend it! I will check all of this out and see what is going on. Thanks! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CSV Files
Hi All, I need to take a record in MySQL and have my user get it as a CSV File. I am OK with most everything, except when I create the CSV file, I write out the column headers then I need to write out the data. After I right out the column headers do I have to put a '/n' to have it start a new line in the CSV file? I think I do. Here is what I have (a snippet): header(Content-type: application/csv); header($filenameString); header(Pragma: no-cache); header(Expires: 0); echo $map_BORROWER_FIRST_NAME., ; echo $map_BORROWER_LAST_NAME., ; echo $map_BORROWER_SSN., ; echo $map_BORROWER_HOME_PHONE., ; echo $map_BORROWER_DOB; echo /n; echo $row[BORROWER_FIRST_NAME].,; echo $row[BORROWER_LAST_NAME].,; echo $row[BORROWER_SSN].,; echo $row[BORROWER_HOME_PHONE_FIRST].$row[BORROWER_HOME_PHONE_MIDDLE]. $row[BORROWER_HOME_PHONE_LAST].,; echo $row[BORROWER_DOB_MONTH].$row[BORROWER_DOB_DAY]. $row[BORROWER_DOB_YEAR]; When I run this, I see my column names, but not the data. The query seems to execute just fine Any advice? Thanks, -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSV Files
Hi Stut, Actually i am ending the row headers with a chr(10); // LINE FEED -Jason On Oct 22, 2008, at 5:12 PM, Stut wrote: On 23 Oct 2008, at 00:59, Jason Todd Slack-Moehrle wrote: After I right out the column headers do I have to put a '/n' to have it start a new line in the CSV file? I think I do. A new line is \n not /n, and it must be in double quotes () not single ('). -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSV Files
Oh, I am not putting quotes around each field that i get from MySQL. There are no quotes in the data so that is good. Sorry I put /n and I meant to put chr(10). -Jason On Oct 22, 2008, at 6:58 PM, Stut wrote: On 23 Oct 2008, at 02:41, Jason Todd Slack-Moehrle wrote: Actually i am ending the row headers with a chr(10); // LINE FEED From the code you included in your original post... echo /n; There was no mention of chr(10). Outputting data in CSV format is not hard. Simply echo the header row if necessary, followed by \n. Then output each line taking care to put string values in quotes which means you also need to escape quotes in the data. After each line echo \n. That's really all there is to it. If you're still having problems I suggest you post the exact code you're using, anything else just makes it harder for us to provide effective help. -Stut -- http://stut.net/ On Oct 22, 2008, at 5:12 PM, Stut wrote: On 23 Oct 2008, at 00:59, Jason Todd Slack-Moehrle wrote: After I right out the column headers do I have to put a '/n' to have it start a new line in the CSV file? I think I do. A new line is \n not /n, and it must be in double quotes () not single ('). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php