Jump to content

Hooch

Members
  • Posts

    452
  • Joined

  • Last visited

Everything posted by Hooch

  1. Here's the entry for the date field `date` varchar(10) NOT NULL default '00-00-0000', Here is the output for the current query"Garden Tour = 168 Autumn Tour = 153 Winter Tour = 153"I'm more worried about showing the hits for the Autumn and winter tour.These should be zero.The 1st date in the DB is "31-03-2007" and the last (as of now) is "05-04-2007" Thank you kindly for your replies.**EDIT I just edited the entry for the date field `date` date NOT NULL default '0000-00-00', This did not change the results.
  2. This is still out of whack. <?PHP // Entry of date to DB is "date( 'd-m-Y' )" $current = date('Y'); $r = 0; $select1 =0; $r2 = 0; $select2 =0; $r3 = 0; $select3 =0; // Jan 1 - July 31 $select1 = mysql_query(" SELECT `date` FROM stats WHERE `date` BETWEEN '01-01-$current' AND '31-07-$current'") or die(mysql_error()); $r = mysql_num_rows($select1); // Aug 1 - Oct 31 $select2 = mysql_query("SELECT `date` FROM stats WHERE `date` BETWEEN '01-08-$current' AND '31-10-$current'") or die(mysql_error()); $r2 = mysql_num_rows($select2); // Nov 1 - Dec 31 $select3 = mysql_query("SELECT `date` FROM stats WHERE `date` BETWEEN '01-11-$current' AND '31-12-$current'") or die(mysql_error()); $r3 = mysql_num_rows($select3); ?> This is showing hits from the 2nd and 3rd query. And they both are identical. There are not hits past todays date. (Apr 9, 2007) Plus for some reason the 1st query is missing 1 hit.?????
  3. Hello all. I was hoping someone could look at my query. It seems all the echo's are the same. But there are 3 different dates to select from. The printout of the following codes shows 3 hits for each date selection. There should only be 3 for the 1st query. <?PHP // Jan 1 - July 31 $current = date('Y'); $select1 = mysql_query("SELECT date FROM stats WHERE date BETWEEN '01-01-$current' AND '31-07-$current'") or die(mysql_error()); $r = mysql_num_rows($select1); // Aug 1 - Oct 31 $select2 = mysql_query("SELECT date FROM stats WHERE date BETWEEN '01-08-$current' AND '31-10-$current'") or die(mysql_error()); $r2 = mysql_num_rows($select2); // Nov 1 - Dec 31 $select3 = mysql_query("SELECT date FROM stats WHERE date BETWEEN '01-11-$current' AND '31-12-$current'") or die(mysql_error()); $r3 = mysql_num_rows($select3); ?> <tr> <td colspan="3"><b>Unique hits for each tour</b></td> </tr> <tr> <td>Garden Tour = <?PHP echo $r ?> </td> <td>Autumn Tour = <?PHP echo $r2 ?> </td> <td>Winter Tour = <?PHP echo $r3 ?> </td> </tr> <tr> <td>(Jan 1 - July 31)</td> <td>(Aug 1 - Oct 31)</td> <td>(Nov 1 - Dec 31)</td> </tr> Here is my DB for the stats table.The second entry is "date" INSERT INTO `stats` VALUES ('ip goes here', '31-03-2007', 35, '1175397828', 'http://www.tiarts.org/index.php');INSERT INTO `stats` VALUES ('ip goes here', '31-03-2007', 1, '1175392978', 'http://www.tiarts.org/index.php');INSERT INTO `stats` VALUES ('ip goes here', '31-03-2007', 2, '1175395896', 'http://www.tiarts.org/index.php'); Thank you for any help.
  4. I called tech support they say it's client side. So I uploaded Firefox on the second computer and it's still a no go. Time to get the 3rd puter involved. Maybe even the lap top..Update...3rd computer shows the page on both browsers.Update #2I am at work today and all is well here.It has to be my local machine.FYI...I tried changing the code so there was no DB inquiry. I linked to the pictures via straight html. And it still did notwork.Also, notice the links on the left. I added a cpl and my customer (who also cannot see the pictures) cannot seeone of the links I added. He sees the space there though.wierd and whacky stuff.
  5. But why would I see it on one computer in my house, and not another? The IP's here would be very similar.
  6. okay...here's a good one. I got this page working perfectly. So I had my clientcheck out the test page. He doesn't see the pictures. So I fired up my 2nd pc and had a try. Same problem. But I see the pics from IE and FF fine on the PC I coded with. I put a border around the pictures and that even shows up. But still no pictures. I then directly link to a picture frommy second machine and it sends me to a numerical address. h**p://numbers_go_here:1025/clear.cgi? Any ideas??Here is the actual page LINKYThere are 8 pictures in this query.
  7. Hello all. Is it possible to have an entry (from a form that goes to a DB)that will print out line breaks? This would save multiple entries into the DB. I'm using a "text" entry. Thank youHoochEDIT Fixed. I just type <br> when I want the line break.
  8. I have played a little more and have a satisfactory result.Thank you for all the help guys.Hooch
  9. I recoded that 1 post. It now enters the pictures at the top of the table, like firefox. But now it shuffles them over to the left. I coded it to go center. Here is the code <table width="700" height="" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" colspan="2" align="center" class="black-medium"> </td> </tr> <tr> <td width="116" height="" align="left" valign="top"><?php include 'includes/links.php';?></td> <td width="584" height="" align="center" class="vat"> <?PHP $nr_per_row = 2; $nr = 0; $result = mysql_query("SELECT * FROM sponsors WHERE active = 1") or die(mysql_error()); echo '<table width="584" border="1" cellpadding="1" cellspacing="0" bordercolor="#B51628">'; while ($row = mysql_fetch_assoc($result)) { if ($nr % $nr_per_row == 0) echo "<tr valign=\"center\" align=\"center\">"; //output <tr> if this is the first in a row echo "<a href=\"".$row['link']."\"><img name=\"\" src=\"images/sponsors/".$row['id'].".jpg\" width=\"200\" height=\"75\" alt=\"\" border=\"0\"/></a> "; $nr++; if ($nr % $nr_per_row == 0) echo "</tr>"; //output </tr> if this is the last in a row} if ($nr % $nr_per_row != 0) echo "</tr>"; //clean up echo "</table>"; ?> </td> </tr></table> Here is the view source <table width="700" height="" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" colspan="2" align="center" class="black-medium"> </td> </tr> <tr> <td width="116" height="" align="left" valign="top"><table width="116" height="" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="230"> <a href="http://www.com/tia/index.php" class="tia">home</a><br /> <br /> <a href="http://www.com/tia/members/index.php" class="tia">members</a><br /><br /> <a href="http://www.com/tia/tours.php" class="tia">tours</a><br /><br /> <a href='events/March.php' class="tia">events/links</a><br><br> <a href="http://www.com/about.php" class="tia">about us</a><br /><br /> <a href="http://www.com/contact.php" class="tia">contact</a><br /><br /> <a href="http://www.com/sponsor.php" class="tia">sponsors</a><br /> <br /></td> </tr></table></td> <td width="584" height="" align="center" class="vat"> <table width="584" align="center" border="1" cellpadding="1" cellspacing="0" bordercolor="#B51628"><tr valign="center" align="center"><a href="http://#"><img name="" src="images/sponsors/1.jpg" width="200" height="75" alt="" border="0"/></a> <a href="http://#"><img name="" src="images/sponsors/2.jpg" width="200" height="75" alt="" border="0"/></a> </tr><tr valign="center" align="center"><a href="http://#"><img name="" src="images/sponsors/3.jpg" width="200" height="75" alt="" border="0"/></a> <a href="http://#"><img name="" src="images/sponsors/4.jpg" width="200" height="75" alt="" border="0"/></a> </tr><tr valign="center" align="center"><a href="http://#"><img name="" src="images/sponsors/5.jpg" width="200" height="75" alt="" border="0"/></a> <a href="http://#"><img name="" src="images/sponsors/6.jpg" width="200" height="75" alt="" border="0"/></a> </tr><tr valign="center" align="center"><a href="http://#"><img name="" src="images/sponsors/7.jpg" width="200" height="75" alt="" border="0"/></a> </tr></table> </td> </tr></table>
  10. Thanks. I will do the default for future coding for sure. But for now to get this fixed, I willdo the hard way. FYI the problem has not changed one bit.
  11. gotchaWhat if I do this.. /* ========== table stuff ========== */.vac { vertical-align: middle }.vat { vertical-align: top } Then just link to the one I want. (I know why you said your way...to save code by having a default)Now in my posted code (in the 1st post) where do I link the ".vat" too?
  12. Okay, I'll give it a try. I do use a style.css page. But problem is I have td's that need info in the middle. So I guess I will have to make this <style type="text/css">td { vertical-align: top }</style> more specific?
  13. **RESOLVED**Hello. Could someone please let me know why this code is notworking in IE? It does not put the images at the top of the "<td>" field. It drops the pics down about 2 rows then displays them. <table width="700" height="" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" colspan="2" align="center" class="black-medium"> </td> </tr> <tr> <td width="116" height="" align="left" valign="top"><?php include 'includes/links.php';?></td> <td width="584" height="" align="center" valign="top"> ***PROBLEM STARTS HERE*** <?PHP echo "<table width=\"\" border=\"1\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#999999\" bordercolor=\"#B51628\">"; while ($row = mysql_fetch_assoc($result)) { if ($nr % $nr_per_row == 0) echo "<tr>"; //output <tr> if this is the first in a row echo "<td>"; echo "<a href=\"".$row['link']."\"><img name=\"\" src=\"images/sponsors/".$row['id'].".jpg\" width=\"200\" height=\"75\" alt=\"\" border=\"0\"/></a>"; echo "</td> "; $nr++; if ($nr % $nr_per_row == 0) echo "</tr>"; //output </tr> if this is the last in a row } if ($nr % $nr_per_row != 0) echo "</tr>"; //clean up echo "</table>"; ?> </td> </tr></table> Of course Firefox is working correctly. IE FFThank you for any help.
  14. Hooch

    Protecting emails

    Awsome, Thanks man!! All info I get here is greatfully appreciated. I have one more question though. Could you please explain this.. $rand1 = rand();$rand2 = rand(); Thank you
  15. Hooch

    Protecting emails

    Could I not break it into 2 parts then? Before the "@" and after?I have been doing some reading up on the function. I must sayit's one of the harder parts of PHP to figure out. Could someone have a look at my 1st attempt? I hope I am on the rightpath. <?PHP $rand1 = rand();$rand2 = rand();$r2 = preg_split("/[@]/", $r['email'] ); $r3 = $r2[0]; //1st half before "@"$r4 = $r2[1]; //2nd half after "@"?><script language='JavaScript' type='text/javascript'><!--var prefix = 'ma' + 'il' + 'to';var path = 'hr' + 'ef' + '=';var addy<?php echo $rand1 ?> = '<?php echo $r3 ?>';var addy<?php echo $rand2 ?> = '<?php echo $r4 ?>';addy<?php echo $rand3 ?> = addy<?php echo $rand1 ?> + '@' + addy<?php echo $rand2 ?>;document.write( '<a ' + path + '\'' + prefix + ':' + addy<?php echo $rand3 ?> + '\'>' );document.write( addy<?php echo $rand3 ?> );document.write( '<\/a>' );//-->\n </script><script language='JavaScript' type='text/javascript'><!--document.write( '<span style=\'display: none;\'>' );//--></script>This email is protected against bots, you need to activate Javascript to view it...<script language='JavaScript' type='text/javascript'><!--document.write( '</' );document.write( 'span>' );//--></script> Well, it seems to be working. Could you guys have a look to seeif my code is secure?Thanks for any help
  16. Hooch

    Protecting emails

    Okay..I like the javascript option. Thanks Mr_Chisol.Now I would end up using my DB to echo the info. var addy<?php echo $rand1 ?> = '<?php echo $r[part1] ?> ';var addy<?php echo $rand2 ?> = '<?php echo $r[part2] ?> ';var addy<?php echo $rand3 ?> = '<?php echo $r[part3] ?> '; So the best way extract this info would be to somehow split up the email. I assume you can have an entry split up. Say everything before the "@" goes into part1. Then everything after "@" but before "." goes into part2. Then everything after "." goes into part3.Yes??
  17. Hooch

    Protecting emails

    Ok thank you. What about showing an email this way? <a href="mailto:<? echo $r['email']?>" class="studio-links-red">EMAIL</a><br />
  18. Hooch

    Protecting emails

    Hi all, I was wanting to know a little more aboutprotecting my and my users emails. From what little I know, there are bots out there thatscan code from webpages searching for emails. So one way to help myself is not to hard code my emailin comment lines of my code.(correct?) This also makesme think I should not give myself and email with the tag admin. ie admin@mysite.com I'm sure this is a gimmie for those bots. If this is true I'm sure there's alot of standard emails we would use, not knowing we are settingourselves up for spam. Now, say I have a site that users want thier emails shownon thier personal members page. The email would of course be in a DB that is printed out. Is this vulnerable? (Assuming my DB and usersytem are secure)Recap- are these bad webmaster actions: 1: Commenting an email in code? 2: Popular emails (admin@mysite.com, support@mysite.com)? 3: Printing an email from a DB?More questions to follow for sureThank you kindly.
  19. **RESOLVED**Howdy all. (hehe, I said howdy)I have a hits counter set up on my site. Here is my table CREATE TABLE `stats` ( `ip` varchar(20) NOT NULL default '', `date` varchar(10) NOT NULL default '00-00-0000', `hits` int(10) NOT NULL default '1', `online` varchar(255) NOT NULL default '', `page` varchar(255) NOT NULL default '') TYPE=MyISAM; I would like to select 3 time frames from the 'date' field. So I could see how many hits were taken from Jan-Apr, May-Aug, and Sep-Dec. Here is what I have so far. <?PHP // Jan-Apr $current = date('Y'); $select = mysql_query("SELECT * FROM stats WHERE date >= 01-01-$current AND date <= 30-04-$current ") or die(mysql_error()); $r = mysql_num_rows($select); ?> <tr> <td>Garden Tour unique hits = <?PHP echo $r ?></td> </tr> This brings up 0. But if I delete the following code "AND date <= 30-04-$current " It will show the correct amount of hits for the whole year. (obviously) Thanks in advance for any help. I will keep trying that's for sure.**Update I think the problem is this part "<= 30-04-$current" If I query just that..it comes up "0" but I have entries for January. So I tried this $select = mysql_query("SELECT date FROM stats WHERE date BETWEEN '01-01-$current' AND '04-30-$current'") or die(mysql_error()); Success!!!!
  20. Hooch

    unique key info

    As usual thank you for your time guy.
  21. Hooch

    unique key info

    Thanks jlhaslip, good stuff. I stumbled upon a tutorial for dreamweaver. It will popup an error ifa field is not filled out, and it saves all info since the form is not posted. http://www.phpeasystep.com/phptu/17.html Mind you this does not save the info if all required fields are filled out, thenthe query for a duplicate email is true. The form does get posted and allinfo will be lost. But I thought the info could come in handy for dreamweaver users.
  22. Hooch

    unique key info

    I read up on the (ereg_replace) It will check for certain entries then replace them with something else.Okay so what do I need to check for? FYI this is a clean function I do on every form input.include 'includes/clean.php';$firstname = clean($_POST['firstname']);$lastname = clean($_POST['lastname']);$email = clean($_POST['email']); clean.php function clean($string){$string = mysql_real_escape_string($string);$string = trim($string);return $string;} I assume putting my (ereg replace) in the clean.php would be best too?Thank you, Hooch
  23. Hooch

    unique key info

    That is a nice touch, but how do you save the fields?
  24. Hooch

    unique key info

    Hey all. I have a users table set up with the user name and email as unique fields. This is good on 2 levels. One you can't register a duplicate name. Two, once registered you can't change your name to anothers. The second part is automatically done for you without any extra coding. So is it possible to echo the non entry? I made some code up to check the email $profile2 = mysql_query("SELECT * from users where username = '{$_SESSION['s_username']}'"); $profile2 = mysql_fetch_array($profile2);if ($_POST['email'] !== $profile2[email]){ $check = mysql_query("SELECT email FROM users WHERE email='$email'"); $check = mysql_num_rows($check); if ($check>0) { echo "<link href=\"includes/style.css\" rel=\"stylesheet\" type=\"text/css\" />"; echo "<br><br>"; echo "<center>That email is already in use."; echo "<br><br>"; echo "<a href=\"editprofile.php\" class=\"red-14\">Back</a></center>"; echo "<br><br>"; } So can I skip all this code and let the table do it's work for me, then display the error for the user? Thank you, Hooch
×
×
  • Create New...