Jump to content

koolgirl

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by koolgirl

  1. Hi all I am here again with a small problem and hope this forum will help me like always. Here is my problem for this time: I have a contact us page on my site. Anybody who want to contact us, can either send email to any of the email addresses displayed at the contact page or can simply fill up the small form and click submit. When the user submits the form, it is stored on an MySQL database. I check the contact form database directly by logging in to MySQL database and no pages are linked to this database for output. The only page that links to the database is this contact page which writes into the database. All works perfect but now I have got a problem. Some bots keep filling the form with links to porn sites and multiple times in a day I have to log in to MySQL just to delete these links. I know I might have to use a method of verification like in some forms where the visitor have to enter the text in an image Or block the IP range(which I really won't want to do), is there any other simpler way to do this too? My second question is that as I said before too, no page is linking to this database or table, will it really help somebody to have links to their sites in a database like this? Does the search engine robots crawl those databases too? Many thanks in advance :)
  2. THANKKKSSSSSSSSSSSSSSSSS Barand, this is all I needed. Thanks again
  3. Hi Sabadell call me a typical blond  ::) but I still don't actually understand and get the point how to count only the unique IP addresses. "SELECT Date, IP, COUNT(*) AS datecount FROM UserRecords WHERE Date='$dte' GROUP BY Date");---> is what I am using tocount the total hits of the day. Working perfectly. "SELECT DISTINCT COUNT(IP) AS uniqs FROM UserRecords WHERE Date='$dte'");---> is what I am trying to use to count the unique IP addresses but it returns the same result as the 1st one. Now I tried to use what you suggested. Here I couldn't get it work because I need to "COUNT As uniqs" so that I can get the result in the table cell. $query_Recordset1 = "SELECT DISTINCT mytable.`mydistinctcolumn`, mytable.Anothercolumn, mytable.AnotherColumn2  FROM mytable "; HelPppppppppppppppp!!!!
  4. Hi Orio and Redarrow, Thanks alot for the replies. I am sorry to bother again but I didn't actually understand my mistake from the link. The syntax that I used before posting here counts it also for me but the problem is that it does not count the unique IP addresses. For example if I get 200 hits a day from 30 IP addresses. The script that I tried to use counts 200 IP addresses and not 30. I would be very Thankful if somebody can review the code that I posted before and reply.
  5. Hi again Everybody, This is getting more and more interesting and complicated the more I am learning. I am collecting the visitors records such as IP, Host, Browser and OS etc in a MySQL database table. To view the daily hits record I have some administrative pages from where I can check the visitor activity on the site. For example I group the records by date and get the total hits at a specific date. All works perfect for me, even better and more reliable then the free counters etc that I was using before I started to learn PHP myself. Now I have a small question again, probably very easy one. I can get the total hits of the day simply with this script: <?php // Request the text of all the URLs $result = mysql_query( "SELECT Date, IP, COUNT(*) AS datecount FROM UserRecords WHERE Date='$dte' GROUP BY Date"); if (!$result) { echo("<P>Error: " . mysql_error() . "</P>"); exit(); } echo "<table border='0'>"; echo "<tr>"; while ( $row = mysql_fetch_array($result) ) { echo "<tr>"; echo "<td>" . "Total Hits Count @ ". $dte . " : ". $row["datecount"] . "</td>"; echo "</tr>"; } echo "</table>\n"; ?> ****************************************************** This works fine for the total hits of the day, or the whole time. I want to count the unique IP addresses of the same date. I was thinking that SELECT DISTINCT will do the job, maybe I am right but my syntax is not right, but anyway with SELECT DISTINCT too I am getting the same result as I am getting with the GROUP BY. I am trying it this way: "SELECT DISTINCT COUNT(IP) AS uniqs FROM UserRecords WHERE Date='$dte'"); ******************************************************** Any help greatly appriciated. ::)
  6. Hi, I have over 2000 records in the database for the site visitors. I was keeping the Time and Date in a field type "datetime" and the NOW() statement in php script was updating this field. So in all those records I have the time and date stored in "0000-00-00 00:00:00" format. Yes, I know this was a little stupid but I was new. Now I want to save Date and Time seperately in two different fields. I can do that for the new records but my question is that is it possible to split the past records too with one query without having to edit the fieilds one by one in a way that after executing the query all the records in "datetime" field get split and get stored in the same order into the two new fields for date and time? I know this is not simple and am not really expecting an easy solution, although I have been getting perfect help from this forum. Many Thanks in advance [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
  7. Hi Poirot Thanks for the quick reply. am a bit confused now [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] two reasons: 1st am wondering how can a com extension with with name nasa be still free? and 2nd if it is free then why is register.com and domains.yahoo.com saying that it is not? Your links are sure useful. Many Thanks
  8. Hi all I realy like this forum, so quick and perfect replies. Thanks in advance Got a small issue again, am not really sure if this is the right place to ask but I have a small whois script that checks for the availability and info of com, net, org etc domains. I am using $whois = "whois.internic.com" for com and net extensions All works perfect but just sometimes it delievers the wrong info. and so wrong that if you look for nasa.com, it will tell you that the domain is free to register. with net, org and all other extensions there is no mistake, only with com is sometimes wrong. i changed the server into $whois = "rs.internic.net" but still same. Can anyone tell me how should I resolve the problem? and which are the authentic databases for different extension? Also can anybody tell me how to whois IP addresses? All help would be apreciated, Thanks in advance!
  9. THANKSSSSSSSSS obsidian P_E_R_F_E_C_T_L_Y working now Thanks again!
  10. first of all Thanks kenrbnsn & poirot kenrbnsn, am using your tip. Working perfect but I got a little bit stuck in the next phase now. With the following script I do get the visitor's host address stored in the table but the next problem comes out when I want to store more information with the same script. For example this works fine: <?php $sql = "INSERT INTO Records SET IP='" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "'"; ?> _______________________________________________ but how can I use this with my script because I am storing all info in the same table and I want to add one more field that is supposed to be the hostname. As I wrote yesterday also I am using doing it this way: <?php $dbcnx = @mysql_connect( 'mysql','username','mypass'); mysql_select_db("Main"); $sql = "INSERT INTO Records SET " . "IP='$REMOTE_ADDR', " . "BrowserName='$HTTP_USER_AGENT', " . "Language='$HTTP_ACCEPT_LANGUAGE', " . "Referer='$HTTP_REFERER', " . "Date=NOW()"; ______________________________________________________ now as kenrbnsn said, I want to add this line some how: $sql = "INSERT INTO Records SET userhost='" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "'"; ____________________________________________________ but still not working no matter how much I tried different ways. I know the solution will again be very simple but my knowledge is too low even for that. Any help will be very much appreciated Many Thanks
  11. Hi got tired trying to solve this problem. I have been using the following script to store visitor's data. It is working fine: <?php $dbcnx = @mysql_connect( 'mysql','username','mypass'); mysql_select_db("Main"); $sql = "INSERT INTO Records SET " . "IP='$REMOTE_ADDR', " . "BrowserName='$HTTP_USER_AGENT', " . "Language='$HTTP_ACCEPT_LANGUAGE', " . "Referer='$HTTP_REFERER', " . "Date=NOW()"; *********************************************** I want to store the user's host name also. I know this will display the host name on screen: <? echo "Your Host Name: " . gethostbyaddr($_SERVER['REMOTE_ADDR'])"; ?> ************************************************ but the problem is how to store it in database? it returns error if I write it this way: <?php $dbcnx = @mysql_connect( 'mysql','username','mypass'); mysql_select_db("Main"); $sql = "INSERT INTO Records SET " . "IP=gethostbyaddr($_SERVER['REMOTE_ADDR'])"; ****************************************** All help would be very much appriciated. Many Thanks
  12. Thanks again Guru, I got it now and the link that you gave is exactly what I had been looking for. Have a nice day!
  13. Hi again everyone, I just wanted to start collecting the information about the visitors by myself without depending on 3rd parties to do it for me. So I wrote this: ************************************************* <?php $dbcnx = @mysql_connect( 'mysql','login','password'); mysql_select_db("MainDB"); $sql = "INSERT INTO UserRecords SET " . "IP='$REMOTE_ADDR', " . "BrowserName='$HTTP_USER_AGENT', " . "Language='$HTTP_ACCEPT_LANGUAGE', " . "Referer='$HTTP_REFERER', " . "Date=CURDATE()"; if (mysql_query($sql)) { echo(""); } else { echo("<P>Error processing your request: " . mysql_error() . "</P>"); } ?> ***************************************************** Everything works fine with the above code and it updates the fields at the database table correctly. The only field that does not get updated is the Referer field. As far as I know $HTTP_REFERER should take care of it. But it doesn't. Can anyone help me solve the problem? And of course if somebody can suggest which other information should I get if this is not enough? All help would be Very Very much appreciated
  14. Hi Again Guru Well, Now I can call you GURUUUuuu lol It is working perfect Many Thanks
  15. Hi Guys, Again posting the second part of my question a little bit modified. All I want to do is to get all the fields data from my database in table rows and not plain row by row so that I can change the colors etc of the different fields. I posted once before also a few hours ago(If you want you can scroll down and read that detail also) and was suggested to get a BOOK. Well, I got a bit success now. I do get the data in rows now but not all the fields. I have 3 fields, ID/Name/Email and with the following code I just get the data of two of the mentioned fields in rows: <html> <body> <?php $db = mysql_connect("xxxxx", "xxxxx", "xxxxxx"); if (! @mysql_select_db("jokes") ) { echo( "<P>Unable to locate the " . "database at this time.</P>" ); exit(); } $result = mysql_query( "SELECT ID, Name, Email FROM contacts"); if (!$result) { echo("<P>Error performing query: " . mysql_error() . "</P>"); exit(); } echo "<table width = 100% border=1>\n"; echo "<tr><td>ID</td><td>Name</td><td>Email</td></tr>\n"; while ($myrow = mysql_fetch_row($result)) { printf("<tr><td>%s </td><td>%s </td><td>%s </td></tr>\n", $myrow[1], $myrow[2], $myrow[3]); } echo "</table>\n"; ?> </body> </html> __________________ Yes, I finally got it working some how but still as I said just 2 of the fields can be retrieved in rows. I need help to get all 3 of them in rows and columns so that I can get the display as I want it. Any help would be appreciated other then advising to get a PHP book(I have it already and will get more and am learning just since yesterday So Please, only help in code if possible)
  16. Hi Guru, Thanks for your prompt reply. I actually have a PHP and MySQL book. Just started with it yesterday and it really did a good job as I came so far just in a day. The problem is that in my book making the tables and text in PHP is explained but not explained as how I can put data from database into the cells of PHP tables seperately. Will sure find a better book in the next days. Am not really relying just on somebody's codes but I think Forums are made for help. I found out how to get the remaining fields also during the time that I was waiting for a reply and after reading your post it was confirmed where the problem was. Many Thanks!
  17. Hi Guys 2nd forum again posting because the 1st time is still not un-answered. Please Help I have 2 questions, I am sure that the person who can answer one of them will be able to answer the second too. 1. I use Dreamweaver to play around with my site and learn more. Everything goes good the only thing that I am still not able to solve is the Draw layer. I want to draw a layer that will keep its position on all resolution just like the rest of the site and tables etc. But for example if I draw a layer at the left of the page which contains all the home/bla bla bla buttons. I position it as: <div id="Layer1" style="position:absolute; left:12px; top:33px; width:135px; height:255px; z-index:1"></div> When I preview the page, it will not show exactly where I wanted it to be. Anyway after repositioning it little by little a few times, I get the result that I want. By as soon as I change the screen resolution, it displays again somewhere else. How can I make the layer keep its position just like a table would stay where it is? 2. I got MySQL installed on webserver. Am learning PHP now. I got a sample Database, containing, ID/Name/Email/Ph# fields. I can view the names of my contacts with my sample.php which contains the following code: <?php $dbcnx = @mysql_connect("xxxxx", "xxxxx", "xxxxx"); if (!$dbcnx) { echo( " Unable to connect to the " . "database server at this time.</P>" ); exit(); } if (! @mysql_select_db("contacts") ) { echo( " Unable to locate the Database" . "database at this time.</P>" ); exit(); } ?> Here are all the contacts in our database: </P> <BLOCKQUOTE> <?php $result = mysql_query( "SELECT Name FROM contacts"); if (!$result) { echo(" Error performing query: " . mysql_error() . "</P>"); exit(); } while ( $row = mysql_fetch_array($result) ) { echo(" " . $row["Name"] . "</P>"); } ?> </BLOCKQUOTE> *************************** This shows me the names of all the contacts in rows. I want to display not just names, but also the remaining fields and want to be able to display them in a table with borders possibly different colors for different columns. How can I do it? PLEASE help me fast. Thanks in Advance!
×
×
  • 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.