Jump to content

denoteone

Members
  • Posts

    383
  • Joined

  • Last visited

    Never

Everything posted by denoteone

  1. If I had a string that assigned to a variable like. $mystring = "hello welcome to my house. my name is mike I live here"; and I want to strip everything that appears before the word "mike" I looked at the sting functions on http://www.w3schools.com/PHP/php_ref_string.asp but did not see any that would work. I am thinking i need to do this in 2 steps. like explode that string then just get rid of the first object in the array? can anyone help me out with this?
  2. thanks I will pay more attention to the indentation. yes I know. I am jsut try to test something. I hav an issue with my other script that calls a funtion with in a function. I am not getting any errors but I am not seeing the result I want. if (strpos($fp,"Redirected")){ if(strpos($fp,"whois.ripe.net")){ $whois_ip_servernew = 'whois.ripe.net'; whois_ip($whois_ip_servernew, '-1', 'FALSE', $visitor_ip); }else{ return $fp; } }else{ return $fp; }
  3. I am getting nothing to the screen with this page. <?PHP ini_set ("display_errors", "1"); error_reporting(E_ALL); function hello_test($text){ if ($text = 'hello'){ echo $text; }else{ hello_test('hello'); } hello_test('goodbye'); echo "not working"; ?>
  4. can you call a function with different parameters from that same function? example: function hello_test($text){ if ($text == "hello"){ echo $text; }else{ hello_test('hello'); } hello_test('goodbye');
  5. i had quotes around my table name. LOL I didn't need them there. I wasn't getting the mysql error because I didn't know I had to have php errors on to see them.
  6. having a hard time getting data out of a string saved in a variable. $fp = "[Querying whois.arin.net] [Reirected to whois.ripe.net:43] [Querying whois.ripe.net]"; I need to create a new variable that only has the string "whois.ripe.net" the second instance of it above. $newfp = getstr($fp, get the data between the 2nd instance of Querying and the 3rd instance of ]); echo $newfp; output whois.ripe.net
  7. I got it working it was the sql statement. $sql_con = "UPDATE visitor_list SET visitor_page = CONCAT(visitor_page,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_day = '$visitor_day'"; thanks everyone for your help
  8. sorry i was counting both "[" and "]" I need something like this $fp = "[Querying whois.arin.net] [Reirected to whois.ripe.net:43] [Querying whois.ripe.net]"; $newfp = (getstring($fp,between 2nd Querying and 3rd ]); echo $newfp; output whois.ripe.net
  9. that looks like it will work but what about getting assigning part of that string to a new variable. so if the string is "[Querying whois.arin.net] [Reirected to whois.ripe.net:43] [Querying whois.ripe.net]" I need the data between the second instance of the word Querying to the 6th instance of the "]" symbol.
  10. I have a variable that contains a string. I need to search for a word in the variable if that word is present I need to make a new variable that contains a different part of that string can anyone help me with this? I hope I don't have to use regex. $fp = [Querying whois.arin.net] [Redirected to whois.ripe.net:43] [Querying whois.ripe.net] I want to check to see if the word "Redirected" is in the variable. if (strpos($fp,"Redirected") is true){ $newserver = I need to get the string that is within the quotes [Querying whois.arin.net] [Redirected to whois.ripe.net:43] [Querying "whois.ripe.net"] }
  11. thansk rhodesa I am going to research the reason why mysql_real_escape_string is used. Thanks for your help
  12. if I have a variable $mylink = "<a href='mysite.com?title=thanks'>click here</a>"; and I insert the variable into a database when I retrieve the data later and echo it to the page will it work?
  13. if I have a variable like so $pagetitle = "Thank You page" $mylink = "<a href='mysite.com?title=$pagetitle'>click hereM</a>"; echo $mylink; would that show a click here link that goes to mysite.com?title=Thank You Page also if I insert $mylink into a database will that work so I can later retrieve the link from the database?
  14. I am still not there. I know this is where the issue is can anyone see what I am doing wrong? $sql_con = "UPDATE 'visitor_list' SET visitor_page = CONCAT(visitor_page,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_day = '$visitor_day'"; $result = mysql_query($sql_con) or trigger_error(mysql_error(),E_USER_ERROR);
  15. there is already data in v_page I am trying to add the value of $visitor_page to that data. which means I have to use concat();
  16. I am trying to add the variable $visitor_page to the field "v_page" where the field "visitor_ip" is equal to $visitor_ip and field "visitor_day" is equal to $visitor_day this is what I think would work but I it not working and I am not getting any php errors. $sql_con = concat(v_page,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_date = '$visitor_day'; $result = mysql_query($sql_con) or trigger_error(mysql_error(),E_USER_ERROR);
  17. The concat is a built in mysql function that adds the visitor page variable to the field pages. I just took a stab at the sql statement I am sure that is were i am going wrong.
  18. quire_once('visitors_connections.php');//the file with connection code and functions //get the required data $visitor_ip = $_SERVER['REMOTE_ADDR']; $whois_ip_server = 'whois.arin.net'; $ip_info = whois_ip($whois_ip_server, '-1', 'FALSE', $visitor_ip); $visitor_hour = date("h"); $visitor_minute = date("i"); $visitor_day = date("d"); $visitor_month = date("m"); $visitor_year = date("Y"); $visitor_ref = GetHostByName($_SERVER['HTTP_REFERER']); $visitor_page = curPageURL(); //write the required data to database mysql_select_db($database_visitors, $visitors); $sql = mysql_query(sprintf("SELECT `visitor_ip`,`visitor_day` FROM `visitors_list` WHERE `visitor_ip` = '%u' AND `visitor_day` = '%u';",(int)$visitor_ip,(int)$visitor_day)) or die('error!'); if(mysql_num_rows($sql)) { $sql_con = concat(pages,'$visitor_page') WHERE visitor_ip = '$visitor_ip' AND visitor_date = '$visitor_day'; $result = mysql_query($sql_con) or trigger_error(mysql_error(),E_USER_ERROR); }else{ $ip_info = mysql_real_escape_string($ip_info); $sql = "INSERT INTO visitor_list (visitor_ip, visitor_whois, visitor_min, visitor_hour, visitor_day, visitor_month, visitor_year, visitor_ref, visitor_page) VALUES ('$visitor_ip','$ip_info','$visitor_hour', '$visitor_minute', '$visitor_day', '$visitor_month','$visitor_year', '$visitor_ref', '$visitor_page')"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); } I think the issues is somewhere in the first if statement but i am not getting any errors but I am also not getting any info in my DB. anyone see what I am doing wrong?
  19. I think it is $sql = concat(pages,'$visitor_page') WHERE visitor_ip = '$ip' AND visitor_date = '$day'; I will test tomorrow.
  20. I am trying to add the data stored in a php variable to a MySQL database field that already has data in it. there will be two other PHP variables that need to match two other fields in the data base so that we know which field is the 3rd to update. so Far I have $day = date("d"); $ip = $_SERVER['REMOTE_ADDR']; $visitor_page = curPageURL(); //function that gets the page they are visiting. mysql_select_db($database_visitors, $visitors); $sql = concat(pages,'$visitor_page') WHERE visitor_ip and visitor_date are = to $ip and $day; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); I am having issues with the sql statement
  21. let me ask this differently. how do I add the to the contents of a database field named "info" where the field "visitor" and "date" are both equal to $visitor and $date
  22. $visitor_ip = $_SERVER['REMOTE_ADDR']; $visitor_day = date("d"); $visitor_page = curPageURL(); //function that gets the page they are visiting. mysql_select_db($database_visitors, $visitors); //my table is named visitor_list I would like to do something like the following. $sql = update 'visitor_list' where visitor_ip and visitor_date are = to $visitor_ip and $visitor_date, append visitor_page with $visitor_page; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR);
  23. So the code that gos in between the if statement would look some thing like this??? $sql = mysql_query(sprintf("SELECT `visitor_ip`,`visitor_day` FROM `visitors_list` WHERE `visitor_ip` = '%u' AND `visitor_day` = '%u';",(int)$visitor_ip,(int)$visitor_day)) or die('error!'); if(mysql_num_rows($sql)) { $sql = update 'visitor_list' where visitor_ip and visitor_date are = to $visitor_ip and $visitor_date, append visitor_page with $visitor_page; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); } else { // no record exists insert. }
  24. I want to write and IF statement that will check to see if a users IP and the date match a date and IP in my database. this way if the ip has been added already this day I can just add the page they went to instead of creating a whole new entry $visitor_ip = $_SERVER['REMOTE_ADDR']; $visitor_day = date("d"); $visitor_page = curPageURL(); //function that gets the page they are visiting. mysql_select_db($database_visitors, $visitors); if(check to see if $visitor_ip is in the data base and if it is see if the field visitor day is equal to $visitor_day if it is... ){ on that match only append $visitor_page to the visitor_page colum } else{ $sql = "INSERT INTO visitor_list (visitor_ip, visitor_whois, visitor_min, visitor_hour, visitor_day, visitor_month, visitor_year, visitor_ref, visitor_page) VALUES ('$visitor_ip','$ip_info','$visitor_hour', '$visitor_minute', '$visitor_day', '$visitor_month','$visitor_year', '$visitor_ref', '$visitor_page')"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); }
  25. yes it is for getting data from another site.
×
×
  • 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.