Jump to content

lingo5

Members
  • Posts

    426
  • Joined

  • Last visited

Everything posted by lingo5

  1. Hi, I have a "tell a friend script" that opens a popup using javascript. The script posts opens a popup containig a form like this: var source = "friend_form.php"; My problem is that I need to also pass a URL parameter like so: var source = "friend_form.php?id_property='<?php echo $row_properties_RS['id_property]?>'"; but it doesn't seem to work as the popup does not get the id_property passed. I know I'm doing something wrong but can't figure it out Thanks
  2. Thanks MrMarcus...works fine
  3. Thanks Thorpe, this is my code modified to send email as html...i'm definately doing something wrong because the link still doesn't appear as a link on the email. <?php $fromName=$_REQUEST["fromName"]; $fromEmail=$_REQUEST["fromEmail"]; $idPropiedad=$_REQUEST["id_propiedad"]; $toName=$_REQUEST["toName"]; $toEmail=$_REQUEST["toEmail"]; if ($fromEmail) { $ref = "<a href='http://www.sitename.com/propiedad_detalle.php?id_propiedad=$idPropiedad'>here</a>"; if ($fromName=='') $subject= "Your friend has referred you this link from www.sitename.com"; else $subject= "$fromName has referred you this link from www.sitename.com"; $message = " Dear $toName,\r\nYour friend $fromName has referred this link to you.\r\nPlease visit this link by clicking $ref "; $from = "From: $fromEmail\r\n"; //*** Uniq id Session ***// $strSid = md5(uniqid(time())); $strHeader = ""; $strHeader .= "$fromEmail\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n"; $strHeader .= "Cc: \r\n"; $strHeader .= "Bcc: \r\n"; $strHeader .= "MIME-Version: 1.0\n"; $strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n"; $strHeader .= "This is a multi-part message in MIME format.\n"; $strHeader .= "--".$strSid."\n"; $strHeader .= 'Content-Type: text/html; charset=iso-8859-1'.$eol; $strHeader .= "Content-Transfer-Encoding: 7bit\n\n"; $flgSend = @mail($toEmail, $subject, $message, $from); // @ = No Show Error // if($flgSend) { header("Location: ../index.php?formsentok=true"); } //echo "Mail send completed."; //} else { header("Location: ../index.php?formfailed=true"); } } ?> please help...
  4. sorry I mean the email I get doe not contain the clickable link to the record, but the URL including HTML tags.
  5. oops...thatks zane you're right I was missing a curly... But still not getting the link to the record on the email...all I get is: Please visit this link by clicking <a href='http://www.sitename.com/propiedad_detalle.php?id_propiedad='>link</a>
  6. Thanks thorpe, I have set the script to send in html format like so: <?php $fromName=$_REQUEST["fromName"]; $fromEmail=$_REQUEST["fromEmail"]; $toName=$_REQUEST["toName"]; $toEmail=$_REQUEST["toEmail"]; if ($fromEmail) { $ref = "<a href='http://www.sitename.com/propiedad_detalle.php?id_propiedad=$idPropiedad'>link</a>"; if ($fromName=='') $subject= "Your friend has referred you this link from www.sitename.com"; else $subject= "$fromName has referred you this link from www.sitename.com"; $message = " Dear $toName,\r\nYour friend $fromName has referred this link to you.\r\nPlease visit this link by clicking $ref "; $from = "From: $fromEmail\r\n"; //*** Uniq id Session ***// $strSid = md5(uniqid(time())); $strHeader = ""; $strHeader .= "$fromEmail\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n"; $strHeader .= "Cc: \r\n"; $strHeader .= "Bcc: [email protected],[email protected]\r\n"; $strHeader .= "MIME-Version: 1.0\n"; $strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n"; $strHeader .= "This is a multi-part message in MIME format.\n"; $strHeader .= "--".$strSid."\n"; $strHeader .= 'Content-Type: text/html; charset=iso-8859-1'.$eol; $strHeader .= "Content-Transfer-Encoding: 7bit\n\n"; $strHeader .= $message."\n\n"; $flgSend = @mail($toEmail, $subject, $message, $from); // @ = No Show Error // if($flgSend) { header("Location: ../index.php?formsentok=true"); } //echo "Mail send completed."; //} else { header("Location: ../index.php?formfailed=true"); } ?> but get the following error Parse error: syntax error, unexpected $end in /usr/home/sitename.com/web/test/processors/referer.php on line 45 Line 45 is the last line!!
  7. Hi, I have this "tell a friend" form: <form name=refer action="processors/referer.php" method="POST"><td align="center" valign="middle"><table width="600" border="0" cellspacing="0" cellpadding="0"><tr> <td height="30" colspan="2"><strong> Tus datos <input name="id_propeidad" type="hidden" id="id_propeidad" value="<?php echo $row_destacadas_RS['id_propiedad']; ?>" /> <input name="tipopropiedad" type="hidden" id="tipopropiedad" value="<?php echo $row_destacadas_RS['tipopropiedad']; ?>" /> </strong> <input name="regimen" type="hidden" id="regimen" value="<?php echo $row_destacadas_RS['regimen']; ?>" /> <input name="localidad" type="hidden" id="localidad" value="<?php echo $row_destacadas_RS['localidad']; ?>" /> <input name="isla" type="hidden" id="isla" value="<?php echo $row_destacadas_RS['isla']; ?>" /></td></tr> <tr><td height="30"> tu nombre:<input name="fromName" type="text" id="fromName"></td><td height="30"> tu email:<input name="fromEmail" type="text" id="fromEmail"></td></tr> <tr><td height="30" colspan="2"><strong> Datos de tu amigo</strong></td></tr><tr><td height="30"> su nombre:<input name="toName" type="text" id="toName"></td><td height="30"> tu email:<input name="toEmail" type="text" id="toEmail"></td></tr><tr align="center"><td height="30" colspan="2"> <input type="submit" name="Submit" value="Refer"></td></tr> </table></td></form> and this is the referer script that sends the email: <?php $fromName=$_REQUEST["fromName"]; $fromEmail=$_REQUEST["fromEmail"]; $toName=$_REQUEST["toName"]; $idPropiedad=$_REQUEST["id_propiedad"]; $toEmail=$_REQUEST["toEmail"]; if ($fromEmail) {$ref=(http:www/sitename/propiedad_detalle.php?id_propiedad=$idPropiedad); if ($fromName=='') $subject= "Your friend has referred you this link from www.sitename.com"; else$subject= "$fromName has referred you this link from www.sitename.com"; $message = "Hola $toName, tu amigo $fromName te recomienda que mires esta propiedad.\r\nPuedes verla aquĆ­ $ref "; $from = "Desde: $fromEmail\r\n"; mail($toEmail, $subject, $message, $from); header ("location:".$ref); }?> The email is sent ok except for this part: if ($fromEmail) { $ref=(http:www.sitename/propiedad_detalle.php?id_propiedad=$idPropiedad); This needs to be a link back to the property record, but all I get on the email is http://www.sitename.com/propiedad_detalle.php?id_propiedad=$idPropiedad Thanks
  8. OK, here's how I did it and it works.... GetSQLValueString($_POST['precio_oferta'] ? "'{$_POST['precio_oferta']}'" : "precio_oferta"), Is this a correct way of doing this?
  9. thanks kays, yes that's right, I want to do that. I need to check if the "precio_oferta" field is empty. If so, I want the column "precio_oferta" to stay as it is. How can I do this?...any code eamples? Thanks
  10. thanks, but how do I do that?
  11. Hi, I have a MySQL query that inserts some values like so: $insertSQL = sprintf("INSERT INTO t_propiedades (regimen, localidad, isla, tipopropiedad, zona, amueblado, habitaciones, estado, baƱos, cocina, salon, terraza, aseos, metros, descripcion, precio, precio_oferta, oferta, novedad, destacada) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['regimen'], "text"), GetSQLValueString($_POST['localidad'], "text"), GetSQLValueString($_POST['isla'], "text"), GetSQLValueString($_POST['tipopropiedad'], "text"), GetSQLValueString($_POST['zona'], "text"), GetSQLValueString(isset($_POST['amueblado']) ? "true" : "", "defined","1","0"), GetSQLValueString($_POST['habitaciones'], "text"), GetSQLValueString($_POST['estado'], "text"), GetSQLValueString($_POST['baos'], "text"), GetSQLValueString($_POST['cocina'], "text"), GetSQLValueString($_POST['salon'], "text"), GetSQLValueString($_POST['terraza'], "text"), GetSQLValueString($_POST['aseos'], "text"), GetSQLValueString($_POST['metros'], "text"), GetSQLValueString($_POST['descripcion'], "text"), GetSQLValueString($_POST['precio'], "double"), GetSQLValueString($_POST['precio_oferta'], "double"), GetSQLValueString(isset($_POST['oferta']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['novedad']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['destacada']) ? "true" : "", "defined","1","0")); mysql_select_db($database_MySQLconnect, $MySQLconnect); $Result1 = mysql_query($insertSQL, $MySQLconnect) or die(mysql_error()); what I want to do is when the $_POST['precio_oferta'] is left blank in the insert form, the value that is already on the DB remains instead of being deleted as it is at the moment. My database sets the valur to 0 by default, but when a record is inserted, the 0 gets deleted and set to blank...which sucks. Thanks
  12. Thanks Jesirose !!!! that works perfect.
  13. I am doing that here <a href="index.php?search=true"><img src="img/buscado_palabr_tab_off.png" width="147" height="30" border="0" /></a> This is the error I get Parse error: parse error, expecting `'('' in C:\wamp\www\mysite\index.php on line 9 being line 9 this: isset($_GET['search']);
  14. I am doing that here <a href="index.php?search=true"><img src="img/buscado_palabr_tab_off.png" width="147" height="30" border="0" /></a>
  15. I have a sneaking suspicion when OP refers to "header" he is talking about html content(like different top of the page menu/links), not http request/response headers. I have tried this <?php if isset($_GET['search']); { require_once('header_2.php'); } else { require_once('header.php'); } ?> but nothing....
  16. yes that's right...I'm trying to echo a different top of page
  17. Hi, I have a link on my page like so: <a href="index.php?search=true"><img src="img/buscado_palabr_tab_off.png" width="147" height="30" border="0" /></a> I need my index.php page to display header.php by default or header_2.php when the user clicks on the link above. This is my index.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <?php if isset($_GET['search']); { echo 'header_2.php'; } else { echo 'header.php'; } ?> <body> </body> </html> ...this code is not working....what am I doing wrong? Many thanks
  18. Thanks wigwambam !!! I did that and it works perfect.
  19. Hi, I am uploading an image to a folder and I need to display the uploaded image in a new page. This is my code for the upload: <?php //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","2000000"); //This function reads the extension of the file. It is used to determine if the // file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no // error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; //checks if the form has been submitted if(isset($_POST['upload'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and // will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Tipo de imagen no permitido.</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>La imagen es demasiado grande.</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images //folder) $newname="banners/".$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Error al subir la imagen.</h1>'; $errors=1; }}} //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { echo "<h1>La imagen se ha cargado correctamente</h1>"; } $query = "INSERT INTO banner_rotator.t_banners (banner_path) ". "VALUES ('$newname')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); //echo "<br>Files uploaded<br>"; header("Location: PC_cropbanner.php"); } Sowhat I need to do is to display the uploaded image in PC_cropbanner.php. How can I do this?
  20. Thanks a lot for your help smerny...but I was just being blind. I forgot to loop through the images in the banners dir....duh This is how I got it to work: <?php //path to directory to scan. i have included a wildcard for a subdirectory $directory = "banners/"; //get all image files with a .jpg extension. $images = glob("" . $directory . "*.jpg"); $imgs = ''; // create array foreach($images as $image){ $imgs[] = "$image"; } //shuffle array shuffle($imgs); //select first 20 images in randomized array $imgs = array_slice($imgs, 0, 20); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="js/jquery.nivo.slider.pack.js" type="text/javascript"></script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link rel="stylesheet" href="themes/default/default.css" type="text/css" media="screen" /> <link rel="stylesheet" href="themes/pascal/pascal.css" type="text/css" media="screen" /> <link rel="stylesheet" href="themes/orman/orman.css" type="text/css" media="screen" /> <link rel="stylesheet" href="rotator_css/nivo-slider.css" type="text/css" media="screen" /> <link rel="stylesheet" href="rotator_css/style.css" type="text/css" media="screen" /> </head> <body> <div id="wrapper"> <a href="http://dev7studios.com" id="dev7link" title="Go to dev7studios">dev7studios</a> <div class="slider-wrapper theme-default"> <div class="ribbon"></div> <div id="slider" class="nivoSlider"> <?php foreach ($imgs as $img) { echo "<img src='$img' /> "; } ?> </div> <div id="htmlcaption" class="nivo-html-caption"> <strong>This</strong> is an example of a <em>HTML</em> caption with <a href="#">a link</a>. </div> </div> </div> <script type="text/javascript"> $(window).load(function() { $('#slider').nivoSlider(); }); </script> </body> </html>
  21. ooops ...thanks smerny, that fixed part of the problem. The thing is that my banner rotator is now rotating just the first image.....I want it to rotate all images in the "banners" dir.
  22. Hi smerny, is this what you mean? <img src="<?php echo $imgs />" alt="" /> // this is where my images should go
  23. Hi, I have this PHP script tha displays all images in a given directory: <?php //path to directory to scan. i have included a wildcard for a subdirectory $directory = "banners/"; //get all image files with a .jpg extension. $images = glob("" . $directory . "*.jpg"); $imgs = ''; // create array foreach($images as $image){ $imgs[] = "$image"; } //shuffle array shuffle($imgs); //select first 20 images in randomized array $imgs = array_slice($imgs, 0, 20); //display images foreach ($imgs as $img) { echo "<img src='$img' /> "; } ?> This works fine. My problem is when I try to use the $img var in the following Jquery banner rotator: <body> <div id="wrapper"> <a href="http://dev7studios.com" id="dev7link" title="Go to dev7studios">dev7studios</a> <div class="slider-wrapper theme-default"> <div class="ribbon"></div> <div id="slider" class="nivoSlider"> <img src="<?php echo $img />" alt="" /> // this is where my images should go </div> <div id="htmlcaption" class="nivo-html-caption"> <strong>This</strong> is an example of a <em>HTML</em> caption with <a href="#">a link</a>. </div> </div> </div> <script type="text/javascript"> $(window).load(function() { $('#slider').nivoSlider(); }); </script> </body> The Jquery script is premade but quite simple. Please can anyone tell me how I could do this? Thanks
  24. Thanks Drummin!! I don't know why I was trying to make it so complicated....
×
×
  • 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.