Jump to content

frank_solo

Members
  • Posts

    109
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

frank_solo's Achievements

Member

Member (2/5)

0

Reputation

  1. Got it: <?php include "config.php"; $id = mysql_real_escape_string((int)$_GET['id']); $sql = "SELECT id FROM places WHERE id='$id' AND unit='Residential' AND county='New Jersey'"; $result = mysql_query($sql); if(mysql_num_rows($result) >0){ //found }else{ //not found header("location: http://www.mydomian.co"); } $query = "UPDATE `units` SET `views` = `views` + 1 WHERE `id` = $id"; $res = mysql_query($query, $bd); $query = "SELECT * FROM `places` WHERE `id` = $id"; $res = mysql_query($query, $bd); $result = mysql_fetch_assoc($res); $lat = $result['lat']; $contact = $result['contact']; $phone = $result['phone']; $long = $result['lng']; ?>
  2. This worked <?php session_start(); include 'config.php'; $url_id = mysql_real_escape_string($_GET['id']); $sql = "SELECT id FROM places WHERE id='$url_id' AND unit='Residential' AND county='New Jersey'"; $result = mysql_query($sql); if(mysql_num_rows($result) >0){ //found $query="UPDATE `places` SET `views` = `views` + 1 WHERE `id` = $url_id"; }else{ //not found header("location: http://www.mydomain.co"); } ?> But now this won't work $query="UPDATE `units` SET `views` = `views` + 1 WHERE `id` = $url_id"; Can someone show me how to make that statement work or should I start a different thread? Thanks
  3. Well I've done this so far but this helps only if index.php?id=(blank) if (!isset($_GET['id']) || empty($_GET['id'])) { header('location: http://www.mydomain.co') ; } What I would like as well is to query the table and check if the id exist if not to redirect.
  4. I have a question I have page like so: index.php?id=100 but let's say that id=101 is blank Is there a way to redirect the user if that page is empty. Redirect them to homepage. Is this possible and how? Thanks
  5. Ok so I need to first add the variable from the xml file onto to the map: var id = markers[i].getAttribute("id"); Then like kicken said I had the html to include the tag like so: var html = "<b>" + name + "</a></b> <br/>" + address +"<br /><a href='apt.php?id=" + id +"'>View Listing</a><br /><b></b>" ; Thanks for the guidance.
  6. Does anyone know how to make link? let's say one clicks on on a pin and an info window pops up. I would like the the title in the window to become a link to the listing itself. In other words to <a href="apt.php?=<? echo "" . $row['id'] . "";>echo "" . $row['title'] . ""</a> This is what I have: The XML file: <?php require("../config.php"); function parseToXML($htmlStr) { $xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr); $xmlStr=str_replace('"','"',$xmlStr); $xmlStr=str_replace("'",''',$xmlStr); $xmlStr=str_replace("&",'&',$xmlStr); return $xmlStr; } // Opens a connection to a mySQL server $connection=mysql_connect (DB_HOST, DB_USER, DB_PASSWORD); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active mySQL database $db_selected = mysql_select_db(DB_NAME, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM places WHERE unit='Residential' AND county='New Jersey'"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'title="' . $row['title'] . '" '; echo 'id="' . $row['id'] . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'space="' . $row['space'] . '" '; echo 'amount="$' . $row['amount'] . '" '; echo '/>'; } // End XML file echo '</markers>'; ?> The Map: <script type="text/javascript"> //<![CDATA[ var customIcons = { "House": { icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png', shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png' }, }; function load() { var map = new google.maps.Map(document.getElementById("map2"), { center: new google.maps.LatLng(40.9167, -74.1722), zoom: 11, mapTypeId: 'roadmap' }); var infoWindow = new google.maps.InfoWindow; // Change this depending on the name of your PHP file downloadUrl("commphpsqlajax_genxml.php", function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("title"); var address = markers[i].getAttribute("amount"); var type = markers[i].getAttribute("space"); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var html = "<b>" + name + "</b> <br/>" + address; var icon = customIcons[type] || {}; var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon, shadow: icon.shadow }); bindInfoWindow(marker, map, infoWindow, html); } }); } function bindInfoWindow(marker, map, infoWindow, html) { google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(html); infoWindow.open(map, marker); }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} //]]> </script>
  7. I'm already using number_format() it shows the commas but for a number like 1500.53 the 1500 becomes 1,500 but the .53 disappears. Is there a better way?
  8. How do I print isset on this form? Thanks <?php $var = $result['email']; if (!empty($var)) { if (isset($_POST['submit'])) { if(isset($_POST['answer']) && $_POST['answer'] == '2'){ $to = "$var"; // change to your email address $name = htmlspecialchars ($_POST['name']); $email = htmlspecialchars ($_POST['email']); $phone = htmlspecialchars ($_POST['phone']); $msg = htmlspecialchars ($_POST['msg']); $d = date('l dS \of F Y h:i:s A'); $sub = "My Domain RE:".$result['title'].""; $headers = "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "phone: ".$phone."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; mail($to, $sub, $mes, $headers); echo "<div align='center'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>Email Has Been Sent</span></div>"; } else { echo "<div align='center'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>ANSWER does not match! </span></div>"; } } echo "<div align='center'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #00F;'>Email: ".$result['contact']."</span></div> <form method='post' action='apt.php?id=$id' name='contact' onSubmit='return Blank_TextField_Validator()'> <input name='name' type='text' size='40' placeholder='Name' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['name'])."'/><br> <input name='email' type='text' size='40' placeholder='Email' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['email'])."'/><br> <input name='phone' type='text' size='40' placeholder='Phone' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['phone'])."'/><br> <textarea name='msg' cols='29' rows='4' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['msg'])."' id='msg'></textarea><br> <div align='left'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #000;'>What is 2 + 2? </span><br><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #000;'>Answer: </span><input name='answer' type='text' id='answer' size='3' maxlength='3' /><input type='submit' class='button4' value='Send' name='submit' /></div> </form><br><br><br>";}?>
  9. Ok so instead of using captcha code I will be using a question instead. It works but now how can I use print isset on this: <?php $var = $result['email']; if (!empty($var)) { if (isset($_POST['submit'])) { if(isset($_POST['answer']) && $_POST['answer'] == '2'){ $to = "$var"; // change to your email address $name = htmlspecialchars ($_POST['name']); $email = htmlspecialchars ($_POST['email']); $phone = htmlspecialchars ($_POST['phone']); $msg = htmlspecialchars ($_POST['msg']); $d = date('l dS \of F Y h:i:s A'); $sub = "My Domain RE:".$result['title'].""; $headers = "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "phone: ".$phone."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; mail($to, $sub, $mes, $headers); echo "<div align='center'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>Email Has Been Sent</span></div>"; } else { echo "<div align='center'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>ANSWER does not match! </span></div>"; } } echo "<div align='center'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #00F;'>Email: ".$result['contact']."</span></div> <form method='post' action='apt.php?id=$id' name='contact' onSubmit='return Blank_TextField_Validator()'> <input name='name' type='text' size='40' placeholder='Name' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['name'])."'/><br> <input name='email' type='text' size='40' placeholder='Email' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['email'])."'/><br> <input name='phone' type='text' size='40' placeholder='Phone' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['phone'])."'/><br> <textarea name='msg' cols='29' rows='4' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['msg'])."' id='msg'></textarea><br> <div align='left'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #000;'>What is 2 + 2? </span><br><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #000;'>Answer: </span><input name='answer' type='text' id='answer' size='3' maxlength='3' /><input type='submit' class='button4' value='Send' name='submit' /></div> </form><br><br><br>";}?>
  10. I'm having a problem with captcha code. I keep getting the echo message "CAPTCHA CODE does not match!" everytime I send it . What am I not seeing? Please open my eyes to the error. Thanks in advance. <?php session_start(); include "config.php"; $id = (int)$_GET['id']; $res = mysql_query($query, $bd); $id = (int)$_GET['id']; $id = substr($id, 0,5); if($id < 1 || $id > 99999) exit; $query = "SELECT * FROM `units` WHERE `id` = $id"; $res = mysql_query($query, $bd); $result = mysql_fetch_assoc($res); $contact = $result['contact']; $phone = $result['phone']; $var = $result['email']; if (!empty($var)) { if (isset($_POST['submit'])) { if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { $to = "$var"; // change to your email address $name = htmlentities ($_POST['name']); $email = htmlentities ($_POST['email']); $phone = htmlentities ($_POST['phone']); $msg = htmlentities ($_POST['msg']); $d = date('l dS \of F Y h:i:s A'); $sub = "My Domain RE:".$result['title'].""; $headers = "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "phone: ".$phone."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; mail($to, $sub, $mes, $headers); echo "<div align='left'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>Email Has Been Sent</span></div>"; } else { echo "<div align='left'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>CAPTCHA CODE does not match! </span></div>"; } } echo "<div align='left'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #00F;'>Email: ".$result['contact']."</span></div> <form method='post' action='apt.php?id=$id' name='contact''> <input name='name' type='text' size='40' placeholder='Name'/><br> <input name='email' type='text' size='40' placeholder='Email'/><br> <input name='phone' type='text' size='40' placeholder='Phone'/><br> <textarea name='msg' cols='29' rows='4'></textarea><br> <div align='left'><img src='http://www.mydomain.co/CaptchaSecurityImages.php?width=100&height=40& characters=5' alt='captcha' width='75px'/><br><input name='security_code' type='text' id='security_code' /><input type='submit' value='Send' class='button' name='submit' /></div> </form><br><br><br>";}?>
  11. Thanks DaveyK that was the problem don't know why I was doing that. $profile = trim($result['profilepic']);
  12. Trim does not work on this. Am I doing it wrong? Thanks <?php $profile = trim("".$result['profilepic'].""); $pic = !empty($profile) ? "<img src='http://www.mydomain.co/user/".$result['profilepic']." width='100'>" : "<img src=\"http://www.mydomain.co/images/avatar.jpg\" width='100'>";?> <? echo $pic; ?>
  13. I'm having a problem with captcha code. I keep getting the echo message "CAPTCHA CODE does not match!" everytime I send it . What am I not seeing? Please open my eyes to the error. Thanks in advance. <?php session_start(); include "config.php"; $id = (int)$_GET['id']; $res = mysql_query($query, $bd); $id = (int)$_GET['id']; $id = substr($id, 0,5); if($id < 1 || $id > 99999) exit; $query = "SELECT * FROM `units` WHERE `id` = $id"; $res = mysql_query($query, $bd); $result = mysql_fetch_assoc($res); $contact = $result['contact']; $phone = $result['phone']; $var = $result['email']; if (!empty($var)) { if (isset($_POST['submit'])) { if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) { $to = "$var"; // change to your email address $name = htmlentities ($_POST['name']); $email = htmlentities ($_POST['email']); $phone = htmlentities ($_POST['phone']); $msg = htmlentities ($_POST['msg']); $d = date('l dS \of F Y h:i:s A'); $sub = "My Domain RE:".$result['title'].""; $headers = "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "phone: ".$phone."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; mail($to, $sub, $mes, $headers); echo "<div align='left'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>Email Has Been Sent</span></div>"; } else { echo "<div align='left'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>CAPTCHA CODE does not match! </span></div>"; } } echo "<div align='left'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #00F;'>Email: ".$result['contact']."</span></div> <form method='post' action='apt.php?id=$id' name='contact''> <input name='name' type='text' size='40' placeholder='Name'/><br> <input name='email' type='text' size='40' placeholder='Email'/><br> <input name='phone' type='text' size='40' placeholder='Phone'/><br> <textarea name='msg' cols='29' rows='4'></textarea><br> <div align='left'><img src='http://www.mydomain.co/CaptchaSecurityImages.php?width=100&height=40& characters=5' alt='captcha' width='75px'/><br><input name='security_code' type='text' id='security_code' /><input type='submit' value='Send' class='button' name='submit' /></div> </form><br><br><br>";} ?>
  14. I just used it and although it has the same function as the php but that ugly box still appears. Thanks CPD. It is just an eye sore.
×
×
  • 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.