Jump to content

illuz1on

Members
  • Posts

    114
  • Joined

  • Last visited

    Never

Everything posted by illuz1on

  1. I have made a bit more progress... <?php $mynewprice = $product_price; function deleteFirstChar( $mynewprice ) { return substr( $mynewprice, 1 ); } $rightprice = deleteFirstChar( $mynewprice ); ?> I was hoping $rightprice would be the stripped value of 550.00 -------------------------- I think im struggling because $product_price returns this: <div class="yagendoo_productPrice"> <span class="yagendoo_productPrice"> R550.00 </span> </div> So I think now, I need to make it strip ALL characters except for numeric chars.. Any ideas?
  2. Hi, Im looking at using a statement like this to remove all text characters from a string. $outgoing = substr_replace($incoming,"",-1); The string is a currency that has a currency symbol in the beginning of the string, like "R500.00" I would like to remove the R, so it is just a numeric value... Please can you help me with any ideas on how to get this going? Been reading so much and its all confused me too badly. Regards, Chris
  3. Thanks for the reply, still a bit confused though.. "Or if the second box is a dropdown you could do a show on it. I'm also sure there is a way with plain javascript except I don't know off the top of my head hopefully this helps ya out." The second one would be a dropdown - what do you mean a show on it? What would the include file contents be?
  4. [code]Hi, I have a select like below in my form, I want a second box to populate but differently for each activity. I would like to do this by means of something like this (case method really).. Any help would be much appreciated.. been struggling with it. Thanks alot, Chris [code] If () case '1'; query to fill for activity 1 case '2'; query to fill for activity 2 etc.. etc.. This is my current select for activity... <select name="posActivity" id="posActivity"> <option selected>Select an option</option> <option value="Abseiling Table Mountain">Abseiling Table Mountain</option> <option value="Breede River Rafting">Breede River Rafting</option> <option value="Table Mountain Hiking">Table Mountain Hiking</option> <option value="Kloofing Suicide Gorge">Kloofing Suicide Gorge</option> <option value="Surfing Cape Peninsula Tour">Surfing Cape Peninsula Tour</option> <option value="Quad Biking Mountain Expedition">Quad Biking Mountain Expedition</option> <option value="Scuba Diving">Scuba Diving</option> <option value="Shark Cage Diving">Shark Cage Diving</option> <option value="Tandem Skydiving">Tandem Skydiving</option> <option value="Sunset Horse Riding">Sunset Horse Riding</option> <option value="Cape Peninsula Tour">Cape Peninsula Tour</option> <option value="Safari">Safari</option> <option value="Wine Tasting">Wine Tasting</option> </select> [/code][/code]
  5. Thanks Ken, using your solution there and it works perfectly. Im also puzzling on how to make it send this mail to 2 recipients... at the moment its just the one... As in, support@ and to support2@ Here is another extract.. Thanks again, Chris $yourName = 'Cape-Town-Alive'; $yourEmail = 'support@capetownalive.co.za'; $yourSubject = 'New booking request'; $to = $yourName; $subject = 'New Booking Request: '.cleanPosUrl($_POST['posActivity']); $msg_flds = array('Name','Email','Staying','Country','Contact','Activity','Text'); $tmp = array(); $tmp[] = 'Cape Town Alive - Cape Xtreme Booking Request'; foreach($msg_flds as $fld) $tmp[] = $fld . ': ' . cleanPosUrl($_POST['pos' . $fld]); $message = implode("\r\n",$tmp); $tmp = array(); $tmp[] = "From: ".cleanPosUrl($_POST['posName'])." <".cleanPosUrl($_POST['posEmail']).">"; $tmp[] = "To: $yourName <$yourEmail>"; $headers = implode("\r\n",$tmp); $mailit = mail($to,$subject,$message,$headers);
  6. Hi, Im having problems with the snippet below, the $message part.. can anyone help me with the syntax please? Any help will be much appreciated.. Thanks alot Chris $message = 'Cape Town Alive - Cape Xtreme Booking Request' <br> 'Name:' . cleanPosUrl($_POST['posName']); . 'Email:' . cleanPosUrl($_POST['posEmail']); . 'Staying:' . cleanPosUrl($_POST['posStaying']); . 'Country:' . cleanPosUrl($_POST['posCountry']); . 'Contact:' . cleanPosUrl($_POST['posContact']); . 'Actvity:' . cleanPosUrl($_POST['posActivity']); . 'Comments:' . cleanPosUrl($_POST['posComments']); $headers = "From: ".cleanPosUrl($_POST['posName'])." <".cleanPosUrl($_POST['posEmail']).">\r\n"; $headers .= 'To: '.$yourName.' <'.$yourEmail.'>'."\r\n"; $mailit = mail($to,$subject,$message,$headers);
  7. Hi, I run a Joomla website, and I am trying to custom code a piece of code that performs the following function: When a comment is posted with JomComment on either a SOBI2 item, content item or blog, it inserts a line into SQL with the relevant LINK, TITLE, URL and TIME, which is then displayed as you can imagine. The link and title have to be taken from the specific components table in the database... I need more of a syntax and usage check of the PHP/SQL I use here, the method and insertion and etc is fine, the only problem is that is doesnt fetch the appropriate TITLE. The output looks like so: # Reviews : Chris Edington just wrote a blog titled 0 The 0 should be the title, fetched from the specific components table, fetched by ID which it gets out of the $bigstring (which is a full url, http://etc) with the substr code. Please if anyone can spot any errors or let me know how I could reapply this code properly, would be much appreciated, my first code i actually written myself so would love to succeed on this project! Thanks alot, Chris Thanks alot, <? if ($data->option == "com_content") { $strSQL1 = "SELECT `title` FROM #__content WHERE `id`='{$data->contentid}'"; $this->cms->db->query($strSQL1); $shoutName = $this->cms->db->get_value(); global $database; $link = $_SERVER['HTTP_REFERER']; $cool = $newid; $shout='[iurl='.sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$this->cms->user->id.'&Itemid=140').']'.$this->cms->user->name.'[/iurl] just wrote '.$cool.' a blog titled [iurl='.$link.']'.stripslashes($shoutName).'[/iurl]'; $database->setQuery("INSERT INTO #__liveshoutbox (time,name,text,url) VALUES ('".time()."','Reviews','".mysql_real_escape_string($shout)."','".$link."')"); $res = $database->query(); } ELSEIF ($data->option == "com_res2") { $bigstring = $_SERVER['HTTP_REFERER']; $newid = substr($bigstring,75,2); $strSQL1 = "SELECT `title` FROM #___res2_item WHERE `id`='$newid'"; $this->cms->db->query($strSQL1); $shoutName = $this->cms->db->get_value(); global $database; $link = $_SERVER['HTTP_REFERER']; $cool = $newid; $shout='[iurl='.sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$this->cms->user->id.'&Itemid=140').']'.$this->cms->user->name.'[/iurl] just wrote '.$cool.' a blog titled [iurl='.$link.']'.stripslashes($shoutName).'[/iurl]'; $database->setQuery("INSERT INTO #__liveshoutbox (time,name,text,url) VALUES ('".time()."','Reviews','".mysql_real_escape_string($shout)."','".$link."')"); $res = $database->query(); } ELSEIF ($data->option == "com_night2") { $bigstring = $_SERVER['HTTP_REFERER']; $newid = substr($bigstring,75,2); $strSQL1 = "SELECT `title` FROM #___night2_item WHERE `id`='$newid'"; $this->cms->db->query($strSQL1); $shoutName = $this->cms->db->get_value(); global $database; $link = $_SERVER['HTTP_REFERER']; $cool = $newid; $shout='[iurl='.sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$this->cms->user->id.'&Itemid=140').']'.$this->cms->user->name.'[/iurl] just wrote '.$cool.' a blog titled [iurl='.$link.']'.stripslashes($shoutName).'[/iurl]'; $database->setQuery("INSERT INTO #__liveshoutbox (time,name,text,url) VALUES ('".time()."','Reviews','".mysql_real_escape_string($shout)."','".$link."')"); $res = $database->query(); } ELSEIF ($data->option == "com_myblog") { $strSQL1 = "SELECT `title` FROM #___content WHERE `id`='{$data->contentid}'"; $this->cms->db->query($strSQL1); $shoutName = $this->cms->db->get_value(); } ELSE { $newid = "999"; $shout='[iurl='.sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$this->cms->user->id.'&Itemid=140').']'.$this->cms->user->name.'[/iurl] just wrote '.$newid.' a blog titled [iurl='.$link.']'.stripslashes($shoutName).'[/iurl]'; $database->setQuery("INSERT INTO #__liveshoutbox (time,name,text,url) VALUES ('".time()."','Reviews','".mysql_real_escape_string($shout)."','".$link."')"); $res = $database->query(); } ?>
  8. Im not sure what you mean by "And"... Well at the moment it brings up a box with all the id's and the values. I want to be able to use those values in a PHP mail function... but cant see how to? function showValues(form){ var values = ''; var len = form.length - 1; //Leave off Submit Button for(i=0; i<len; i++){ if(form[i].id.indexOf("C")!=-1||form[i].id.indexOf("B")!=-1)//Skip Continue and Back Buttons continue; values += form[i].id; values += ': '; values += form[i].value; values += '\n'; } alert(values); }
  9. Hey, I have a script that gets a whole bunch of values over a couple of pages, and this is how it output's at the moment. function showValues(form){ var values = ''; var len = form.length - 1; //Leave off Submit Button for(i=0; i<len; i++){ if(form[i].id.indexOf("C")!=-1||form[i].id.indexOf("B")!=-1)//Skip Continue and Back Buttons continue; values += form[i].id; values += ': '; values += form[i].value; values += '\n'; } alert(values); } [code] Im trying to get these values to something I could use in a PHP Mail function, so I can let the owner of the site see what the user selected, in the email the mailer sends him. Alternatively, if I could insert them into a database that would also be fine.. Any advice on how I would go about this? Thanks Chris [/code]
  10. I been looking around, and in the PHP manual its the same as I have there? foreach ($arr as $value) { echo "Value: $value<br />\n"; } Really cant figure out where to remove them
  11. Thanks for the help, much appreciated, but im still quite new to this and not sure what exactly to do, gave it a try but still same error..
  12. Ok I get some errors now, Parse error: syntax error, unexpected T_ELSE in /usr/www/users/taxmon/test.php on line 14 Something wrong with the else statement?
  13. Hey, I cant figure out in this contact form script the recipient email will be? Where would I enter the person receiving the mail's address? Thanks alot, Chris <? Error_Reporting(E_ALL & ~E_NOTICE); while ($request = current($_REQUEST)) { if (key($_REQUEST)!='recipient') { $pre_array=split ("&777&", $request); $post_vars[key($_REQUEST)][0]=$pre_array[0]; $post_vars[key($_REQUEST)][1]=$pre_array[1]; } next($_REQUEST); } reset($post_vars); $subject="From ".$post_vars['your_name'][0] ; $headers= "From: ".$post_vars['your_email'][0] ."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; $message=''; while ($mess = current($post_vars)) { if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) { $message.="<strong>".$mess[1]."</strong> ".$mess[0]."<br>"; } next($post_vars); } mail($_REQUEST['recipient'], $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> ".$message." </body> </html>" , $headers); echo ("Your message was successfully sent!"); ?> <script> resizeTo(300, 300); </script>
  14. Ok ive even simplified it, and it still wont work for me when I load the page.. it just shows a blank page as you can see here.. http://taxmon.designrobot.co.za/test.php Im really desperate to get this code working, really would appreciate any advice <body> <?php $thisPage = ( isset($_POST['showpage']) and ctype_digit($_POST['showpage'])? $_POST['showpage'] : '1' ); if ( $thisPage == '7' ) { // This is the last page - show/process results here foreach( $_POST as $name => $value ) { print "$name - $value<br>"; } else { // Other page - Create form and hidden inputs print '<form method="post" action="'.$_SERVER['php_SELF'].'">'; foreach ( $_POST as $name => $value ) { print '<input type="hidden" name="'.$name.'" value="'.$value.'">'; switch ( $thisPage ) { case '6': print '<input type="hidden" name="showpage" value="7">'; // Put PAGE 4 inputs here // END PAGE 6 break; case '5': print '<input type="hidden" name="showpage" value="6">'; // Put PAGE 4 inputs here // END PAGE 5 break; case '4': print '<input type="hidden" name="showpage" value="5">'; // Put PAGE 4 inputs here // END PAGE 4 break; case '3': print '<input type="hidden" name="showpage" value="4">'; // Put PAGE 3 inputs here // END PAGE 3 break; case '2': print '<input type="hidden" name="showpage" value="3">'; // Put PAGE 2 inputs here // END PAGE 2 break; case '1': default: print '<input type="hidden" name="showpage" value="2">'; // Start PG 1 print "hello"; // END PG 1 break; } print '</form>'; } ?> </body>
  15. So if i remove the default; will it execute the table code? I intend to put more tables into the other cases, and then at the end print all the input data on case 7... Does the thought behind it work?
  16. Hey, I have the following piece of code, please could someone tell me if they can see any problems with it? Will echo "table code"; work in the case'1' ? Really need to get this working!! Thanks in advance <body> <?php $thisPage = ( isset($_POST['showpage']) and ctype_digit($_POST['showpage'])? $_POST['showpage'] : '1' ); if ( $thisPage == '7' ) { // This is the last page - show/process results here foreach( $_POST as $name => $value ) { print "$name - $value<br>"; echo "Your quote was generated successfully. It has been sent to Tax Monitor and one of our representatives will contact you with further details."; } else { // Other page - Create form and hidden inputs print '<form method="post" action="'.$_SERVER['php_SELF'].'">'; foreach ( $_POST as $name => $value ) { print '<input type="hidden" name="'.$name.'" value="'.$value.'">'; switch ( $thisPage ) { case '6': print '<input type="hidden" name="showpage" value="5">'; // Put PAGE 4 inputs here // END PAGE 6 break; case '5': print '<input type="hidden" name="showpage" value="5">'; // Put PAGE 4 inputs here // END PAGE 5 break; case '4': print '<input type="hidden" name="showpage" value="5">'; // Put PAGE 4 inputs here // END PAGE 4 break; case '3': print '<input type="hidden" name="showpage" value="4">'; // Put PAGE 3 inputs here // END PAGE 3 break; case '2': print '<input type="hidden" name="showpage" value="3">'; // Put PAGE 2 inputs here // END PAGE 2 break; case '1': default: print '<input type="hidden" name="showpage" value="2">'; // Start PG 1 echo "<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableform"> <tr> <td colspan="3" class="tableheader">Contact Details</td> </tr> <tr> <td colspan="3"> </td> </tr> <tr> <td colspan="3"><img src="../imgs/spacer.gif" width="57" height="4" /></td> </tr> <tr> <td width="5%" class="formtext"><img src="../imgs/dialup/bullet.gif" width="10" height="10" /></td> <td width="34%" class="formtext">Full Name: </td> <td width="61%"><input type="text" name="textfield" class="textbox"/></td> </tr> <tr> <td class="formtext"><img src="../imgs/dialup/bullet.gif" width="10" height="10" /></td> <td class="formtext">Email Address: </td> <td><input name="textfield2" type="text" class="textbox" /></td> </tr> <tr> <td class="formtext"><img src="../imgs/dialup/bullet.gif" width="10" height="10" /></td> <td class="formtext">Contact Number: </td> <td><input name="textfield3" type="text" class="textbox" /></td> </tr> <tr> <td class="formtext"><img src="../imgs/dialup/bullet.gif" width="10" height="10" /></td> <td class="formtext">Company:</td> <td><input name="textfield4" type="text" class="textbox" /></td> </tr> <tr> <td> </td> <td height="18"><img src="../imgs/spacer.gif" width="57" height="2" /></td> <td> </td> </tr> </table>"; // END PG 1 break; } print '</form>'; } ?> </body>
  17. Hello Can anyone PLEASE tell me what is wrong with this code below? It uploads the images, but not to the made directory called $name, and it inserts all SQL fine, just the upload to the specific directory isnt working? Please really desperate Thanks Chris <? require_once("db.php"); while(list($key,$value) = each($_FILES[images][name])) { if(!empty($value)) { $name2 = $_POST['$name']; $filename = $name2; mkdir("../women/$name2", 0777); $add = "../women/$name2/$filename"; //echo $_FILES[images][type][$key]; // echo "<br>"; copy($_FILES[images][tmp_name][$key], $add); chmod("$add",0777); } } if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("capetown_a", $con); $sql="INSERT INTO women (name, height, weight, chest, eyes, hair) VALUES ('$_POST[name]','$_POST[height]','$_POST[weight]', '$_POST[chest]', '$_POST[eyes]', '$_POST[hair]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } $name2 = $_GET['$name']; echo "Model Added - Check to see if she is valid! - $name - $name2"; ?>
  18. Hey I am puzzling about something, I am looking to make a page read from a table, and display the entries in tabular format, 5 colums by 2 rows, but cant figure out the code, looked for tutorials and things but cant seem to find anything? Can anyone give me a starting point and ill try figure out the rest? Thanks alot, much appreciated Chris
  19. Hey, Getting this error from my login.php, anyone know why it might be happening? Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/remember/public_html/admin/login.php:1) in /home/remember/public_html/admin/login.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/remember/public_html/admin/login.php:1) in /home/remember/public_html/admin/login.php on line 2 Welcome to the remember online administration section..Please login... Then displays the fields... Thanks alot, Chris <?php session_start(); include "db.php"; if ($_GET["op"] == "login") { if (!$_POST["username"] || !$_POST["password"]) { die("You need to provide a username and password to access this page. This is a restricted area. Information Logged."); } $q = "SELECT * FROM `remusers` " ."WHERE `username`='".$_POST["username"]."' " ."AND `password`='".$_POST["password"]."' " ."LIMIT 1"; $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { $_SESSION["valid_id"] = $obj->id; $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time(); $username = $_POST["username"]; setcookie("admin",1); Header("Location: admin.php"); } else { die("Sorry, could not log you in. Wrong login information."); } } else { echo "Welcome to the remember online administration section.."; echo "Please login..."; echo "<form action=\"?op=login\" method=\"POST\">"; echo "Username: <input name=\"username\" size=\"15\"><br />"; echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />"; echo "<input type=\"submit\" value=\"Login\">"; echo "</form>"; } ?>
  20. Thanks that worked but now it displays this code like this (4 entries of each record): http://www.capetownalive.co.za/patrick/display1.php Not really displaying properly.. <?php include("db.php"); $sql = "SELECT * FROM uploaddb"; $data = mysql_query($sql); while($record = mysql_fetch_assoc($data)) { $id = $record['id']; $name1 = $record['name1']; $desc1 = $record['desc1']; $publisher = $record['publisher']; $dir = "uploads/"; // Open a known directory, and proceed to read its contents echo "Current Documents:"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file!='.' && $file!='..') { echo "<table width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#999999\"> <tr> <td width=\"12%\" rowspan=\"2\" valign=\"top\"><img src=\"file.png\" width=\"94\" height=\"78\"></td> <td height=\"64\" colspan=\"2\" valign=\"top\"><strong>$name1</strong> $desc1</td> </tr> <tr> <td width=\"75%\" valign=\"top\">Publisher<strong>:</strong> $publisher</td> <td width=\"13%\" valign=\"top\"><a href=\"$file\">Download</td> </tr> </table> "; } } closedir($dh); } } } ?>
  21. Hey, I have this form that when I add the following bit into the big piece of code at the bottom: Parse error: parse error, unexpected $ in /home/capetown/public_html/patrick/display1.php on line 37 Anyone know why? include("db.php"); $sql = "SELECT * FROM uploaddb"; $data = mysql_query($sql); while($record = mysql_fetch_assoc($data)) { $id = $record['id']; $name1 = $record['name1']; $desc1 = $record['desc1']; $publisher = $record['publisher']; <?php include("db.php"); $sql = "SELECT * FROM uploaddb"; $data = mysql_query($sql); while($record = mysql_fetch_assoc($data)) { $id = $record['id']; $name1 = $record['name1']; $desc1 = $record['desc1']; $publisher = $record['publisher']; $dir = "uploads/"; // Open a known directory, and proceed to read its contents echo "Current Documents:"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file!='.' && $file!='..') { echo "<table width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#999999\"> <tr> <td width=\"12%\" rowspan=\"2\" valign=\"top\"><img src=\"file.png\" width=\"94\" height=\"78\"></td> <td height=\"64\" colspan=\"2\" valign=\"top\"><strong>$name1</strong><br> $desc1</td> </tr> <tr> <td width=\"75%\" valign=\"top\">Publisher<strong>:</strong> $publisher</td> <td width=\"13%\" valign=\"top\"><a href=\"$file\">Download</a></td> </tr> </table><br>"; } } closedir($dh); } } ?>
  22. The file CTA Domains.txt has been uploadedUpload Successful: Name: CTA Domains.txt Description: INSERT INTO uploaddb (id,name,desc1) VALUES ('NULL', 'CTA Domains.txt', '')
  23. Hey This form just wont insert the posted $desc1 into the database, not sure why can anyone spot an error pls? Thanks upload.html <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> Description: </b><input type="text" name="desc1" size="40" maxlength="80" value="" /> <input type="submit" value="Upload File" /> </form> uploader.php <?php /* Created on: 7/27/2007 */ ?> <html> <body> <?php include "db.php"; $target_path = "uploads/"; $name = basename( $_FILES['uploadedfile']['name']); $desc1 = $_POST["desc1"]; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } $addoffer = MYSQL_QUERY("INSERT INTO uploaddb (id,name,desc1) VALUES ('NULL', '$name', '$desc1')") or die (mysql_error ()); echo "Upload Successful:<br>"; echo "Name: $name<br>"; echo "Description: $desc1<br>"; ?> </body> </html>
×
×
  • 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.