Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. actualy the good one would be ucfirst http://ca2.php.net/manual/en/function.ucfirst.php
  2. nevermind ucwords documentation will get you on the way hehe
  3. Hey guys i am trying to create a Gmail multiple attachement clone systeme to my webmail and i am having a hard time with adding mutiple attachements to my emails. The email is sent, but no attachements are sent out with it... My HTML form looks like this: <form action='index.php?mod=mail&CMD=send' enctype='multipart/form-data' method='post'> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> [...] </form> My PHP code that gets this looks like this: <?php // SOME SERVERS HAVE SOME DIFFERENCES - AGHR if (get_magic_quotes_gpc()) $_POST = array_map('stripslashes', $_POST); $_POST['ms'] = str_replace("\r\n", "\n", $_POST['ms']); if (!isset($_SESSION['session_server']) || !isset($_SESSION['session_username']) || !isset($_SESSION['session_password'])) { showBody(""); echo "Your session might have timed-out. "; echo "Copy the content of your e-mail below, and try again by <A href='?mod=mail&folder=$_GET[folder]'>continuing</a>..."; echo "<PRE>" . $_POST['ms'] . "</PRE>"; return; } $head = "From: $_POST[fr]\n"; if ($_POST['cc']){$head .= "CC: $_POST[cc]\n";} if ($_POST['bcc']){$head .= "BCC: $_POST[bcc]\n";} $head .= "Return-Path: <" . $_POST['fr'] . ">\n"; $head .= "Reply-to: <" . $_POST['fr'] . ">\n"; $head .= 'Content-Type: text/html; charset="iso-8859-1"' . "\n"; $head .= 'Content-Transfer-Encoding: 8bit'; $head = str_replace("'", '"', $head); $to = str_replace("'", '"', $_POST['to']); $su = stripslashes($_POST['su']); $ms = $_POST['ms']; foreach($_FILES['userfile']['tmp_name'] as $key => $value){ if (is_uploaded_file($_FILES['userfile']['tmp_name'][$key])) { Attach($_FILES['userfile']['tmp_name'][$key],$_FILES['userfile']['name'][$key]); } } if ($_POST[submit]!="Save to Drafts"){$success = mail($to, $su, html_entity_decode($ms), $head);}else{$success="true";} if ($success) { showBody(""); if ($_POST[submit]!="Save to Drafts"){echo "Mail is sent!";}else{echo "Mail is saved!";} if (isset($_POST['oldmessage']) && isset($_POST['oldmessage_delete']) && $_POST['oldmessage_delete'] == "true") { echo " Also deleting original message."; delete($_POST['oldmessage']); } } ?> In case you are wandering what the Attach function does ... function Attach($AttmFile, $FileName) { global $ms, $head;// orginele message en headers $Text = $ms; $Html = $ms;// html is niet meer actief want wordt niet goed weergegeven na invoer if ($Text == "") { $Text = " "; $Html = " "; } $OB = "----=_OuterBoundary_000"; $IB = "----=_InnerBoundery_001"; $Html = $Html ? $Html:preg_replace("/\n/", "{br}", $Text) or die("neither text nor html part present."); $Text = $Text ? $Text:"Sorry, but you need an html mailer to read this mail."; $headers = "MIME-Version: 1.0\r\n"; $headers .= $head;// toevoeging orginele headers (from en to enzo) $headers .= "X-Priority: 1\n"; $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"" . $OB . "\"\n"; $Msg = "This is a multi-part message in MIME format.\n"; $Msg .= "\n--" . $OB . "\n"; $Msg .= "Content-Type: multipart/alternative;\n\tboundary=\"" . $IB . "\"\n\n"; $Msg .= "\n--" . $IB . "\n"; $Msg .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n"; $Msg .= "Content-Transfer-Encoding: quoted-printable\n\n"; $Msg .= $Text . "\n\n"; $Msg .= "\n--" . $IB . "--\n"; $patharray = explode("/", $AttmFile); $Msg .= "\n--" . $OB . "\n"; $Msg .= "Content-Type: application/octetstream;\n\tname=\"" . $FileName . "\"\n"; $Msg .= "Content-Transfer-Encoding: base64\n"; $Msg .= "Content-Disposition: attachment;\n\tfilename=\"" . $FileName . "\"\n\n"; $fd = fopen($AttmFile, "r"); if (!$fd) die("Could not open uploaded file on the server"); $FileContent = fread($fd, filesize($AttmFile)); fclose($fd); $FileContent = chunk_split(base64_encode($FileContent)); $Msg .= $FileContent; $Msg .= "\n\n"; $Msg .= "\n--" . $OB . "--\n"; $ms = $Msg; $head = $headers; } When i submit the forme the $_FILES is well sorted this is my print_r Array ( [userfile] => Array ( [name] => Array ( [0] => [1] => patangel.jpg [2] => patangel.png [3] => Picture 1.jpg ) [type] => Array ( [0] => [1] => image/pjpeg [2] => image/x-png [3] => image/pjpeg ) [tmp_name] => Array ( [0] => [1] => /tmp/phpITuenD [2] => /tmp/phpDVBoEJ [3] => /tmp/phpQ3phKT ) [error] => Array ( [0] => 4 [1] => 0 [2] => 0 [3] => 0 ) [size] => Array ( [0] => 0 [1] => 66131 [2] => 160980 [3] => 102651 ) ) ) I really don't get what i did wroung ... your help is really appreciated. thanks in advance.
  4. Try something like this <?php if ($_POST[direction]){ if ($_POST['newText']){ $direction=$_POST[direction]+1; }else{ $direction=$_POST[direction]-1; } }else{ $direction = "0"; } //CONNECT TO DB AND FIND OLDEST UPDATED TEXT AND DISPLAY IT $con = mysql_connect('host', 'user', 'pw'); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("db",$con); $order_by_desc = "SELECT text FROM para1 ORDER BY `updated_at` DESC LIMIT '$direction' , 1"; $oldest_result = mysql_query($order_by_desc,$con); $oldest_row = mysql_fetch_array($oldest_result); $least_updated = ($oldest_row['text']); mysql_close($con); ?> <form name="firstForm" method="post" action="index.php"> <input type="hidden" name="num" value="<?=$direction?>" /> <input type="submit" name="newText" value="New" /> <input type="submit" name="previousText" value="Previous" /> Paragraph 1: <textarea name="form1"><?php print $least_updated ?></textarea><br /></p> <br />
  5. well then the only thing i can think of is duplicate the table, run this script $transaction = mysql_query("SELECT * FROM table where name like '%-%'") or die (mysql_error()); while($trans = @mysql_fetch_array($transaction)){ $string = str_replace('-', '' $trans[name]); $update = mysql_query("UPDATE table SET name='$string'") or die (mysql_error()); } Then you make your select, output the query, and delete the new table or keep it synchronized But thats just because i don't see what the code looks like ... the real best way would be to check how your script works and see how they diled with the - issue.
  6. lol no i am not hehe this is driving me crazy >.< I have been looking for a solution all day ... I think i posted almost 50 messages just today i was helping others hopping somebody would help me :-(
  7. or reformat them the way you like http://ca3.php.net/number_format hehe
  8. bro i gave you the awnser already ... <?php $num = '$25.600 (EA)'; $new_num = preg_replace ('/[^\d]/', '', $num); echo $new_num; ?> now all you need is add the $ and format the number with . or , http://ca3.php.net/number_format
  9. You load the table into an array then you replace the - by nothing and you search and loop while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $my_array[] = $row; } But why not run a maintenance script to loop the current data and take out the - right away and modify the insert script to filter them out before they are inserted?
  10. technacly you can load the ressult into an array then take out the - and loop the array ...
  11. <?php $num = 't54j6 7kert @ ( ) _ - { }3 | |\\/ !@#$5%^&*()_+='; $new_num = preg_replace ('/[^\d]/', '', $num); echo $new_num; ?>
  12. show us the code you have right now. That will help understand what your saying. PHP is more clearn then English sometimes hehe
  13. try this <?php if ($_POST){ // get posted data into local variables $Email = Trim(stripslashes($_POST['Email'])); $To = "register@ottawapolefitness.com\r\n"; $Subject = "Registration"; $Subject2 = "Registration Confirmation"; $FirstName = ucwords(Trim(stripslashes($_POST['FirstName']))); $LastName = ucwords(Trim(stripslashes($_POST['LastName']))); $Telephone = Trim(stripslashes($_POST['Telephone'])); $Address = Trim(stripslashes($_POST['Address'])); $City = Trim(stripslashes($_POST['City'])); $Province = ($_POST['Province']); $PostalCode = strtoupper(Trim(stripslashes($_POST['PostalCode']))); $PostalCode = ereg_replace("[^A-Za-z0-9]", "", $PostalCode); $PostalCode = substr($PostalCode,0,3) ." ". substr($PostalCode,3,3); $Class = ($_POST['Class']); $Level = ($_POST['Level']); $Date = ($_POST['Date']); $Time = Trim(stripslashes($_POST['Time'])); $How = Trim(stripslashes($_POST['How'])); $Comments = Trim(stripslashes($_POST['Comments'])); $Headers = "From: " . $FirstName . " " . $LastName . " <" . $Email . ">\r\n"; $Headers .= "Bcc: hewittm@gmail.com"; $Headers2 = "From: " . "Ottawa Pole Fitness <info@ottawapolefitness.com>\r\n"; $Daytime = time (); $File = "./meth/reglog.csv"; // validation $validationOK=true; if (Trim($FirstName)=="") {$error = $error."Your name is empty<br>";} if (Trim($LastName)=="") {$error = $error."Your last name is empty<br>";} if (Trim($Email)=="") {$error = $error."Your email is empty<br>";}else{ if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $Email)) {$error = $error."Your email is invalide<br>";}} if (strlen($Telephone) < 10) {$error = $error."Your telephone is empty<br>";} if (!$validationOK) {$error = $error."Please check the boxe!<br>";} if ($error == ""){ // This code will strip out any commas and replace them with a space for the address and comments fields. function commasplit ($name) { $v1 = explode (",", $name) ; $name = "" ; foreach ($v1 as $t) { $name .= $t ; } return $name ; } $Address = commasplit($Address) ; $Comments = commasplit($Comments) ; // This code will format the telephone number of 555-555-5555 function phone_number($sPhone){ $sPhone = ereg_replace("[^0-9]",'',$sPhone); if(strlen($sPhone) != 10) return(False); $sArea = substr($sPhone,0,3); $sPrefix = substr($sPhone,3,3); $sNumber = substr($sPhone,6,4); $sPhone = $sArea."-".$sPrefix."-".$sNumber; return($sPhone); } $Telephone = phone_number($Telephone); // prepare email body text $Body = ""; $Body .= "Date: "; $Body .= date("d/m/Y",$Daytime); $Body .= "\n"; $Body .= "Time: "; $Body .= date("H:i",$Daytime); $Body .= "\n"; $Body .= "Name: " . $FirstName . " " . $LastName . "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Address: "; $Body .= $Address; $Body .= "\n"; $Body .= "City: "; $Body .= $City; $Body .= "\n"; $Body .= "Province: "; $Body .= $Province; $Body .= "\n"; $Body .= "PostalCode: "; $Body .= $PostalCode; $Body .= "\n"; $Body .= "Class: "; $Body .= $Class; $Body .= "\n"; $Body .= "How: "; $Body .= $How; $Body .= "\n"; $Body .= "Comments: "; $Body .= $Comments; $Body .= "\n"; // prepare email body text for confirmation $Msg = "Hi " . $FirstName . ","; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "Thank you for registering with Ottawa Pole Fitness. "; $Msg .= "A spot has now been confirmed for you to take a class. "; $Msg .= "You have selected " . $Class . ". "; $Msg .= "Remember to download complete a waiver http://ottawapolefitness.com/docs/Waiver.pdf "; $Msg .= "and bring it with you to your first class along with your payment. "; $Msg .= "We only accept cash or cheque payable to Ottawa Pole Fitness Inc. GST is included in all our prices. "; $Msg .= "We are located at 1066 Somerset St. W. at the intersection of Bayswater St. suite B-101 in the lower level. "; $Msg .= "Just take the elevator down one level. Be sure to bring a Yoga mat to class and "; $Msg .= "please arrive 5-10 minutes early to process your registration and payment."; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "I look forward to seeing you and have a great day!"; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "Li Hewitt"; $Msg .= "\n"; $Msg .= "613-371-3342"; $Msg .= "\n"; $Msg .= "www.ottawapolefitness.com"; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "[this is an automated confirmation email generated on " . date("d/m/Y",$Daytime) . "]"; // record registrations to a file $Handle = fopen($File, 'a'); $Data = date("d/m/Y",$Daytime) . ", "; $Data .= date("H:i",$Daytime) . ", "; $Data .= $FirstName . ", "; $Data .= $LastName . ", "; $Data .= $Telephone . ", "; $Data .= $Email . ", "; $Data .= $Address . ", "; $Data .= $City . ", "; $Data .= $Province . ", "; $Data .= $PostalCode . ", "; $Data .= $Class . ", "; $Data .= $How . "\n"; fwrite($Handle, $Data); fclose($Handle); if (mail($To, $Subject, $Body, $Headers)) { print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.htm\">"; } else { $error = $error."There has been an error sending out your data!<br>"; mail($Email, $Subject2, $Msg, $Headers2); } } } // The form function form($error){ print (' <form action="registration.php" method="POST" name="regform" id="regform">'); if ($error!=""){ print (' <table width="505" border="0" align="center"> <tr class="font-norm-grey"> <td width="491">'.$error.'</td> </tr> </table>'); } print (' <table width="505" border="0" align="center"> <tr class="font-norm-grey"> <td>E-mail address:<span class="font-norm-pink">*</span> <br> <input name="Email" type="text" id="Email8" size="21"> </td> <td colspan="2"> Address:<br> <input name="Address" type="text" id="Address3" size="48"> </td> </tr> <tr class="font-norm-grey"> <td>Province:<br> <select name="Province" size="1" id="select"> <option>Ontario</option> <option>Quebec</option> <option>Alberta</option> <option>British Columbia</option> <option>Manitoba</option> <option>New Brunswick</option> <option>Newfoundland</option> <option>Northwest Territories</option> <option>Nunavut</option> <option>Nova Scotia</option> <option>Prince Edward Island</option> <option>Saskatchewan</option> <option>Yukon</option> </select> </td> <td>City:<br> <input name="City" type="text" id="City3" value="Ottawa" size="25"> </td> <td width="153" valign="top">Postal Code:<br> <input name="PostalCode" type="text" id="PostalCode2" size="10"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2"> </td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2">Select a class from the list below:<br> </td> <td width="153" valign="top"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2"><select name="Class" id="select2"> <option>Level 1 Thu Feb 19 (8:30pm) </option> <option>Level 1 Tues Mar 10 (6:30pm) </option> <option>Level 1 Tues Mar 10 (8:30pm) </option> <option>Level 1 Wed Mar 11 (7:30pm) </option> <option>Level 1 Thu Mar 12 (6:30pm) </option> <option>Level 1 Sat Mar 14 (1:30pm) </option> <option>Private Lesson (to be arranged)</option> <option>Semi-Private Group 2-3 participants (to be arranged)</option> <option>Semi-Private Group 4-6 participants (to be arranged)</option> <option>Redeem Gift Certificate (to be arranged)</option> </select> <br> </td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2">How did you hear about us? </td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2"><select name="How" id="select3"> <option>Web Search</option> <option>Sexapolooza</option> <option>Business Card</option> <option>Facebook</option> <option>Friend</option> <option>Email</option> <option>Other</option> </select></td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2">Additional Comments/Special Requests:</td> <td width="153"> </td> </tr> <tr> <td colspan="3"> <input name="Comments" type="text" id="Comments" size="75"> </td> </tr> </table> <p align="center"><span class="font-small-grey-centered"> </span> <input type="submit" name="submit" value="Submit"> </p> </form>'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <TITLE>Ottawa Pole Fitness - Online Registration</TITLE> <meta name="description" content="Ottawa Pole Fitness Online Registration to learn Pole Fitness Lessons"> <meta name="keywords" content="ottawa, pole, fitness, women, private, lessons, tricks, fun, workshops, 1 on 1, excersize, dance, sexy, studio, westboro, woodroofe, carlingwood, workout"> <meta name="Classification" content="fitness, pole, westboro, ottawa, ontario, canada"> <meta name="copyright" content="2008 | Li Hewitt - All Rights Reserved"> <meta name="revisit-after" content="30 days"> <meta name="Author" content="Li Hewitt"> <meta name="Location" content="CA, ON, Ottawa"> <meta name="Language" content="en-us"> <meta name="robots" content="all"> <meta name="rating" content="General"> <meta http-equiv="reply-to" content="info@ottawapolefitness.com"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/OPF-style.css" rel="stylesheet" type="text/css"> </head> <body background="images/bg.gif"> <div align="center"><img src="images/Ottawa%20Pole%20Fitness%20Banner.gif" alt="Ottawa Pole Fitness" width="632" height="180" border="0"></div> <table width="630" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#990066"> <tr valign="bottom" bordercolor="#FFFFFF"> <td width="130" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="index.htm" target="_self" class="font-menu- active">Home</a></div></td> <td width="112" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="about.htm" target="_self" class="font-menu- active">About</a></div></td> <td width="105" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="classes.htm" target="_self" class="font-menu- active">Classes</a></div></td> <td width="130" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="schedule.htm" target="_self" class="font-menu- active">Schedule</a></div></td> <td width="153" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="contact.htm" target="_self" class="font-menu- active">Contact</a></div></td> </tr> <tr valign="bottom" bordercolor="#FFFFFF"> <td height="10" colspan="5" bgcolor="#FFFFFF"><div align="center"><img src="images/line.gif" width="628" height="2"></div></td> </tr> <tr bordercolor="#FFFFFF"> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="faq.htm" target="_self" class="font-menu-active"> FAQ</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="gallery.htm" target="_self" class="font-menu-active"> Gallery</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="parties.htm" target="_self" class="font-menu-active"> Parties</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="prices.htm" target="_self" class="font-menu-active"> Prices</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center" class="font-menu-static"> Registration</div></td> </tr> <tr valign="middle" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <td height="10" colspan="5"> <p align="center"><img src="images/line.gif" width="628" height="2" align="absmiddle"></p></td> </tr> <tr valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <td height="420" colspan="5"> <blockquote> <p><br> <span class="font-norm-grey">If you would like to take a class please complete the form below. </span><span class="font-small-grey"><em> [Fields marked (</em></span><span class="font-norm-pink"><em>*</em></span><span class="font-small-grey"><em>) are required]. </em></span><span class="font-norm-grey">You can make your payment at your first class. We accept payment by cash or cheque payable to Ottawa Pole Fitness Inc.</span> <?php echo form($error); ?> <p class="font-small-grey-centered">Your privacy is important to us at Ottawa Pole Fitness. The information we collect is for our own purposes only and will not be given to anyone else. We use this information to keep a personal confidential file for everyone who registers with Ottawa Pole Fitness. We hate spam just as much as you do; this is why we will not distribute your information to anyone. If you have any concerns regarding our policy please contact us. <p class="font-small-grey-centered"><br> </blockquote></td> </tr> </table> <div align="center"><img src="images/Ottawa%20Pole%20Fitness%20Footer.gif" width="632" height="36"> </div> </body> </html>
  14. You probably upgraded or downgraded your PHP server ... try switching it to the same version or your gona have a mad time converting all your stuff ;-) http://derickrethans.nl/pres-breaking/talk.html
  15. I would disagree, either way the processing is there. But storing it in it's raw form allows for any type of manipulation. That is just my 2cents though. Do it when it is coming out of the DB. Not going in. But when you enter it to the database your actualy processing only one ... but when you output it you output 10 or 20
  16. hehe yeah they tell a lot of stuff on a lot of stuff but they always forget the details ... hehe
  17. i can't help if you don't post what your trying
  18. nope thats simply caling the Attach($AttmFile, $FileName) function
  19. <?php if ($_POST){ // get posted data into local variables $Email = Trim(stripslashes($_POST['Email'])); $To = "register@ottawapolefitness.com\r\n"; $Subject = "Registration"; $Subject2 = "Registration Confirmation"; $FirstName = ucwords(Trim(stripslashes($_POST['FirstName']))); $LastName = ucwords(Trim(stripslashes($_POST['LastName']))); $Telephone = Trim(stripslashes($_POST['Telephone'])); $Address = Trim(stripslashes($_POST['Address'])); $City = Trim(stripslashes($_POST['City'])); $Province = ($_POST['Province']); $PostalCode = strtoupper(Trim(stripslashes($_POST['PostalCode']))); $PostalCode = ereg_replace("[^A-Za-z0-9]", "", $PostalCode); $PostalCode = substr($PostalCode,0,3) ." ". substr($PostalCode,3,3); $Class = ($_POST['Class']); $Level = ($_POST['Level']); $Date = ($_POST['Date']); $Time = Trim(stripslashes($_POST['Time'])); $How = Trim(stripslashes($_POST['How'])); $Comments = Trim(stripslashes($_POST['Comments'])); $Headers = "From: " . $FirstName . " " . $LastName . " <" . $Email . ">\r\n"; $Headers .= "Bcc: hewittm@gmail.com"; $Headers2 = "From: " . "Ottawa Pole Fitness <info@ottawapolefitness.com>\r\n"; $Daytime = time (); $File = "./meth/reglog.csv"; // validation $validationOK=true; if (Trim($FirstName)=="") {$error = $error."Your name is empty<br>";} if (Trim($LastName)=="") {$error = $error."Your last name is empty<br>";} if (Trim($Email)=="") {$error = $error."Your email is empty<br>";}else{ if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $Email)) {$error = $error."Your email is invalide<br>";}} if (strlen($Telephone) < 10) {$error = $error."Your telephone is empty<br>";} if (!$validationOK) {$error = $error."Please check the boxe!<br>";} } if ($error == ""){ // This code will strip out any commas and replace them with a space for the address and comments fields. function commasplit ($name) { $v1 = explode (",", $name) ; $name = "" ; foreach ($v1 as $t) { $name .= $t ; } return $name ; } $Address = commasplit($Address) ; $Comments = commasplit($Comments) ; // This code will format the telephone number of 555-555-5555 function phone_number($sPhone){ $sPhone = ereg_replace("[^0-9]",'',$sPhone); if(strlen($sPhone) != 10) return(False); $sArea = substr($sPhone,0,3); $sPrefix = substr($sPhone,3,3); $sNumber = substr($sPhone,6,4); $sPhone = $sArea."-".$sPrefix."-".$sNumber; return($sPhone); } $Telephone = phone_number($Telephone); // prepare email body text $Body = ""; $Body .= "Date: "; $Body .= date("d/m/Y",$Daytime); $Body .= "\n"; $Body .= "Time: "; $Body .= date("H:i",$Daytime); $Body .= "\n"; $Body .= "Name: " . $FirstName . " " . $LastName . "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Address: "; $Body .= $Address; $Body .= "\n"; $Body .= "City: "; $Body .= $City; $Body .= "\n"; $Body .= "Province: "; $Body .= $Province; $Body .= "\n"; $Body .= "PostalCode: "; $Body .= $PostalCode; $Body .= "\n"; $Body .= "Class: "; $Body .= $Class; $Body .= "\n"; $Body .= "How: "; $Body .= $How; $Body .= "\n"; $Body .= "Comments: "; $Body .= $Comments; $Body .= "\n"; // prepare email body text for confirmation $Msg = "Hi " . $FirstName . ","; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "Thank you for registering with Ottawa Pole Fitness. "; $Msg .= "A spot has now been confirmed for you to take a class. "; $Msg .= "You have selected " . $Class . ". "; $Msg .= "Remember to download complete a waiver http://ottawapolefitness.com/docs/Waiver.pdf "; $Msg .= "and bring it with you to your first class along with your payment. "; $Msg .= "We only accept cash or cheque payable to Ottawa Pole Fitness Inc. GST is included in all our prices. "; $Msg .= "We are located at 1066 Somerset St. W. at the intersection of Bayswater St. suite B-101 in the lower level. "; $Msg .= "Just take the elevator down one level. Be sure to bring a Yoga mat to class and "; $Msg .= "please arrive 5-10 minutes early to process your registration and payment."; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "I look forward to seeing you and have a great day!"; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "Li Hewitt"; $Msg .= "\n"; $Msg .= "613-371-3342"; $Msg .= "\n"; $Msg .= "www.ottawapolefitness.com"; $Msg .= "\n"; $Msg .= "\n"; $Msg .= "[this is an automated confirmation email generated on " . date("d/m/Y",$Daytime) . "]"; // record registrations to a file $Handle = fopen($File, 'a'); $Data = date("d/m/Y",$Daytime) . ", "; $Data .= date("H:i",$Daytime) . ", "; $Data .= $FirstName . ", "; $Data .= $LastName . ", "; $Data .= $Telephone . ", "; $Data .= $Email . ", "; $Data .= $Address . ", "; $Data .= $City . ", "; $Data .= $Province . ", "; $Data .= $PostalCode . ", "; $Data .= $Class . ", "; $Data .= $How . "\n"; fwrite($Handle, $Data); fclose($Handle); if (mail($To, $Subject, $Body, $Headers)) { print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.htm\">"; } else { $error = $error."There has been an error sending out your data!<br>"; mail($Email, $Subject2, $Msg, $Headers2); } } // The form function form($error){ print (' <form action="registration.php" method="POST" name="regform" id="regform">'); if ($error!=""){ print (' <table width="505" border="0" align="center"> <tr class="font-norm-grey"> <td width="491">'.$error.'</td> </tr> </table>'); } print (' <table width="505" border="0" align="center"> <tr class="font-norm-grey"> <td>E-mail address:<span class="font-norm-pink">*</span> <br> <input name="Email" type="text" id="Email8" size="21"> </td> <td colspan="2"> Address:<br> <input name="Address" type="text" id="Address3" size="48"> </td> </tr> <tr class="font-norm-grey"> <td>Province:<br> <select name="Province" size="1" id="select"> <option>Ontario</option> <option>Quebec</option> <option>Alberta</option> <option>British Columbia</option> <option>Manitoba</option> <option>New Brunswick</option> <option>Newfoundland</option> <option>Northwest Territories</option> <option>Nunavut</option> <option>Nova Scotia</option> <option>Prince Edward Island</option> <option>Saskatchewan</option> <option>Yukon</option> </select> </td> <td>City:<br> <input name="City" type="text" id="City3" value="Ottawa" size="25"> </td> <td width="153" valign="top">Postal Code:<br> <input name="PostalCode" type="text" id="PostalCode2" size="10"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2"> </td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2">Select a class from the list below:<br> </td> <td width="153" valign="top"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2"><select name="Class" id="select2"> <option>Level 1 Thu Feb 19 (8:30pm) </option> <option>Level 1 Tues Mar 10 (6:30pm) </option> <option>Level 1 Tues Mar 10 (8:30pm) </option> <option>Level 1 Wed Mar 11 (7:30pm) </option> <option>Level 1 Thu Mar 12 (6:30pm) </option> <option>Level 1 Sat Mar 14 (1:30pm) </option> <option>Private Lesson (to be arranged)</option> <option>Semi-Private Group 2-3 participants (to be arranged)</option> <option>Semi-Private Group 4-6 participants (to be arranged)</option> <option>Redeem Gift Certificate (to be arranged)</option> </select> <br> </td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2">How did you hear about us? </td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2"><select name="How" id="select3"> <option>Web Search</option> <option>Sexapolooza</option> <option>Business Card</option> <option>Facebook</option> <option>Friend</option> <option>Email</option> <option>Other</option> </select></td> <td width="153"> </td> </tr> <tr class="font-norm-grey"> <td colspan="2">Additional Comments/Special Requests:</td> <td width="153"> </td> </tr> <tr> <td colspan="3"> <input name="Comments" type="text" id="Comments" size="75"> </td> </tr> </table> <p align="center"><span class="font-small-grey-centered"> </span> <input type="submit" name="submit" value="Submit"> </p> </form>'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <TITLE>Ottawa Pole Fitness - Online Registration</TITLE> <meta name="description" content="Ottawa Pole Fitness Online Registration to learn Pole Fitness Lessons"> <meta name="keywords" content="ottawa, pole, fitness, women, private, lessons, tricks, fun, workshops, 1 on 1, excersize, dance, sexy, studio, westboro, woodroofe, carlingwood, workout"> <meta name="Classification" content="fitness, pole, westboro, ottawa, ontario, canada"> <meta name="copyright" content="2008 | Li Hewitt - All Rights Reserved"> <meta name="revisit-after" content="30 days"> <meta name="Author" content="Li Hewitt"> <meta name="Location" content="CA, ON, Ottawa"> <meta name="Language" content="en-us"> <meta name="robots" content="all"> <meta name="rating" content="General"> <meta http-equiv="reply-to" content="info@ottawapolefitness.com"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/OPF-style.css" rel="stylesheet" type="text/css"> </head> <body background="images/bg.gif"> <div align="center"><img src="images/Ottawa%20Pole%20Fitness%20Banner.gif" alt="Ottawa Pole Fitness" width="632" height="180" border="0"></div> <table width="630" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#990066"> <tr valign="bottom" bordercolor="#FFFFFF"> <td width="130" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="index.htm" target="_self" class="font-menu- active">Home</a></div></td> <td width="112" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="about.htm" target="_self" class="font-menu- active">About</a></div></td> <td width="105" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="classes.htm" target="_self" class="font-menu- active">Classes</a></div></td> <td width="130" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="schedule.htm" target="_self" class="font-menu- active">Schedule</a></div></td> <td width="153" height="23" bgcolor="#FFFFFF"> <div align="center"><a href="contact.htm" target="_self" class="font-menu- active">Contact</a></div></td> </tr> <tr valign="bottom" bordercolor="#FFFFFF"> <td height="10" colspan="5" bgcolor="#FFFFFF"><div align="center"><img src="images/line.gif" width="628" height="2"></div></td> </tr> <tr bordercolor="#FFFFFF"> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="faq.htm" target="_self" class="font-menu-active"> FAQ</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="gallery.htm" target="_self" class="font-menu-active"> Gallery</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="parties.htm" target="_self" class="font-menu-active"> Parties</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center"><a href="prices.htm" target="_self" class="font-menu-active"> Prices</a></div></td> <td height="20" bgcolor="#FFFFFF"> <div align="center" class="font-menu-static"> Registration</div></td> </tr> <tr valign="middle" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <td height="10" colspan="5"> <p align="center"><img src="images/line.gif" width="628" height="2" align="absmiddle"></p></td> </tr> <tr valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <td height="420" colspan="5"> <blockquote> <p><br> <span class="font-norm-grey">If you would like to take a class please complete the form below. </span><span class="font-small-grey"><em> [Fields marked (</em></span><span class="font-norm-pink"><em>*</em></span><span class="font-small-grey"><em>) are required]. </em></span><span class="font-norm-grey">You can make your payment at your first class. We accept payment by cash or cheque payable to Ottawa Pole Fitness Inc.</span> <?php echo form($error); ?> <p class="font-small-grey-centered">Your privacy is important to us at Ottawa Pole Fitness. The information we collect is for our own purposes only and will not be given to anyone else. We use this information to keep a personal confidential file for everyone who registers with Ottawa Pole Fitness. We hate spam just as much as you do; this is why we will not distribute your information to anyone. If you have any concerns regarding our policy please contact us. <p class="font-small-grey-centered"><br> </blockquote></td> </tr> </table> <div align="center"><img src="images/Ottawa%20Pole%20Fitness%20Footer.gif" width="632" height="36"> </div> </body> </html> i did not test the code so there might be small errors... try it out and repport them to me in this topic
  20. Yeah try outputing the result to check it out echo '<pre>'; print_r($a); echo '</pre>';
  21. What i gave you is the solution bro hehe the problem i have is a lot more complicated <?php $target_path = "uploads/"; foreach($_FILES['userfile']['tmp_name'] as $key => $value){ $target_path = $target_path . basename( $_FILES['userfile']['name'][$key]); if(move_uploaded_file($_FILES['userfile']['tmp_name'][$key], $target_path)) { echo "The file ". basename( $_FILES['userfile']['name'][$key]). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } ?>
  22. 1) it does but this is not a critical error so the script continues to see the error put this on top of your page error_reporting(E_ALL); 2) Yes but you are giving him a value $a->my_value = 5; so what ever you do, it's always gona assume $a->my_value is equal to 5
×
×
  • 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.