Jump to content

seany123

Members
  • Posts

    1,053
  • Joined

  • Last visited

Everything posted by seany123

  1. really? i think the first option would be the easiest to implement, i would just need convert the county+city+postcode/zip into the lat and long.. im sure there are already examples available of how its done. but how would i then using mysql query filter out using lat+long for distance under $x miles apart?
  2. yes that could work thankyou ill try. the script is a searching for users, i then take 2 fields from the users table $result['city'] and $result['postcode'] and pass them through this function which uses that info+ $users postcode and city and uses google api to return the distance between them in miles: <?php //Function to get the distance between 2 points. can use postcode,cityname or geolocation. function getDistance($from, $to) { $from = urlencode($from); $to = urlencode($to); $data = file_get_contents("http://maps.googleapis.com/maps/api/distancematrix/json?origins=$from&destinations=$to&language=en-EN&sensor=false"); $data = json_decode($data); $distance = 0; foreach($data->rows[0]->elements as $road) { $distance += $road->distance->value; $distance = ($distance * 0.000621371192); } return $distance; } ?> then i filter out the results based on what $distance returns thanks.
  3. Im trying to get the num_rows count of all the rows which have been selected but only after they have been filtered by php, i cant do the filtering through mysql as its requires the values to go through functions. <?php $query = mysqli_query($db, "select * from users"); while ($result = mysqli_fetch_array($query)) { if ($result[0] == custom_function($result[0])) { //remove this row from the $result array? } } ?> i thought about using a $i++ in the while loop to count the records until completion but that wont give me the final count until its run through the entire while loop and if i want to use this for pagination or something similar i wouldn't be able to? sean
  4. thanks yeah i worked it out with loads of tinkering.
  5. can anyone see why this is not working? or how to make it work? im trying to get all the rows where dob is between dob is a date field <?php ​$todayDate = date("Y-m-d"); $minage = date("Y-m-d", strtotime($todayDate . "-18 years")); $maxage = date("Y-m-d", strtotime($todayDate . "-99 years")); $query = mysqli_query($db, "select * from users where `dob` BETWEEN '$minage' AND '$maxage'"); ?> if i replace $minage and $maxage and type in a date manually then it works. any help would be great.
  6. Thanks for the help! i fixed the other problems with PHP $i++ and renaming L1 based on $i very happy with the result!
  7. Thanks for your answer and help! it has helped ALOT!! i tried the method but its not working 100% it does work if i LIMIT 1 on the mysql query, so im assuming its happening because all of the images are wrapped with the same class="showTip L1" which javascript cant determine between. <?php require('main_inc.php'); ?> <html> <head> <style type="text/css"> div#tipDiv { font-size:11px; line-height:1.2; color:#000; background-color:#E1E5F1; border:1px solid #667295; padding:4px; max-width:100%; } /* for divs with classes img and txt used in dw_Tooltip.wrapImageOverText and other image-text formatting functions */ div#tipDiv div.img { text-align:center; margin:4px 0; } div#tipDiv div.txt { text-align:center; margin:4px 0; } </style> <script src="tooltip/js/dw_tooltip_c.js" type="text/javascript"></script> <script type="text/javascript"> dw_Tooltip.defaultProps = { //supportTouch: true, // set false by default wrapFn: dw_Tooltip.wrapImageOverText // or dw_Tooltip.wrapTextOverImage } dw_Tooltip.content_vars = { L1: { <?php $get_all_photos = mysqli_query($db, "select * from photos WHERE user_id='1' and deleted='0'"); $photo_urls = array(); while ($photo = mysqli_fetch_array($get_all_photos)) { $photo_urls[] = $photo['filename']; ?> img: 'photos/<?php echo $photo['filename']; ?>', txt: '<?php echo $photo['caption']; ?>' <?php } ?> }} </script> <?php foreach ($photo_urls as $url){ ?> <a href='' class='showTip L1'><img height='120px' width='120px' src='photos/cropped/cropped_<?php echo $url; ?>'/></a> <?php } ?> </head> </html> this is the source code of the above code all the variables look to have been successfully passed to the js: <html> <head> <style type="text/css"> div#tipDiv { font-size:11px; line-height:1.2; color:#000; background-color:#E1E5F1; border:1px solid #667295; padding:4px; max-width:100%; } /* for divs with classes img and txt used in dw_Tooltip.wrapImageOverText and other image-text formatting functions */ div#tipDiv div.img { text-align:center; margin:4px 0; } div#tipDiv div.txt { text-align:center; margin:4px 0; } </style> <script src="tooltip/js/dw_tooltip_c.js" type="text/javascript"></script> <script type="text/javascript"> dw_Tooltip.defaultProps = { //supportTouch: true, // set false by default wrapFn: dw_Tooltip.wrapImageOverText // or dw_Tooltip.wrapTextOverImage } dw_Tooltip.content_vars = { L1: { img: 'photos/0ab17af02b41816d0515aaa0e7d6d98bc7abe4ff.jpg', txt: '' img: 'photos/48c76fa82f9faa598f5f7691dfc61a61e0c40039.jpg', txt: '' }} </script> <a href='' class='showTip L1'><img height='120px' width='120px' src='photos/cropped/cropped_0ab17af02b41816d0515aaa0e7d6d98bc7abe4ff.jpg'/></a> <a href='' class='showTip L1'><img height='120px' width='120px' src='photos/cropped/cropped_48c76fa82f9faa598f5f7691dfc61a61e0c40039.jpg'/></a> </head> </html>
  8. I want to create a list of images which when the cursor hovers over; another image is displayed so i found this: http://www.dyn-web.com/code/tooltips/ and i created the code below. <html> <head> <script src="tooltip/js/dw_tooltip_c.js" type="text/javascript"></script> <script type="text/javascript"> dw_Tooltip.defaultProps = { //supportTouch: true, // set false by default wrapFn: dw_Tooltip.wrapImageOverText // or dw_Tooltip.wrapTextOverImage } dw_Tooltip.content_vars = { L1: { img: '/new_image.jpg', txt: 'caption to go here' } } </script> <style type="text/css"> div#tipDiv { font-size:11px; line-height:1.2; color:#000; background-color:#E1E5F1; border:1px solid #667295; padding:4px; max-width:100%; } /* for divs with classes img and txt used in dw_Tooltip.wrapImageOverText and other image-text formatting functions */ div#tipDiv div.img { text-align:center; margin:4px 0; } div#tipDiv div.txt { text-align:center; margin:4px 0; } </style> </head> <body> <a href="." class="showTip L1"><img width='120px' height="120px" src="image.jpg" /></a> </body> </html> it works fine with static values but i want to retrieve all of the image urls from my db and display them in a list and then when hovering the image that is shown relates to the value received from the db, so i created the while loop which looks something like this: <?php $get_all_photos = mysqli_query($db, "select * from photos WHERE user_id='1'"); while ($photo = mysqli_fetch_array($get_all_photos)) { $url = "$photo['url']"; ?> <a href='' class="showTip L1"><img src="<?php echo $url;?>"/></a> <?php } ?> how do i now assign the values from the while loop in the javascript above? i have already tried something as simple this: dw_Tooltip.content_vars = { L1: { img: '<?php echo $url;?>', txt: '<?php echo $caption;?>' } if anyone can help that would be awesome thanks
  9. Hello, im new to css and i need a little help creating a navigation bar which is horizontal, i want it to fill its containing divs height. here is the simple html <div id="nav-bar"> <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> </ul> </div> here is the css being used #nav-bar { background-color: #494c51; width: auto; position: relative; height: 44px; border-style: solid; <!-- background-color: #242528; This is the color of the hover --> border-color: #000; border-width: thin; } #nav-bar ul, li { padding: 0; list-style-type: none; display: inline; line-height: 44px; <!-- this aligns the ul/li into the middle virtically --> height: 44px; border-bottom-color: red; border-style: solid; } so #nav bar has a height of 44px which is working, so i assumed i could set height of #nav-bar ul, li to 100% and it would work, but it doesnt, i have also tried putting these values in a new div but that didnt work either. can anyone help me with this? thanks
  10. Hello, is it possible in javascript to press the EscKey after X seconds of website being loaded? How would this be done? thanks seany
  11. Looks really nice awesome job, i am excited to see the main website with this same branding!! awesome work!
  12. yes sorry, what im trying to do is make the referrer look like its coming from somewhere else eg google.com, i have read that article and i will read through it again, im thinking that this maybe isnt possible.
  13. Im not personally trying to trick any websites, i have a client who is wanting to change the referrer and has asked if i can get it done, sorry to be blunt and i don't wish to be rude but im needing help and none of your posts thus far have actually been of any help, if your not able to actually contribute to my problem then i think it would be best you didn't post.
  14. Thank you for your great reply lots of good information which im sure i can make good use of, it seems that the only way to hide the referring URL is if you have control of the files on the domain, this method wouldn't obviously work on domains which i don't own eg. PHPfreaks i was thinking maybe it could be possible to reload another URL on the same Iframe, would that work to give a different referrer URL
  15. Any idea for how i can "spoof" the referer then?
  16. thats why i was asking if it was possible... i didnt know if it could be done or not, are there any more ways to change the referer?
  17. thanks for your reply, i followed that rule already.... the title says "how" and...
  18. Is is possible to embed an Iframe inside another Iframe so the 2nd Iframe thinks the referer is the first Iframe? EG. <iframe src='http://www.google.com'> <iframe src='http://www.phpfreaks.com'></iframe> </iframe> if not how else could i go about doing this?
  19. yes removing the urlencode worked a treat and i no longer get any errors, i didnt wish to change the image names because i currently have over 5k images and although im sure i could create some type of renaming script, this seemed much easier! Thanks! solved
  20. Hmm is there no way to handle that?
  21. after looking into my directory i realised that there was not a image called that... its actually called: CreamCakes_(1).jpg
  22. yes that image exsists and is being displayed just above the error message the file does exist though and is being displayed...
  23. no i dont have firebug or any other inspector, ill look into it though... The image is STILL showing, but its show along with the error. live example in my signature... the error is appearing on every image now, however the images are still displaying.
×
×
  • 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.