Jump to content

scarhand

Members
  • Posts

    382
  • Joined

  • Last visited

Everything posted by scarhand

  1. i have 3 tables: 1 contains people with their city (comes from other table) and the range (int, 1-20) they want to be found in (in miles) 1 contains cities and the beginning of the postcode (i.e. BB2) 1 contains cities and their logitudes/latitudes what i am trying to do is select the people according to a postcode someone enters. if this postcode is for a city within their range then the person should be selected from the DB. i have this php code: // Latitude calculation $limit = (1 / 69.1703234283616) * $radius; $latitude_min = $latitude - $limit; $latitude_max = $latitude + $limit; // Longitude calculation $limit = (1 / (69.1703234283616 * cos($userLat * (pi/180)))) * $radius; $longitude_min = $longitude - $limit; $longitude_max = $longitude + $limit; now heres the hard part. i dont know how i am going to select the people from the DB, depending on what postcode was entered and their range. can someone help me out a little here?
  2. so a bunch of PHP files have been changed some of the code at the bottom has been cut off and they all have a display: none iframe after the <body> tag i did some reading and was informed it is the HTML Framer virus. they all point to the same site, and when i visit it, its some car web site on a russian domain name. now i am wondering how exactly did this happen?
  3. You're declaring the same function twice. Also, echo " <meta http-equiv=Refresh content=0;url=index.php> "; Should be: header('Location: index.php');
  4. I opened the file in internte explorer and its a red X. I opened it in windows photo gallery and it tells me "the image is damaged or corrupted". But the image is the same size as the one I used fwrite on.
  5. im trying to get an image from a remote URL and write it to a local folder now it gets the image, but the image is always corrupt.... code: $sql = mysql_query("select * from prods order by id asc limit 1"); while ($row = mysql_fetch_assoc($sql)) { $imgo = $row['img']; $imgo = str_replace('product/', '', $imgo); $imgu = "http://www.imgsite.com/$img"; $content = file_get_contents($imgu); $dir = dirname($_SERVER['SCRIPT_FILENAME']) . '/img'; $fp = fopen($dir . '/' . $imgo, 'w'); fwrite($fp, $content); fclose($fp); }
  6. This is not working: (the postdate field stores a time integer via the php time() function) $month = 'July'; $year = '2009'; $sql = mysql_query("select * from rss where date_format(postdate, '%M %Y')='$month $year' order by postdate desc");
  7. Clear your cache. You probably got your cookies stacked while developing. Clear your browser cache and it should work now.
  8. Trying to get fields from a mysql table into variables prefixed with $my So I want the 'username' value to be stored under a variable called $myusername Heres code: while ($row = mysql_fetch_assoc($sql)) { foreach ($row as $f => $v) $my{$f} = $v; }
  9. nevermind i had to clear my ie8 cache because it stacked when i was working on things it works fine
  10. keep in mind that the forgot pass reset page is being access AFTER i have visited this page: <?php if (!$loggedin) header("Location: $url"); session_destroy(); setcookie('username', '', time() - 1); setcookie('password', '', time() - 1); ?>
  11. this is rediculous, my cookies are being remembered for the forgot password reset page, but no other page heres my code for the session.php that is on top of all php files: <?php if (isset($_POST['luser'])) // has the header login form been posted? { foreach ($_POST as $field => $value) $$field = htmlspecialchars(trim($value), ENT_QUOTES); $lpassmd5 = md5($lpass); if (mysql_result(mysql_query("select count(*) from users where username='$luser' and password='$lpassmd5'"), 0) != 0) { $_SESSION['username'] = $luser; $_SESSION['password'] = $lpassmd5; setcookie('username', $luser, time() + (365 * 24 * 60 * 60)); setcookie('password', $lpassmd5, time() + (365 * 24 * 60 * 60)); } else { $lerror = 'Invalid username and/or password'; } } else { $luser = 'Username'; $lpass = 'Password'; } if (isset($_SESSION['username'])) { $cuser = $_SESSION['username']; $cpass = $_SESSION['password']; } else if (isset($_COOKIE['username'])) { $cuser = $_COOKIE['username']; $cpass = $_COOKIE['password']; } $loggedin = false; if (isset($cuser)) { $sql = mysql_query("select * from users where username='$cuser' and password='$cpass'"); if (mysql_num_rows($sql) != 0) { while ($row = mysql_fetch_assoc($sql)) { $myid = $row['id']; $myusername = $row['username']; $mypassword = $row['username']; $mypoints = $row['points']; $loggedin = true; } } } ?> heres my code for the forgot password reset page: <?php if ($loggedin) header("Location: $url"); $id = $_GET['id']; $hash = $_GET['hash']; if (mysql_result(mysql_query("select count(*) from users where id='$id' and forgotpass='$hash'"), 0) != 0) { $newpass = substr($hash, 2, 5); $newpassmd5 = md5($newpass); $forgotpass = md5($newpassmd5); mysql_query("update users set password='$newpassmd5', forgotpass='$forgotpass' where id='$id'"); } else { die('problem'); } ?>
  12. i have an enormous site/server and im trying to do an alter table command every time i try and run this sql, the server dies can i just use copy/rename or is there a proper way of doing this for large servers?
  13. i have a problem when i edit some files that other people have edited in dreamweaver, etc. download them from FTP and open them, the formatting is all double-line spaced etc. then when i save the file all the content goes onto a single line. i am using notepad2. how do i stop this from happening?
  14. heres my example: #theul { margin: 0px; padding: 0px; list-style-type: none; } #theul li { float: left; } #theul li a { display: block; } <ul id="theul"> <li><a href="#">horizontal menu item 1</a></li> <li><a href="#">horizontal menu item 1</a></li> <li><a href="#">horizontal menu item 1</a></li> </ul> How do I get this menu perfectly centered on the page, for a dynamic width?
  15. css: #menu { float: right; margin-top: 40px; background: url(images/mbg.jpg); } #ml { background: url(images/ml.jpg) no-repeat top left; } #mr { background: url(images/mr.jpg) no-repeat top right; } #mr ul { margin: 0px; padding: 0px; list-style-type: none; } #mr li { float: left; padding: 0px 10px; font-size: 8pt; } #mr li a { display: block; line-height: 30px; color: #ffffff; text-decoration: none; } #mr li a span { display: block; padding: 0px 10px; } #mr li a:hover { background: url(images/mhl.jpg) no-repeat top left; color: #000000; } #mr li a:hover span { background: url(images/mhr.jpg) no-repeat top right; } .ms { background: url(images/ms.jpg) no-repeat top right; } html: <div id="menu"> <div id="ml"> <div id="mr"> <ul> <li class="ms"><a href="index.php"><span>HOME</span></a></li> <li class="ms"><a href="features.php"><span>FEATURES</span></a></li> <li class="ms"><a href="requirements.php"><span>REQUIREMENTS</span></a></li> <li class="ms"><a href="demo-video.php"><span>DEMO VIDEO</span></a></li> <li class="ms"><a href="demo-site.php"><span>DEMO SITE</span></a></li> <li class="ms"><a href="order-now.php"><span>ORDER NOW</span></a></li> <li><a href="contact-us.php"><span>CONTACT US</span></a></li> </ul> <div class="clear"></div> </div> </div> </div> in ie8 and FF this works perfectly, but in ie7 it is not displaying the "ml.jpg" and "mr.jpg" background images to make the corners rounded.
  16. You can not open a new window using PHP. You need to use Javascript.
  17. $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['password']); mysql_query("insert into members (username, password) values ('$username', '$password')");
  18. i ended up just putting the TEXT column in its own table and now the pages execute rediculously faster with 2 queries.
  19. is there a speed difference between TEXT and LONGTEXT when selecting data? im trying to speed up a table.
  20. I'm using this: preg_replace('[ \t\n\r]+', ' ', $string);
×
×
  • 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.