Jump to content

ryanschefke

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by ryanschefke

  1. Sorry, I must correct my last post: http://www.leadliaison.com/phpinfo.php -COMPARED TO- the same script under https, https://www.leadliaison.com/phpinfo.php. I am sure you figured that out though. The main issue seems to be that $_SERVER["HTTP_X_FORWARDED_FOR"] passes through under http but that server variable does not show up under https. I will chat with our server admin team about getting the $_SERVER["HTTP_X_FORWARDED_FOR"] header passed through with the https request. Open to other ideas in the interim...
  2. Hi Folks - I used the phpinfo() approach and ran it under http and https. To prove my point, check this out: http://www.leadliaison.com/phpinfo.php -COMPARED TO- the same script under https, http://www.leadliaison.com/phpinfo.php. At the end you will see the server variables. It does not report the remote IP under https. Is there a solution here to collect the IP under https?
  3. It displays the remote IP address of the server hosting our website when $_SERVER['REMOTE_ADDR']; runs under https. However, when $_SERVER['REMOTE_ADDR']; runs under http it displays the remote IP address of a visitor accessing our website.
  4. Hello, I am trying to collect an IP address using PHP over both http and https connections. Does anyone know how I can collect the IP over https? I use the $ip = $_SERVER['REMOTE_ADDR']; ...over http and it works just fine. However, when I use it over https it does not. Thank you very much, Ryan
  5. Hello, I am looking for someones services to help me properly complete setup of my e-mail server. I am running Interspire's E-mail Marketer application on the server which will be used by my customers to send e-mail campaigns (newsletters, etc). I anticipate 1,000s of e-mails will be leaving the server and I want to avoid getting blacklisted, added to spam lists, etc. The software package itself takes a number of steps to control these measures; however, I understand DKIM, SenderID, SPF records and proper DNS configuration are also vital. If you can provide services please feel free to call my mobile phone at 214.491.0807 as there is a good chance I will not be checking the e-mail account associated with this forum over the next few days. Thanks, Ryan
  6. Hello, Is there a way to limit the size of a string returned from a select statement? For example, it is a long URL but I only want to display the first 50 characters. The way I am using the select statement in a particular section of code doesn't allow for any post processing so I need to format the string inside the select statement. Thank you, Ryan
  7. Hello, How can I construct this query? I have a bunch of values in a table. I want to output the % of values that only occur once to the % of values that occur more than once. In other words, if I have 1, 2, 2, 2, 3, 4, 4, I would like to output: New numbers: 50% Existing numbers: 50% ..new numbers because the 1 and 3 only occurred once and existing numbers of 2 and 4 because they occurred more than once. %s are %s of individual numbers. What is the query I should use? Ryan
  8. Hello - I am trying to count the number of rows in my "visitors" table. When I add the lines "filter_countries.filterID='57' AND v.country!=filter_countries.country_code" it miscalculates the numbers. I have a "country" column in the visitors table and I only want to count the rows that do not have the same "country" value as rows in my "filter_countries" table with "filterID='57". My attempt at the query is below. What am I doing wrong? SELECT COUNT(v.visitorID), DATE_FORMAT(DATE_SUB(v.dateTime,INTERVAL 5 HOUR), '%a %c/%e/%y') as visitsOnDate, v.dateTime, cast(DATE_SUB(v.dateTime,INTERVAL 5 HOUR) as date) as groupDate FROM visitors as v , filter_countries WHERE v.customerID='11222' AND cast(DATE_SUB(v.dateTime,INTERVAL 5 HOUR) as date) BETWEEN '2008-09-22' AND '2008-09-29' AND filter_countries.filterID='57' AND v.country!=filter_countries.country_code GROUP BY groupDate ORDER BY v.dateTime DESC Thank you very much, Ryan
  9. Hello - I would like to make a single PHP page that aggregated news clips from RSS feeds I suppose, and listed them on a page. Does anyone have examples, code, etc to accomplish this? For example, I would want to see all news clips for Cisco for the past 30 days. Thanks, Ryan
  10. Hello, I am playing with an API from a company that makes a SOAP request and an XML response is sent back. I am not sure how to use/interpret the response and need some help. You can see the output here: http://www.leadliaison.com/test_hooversAPI.php. The script is below, which dumps this output on the above link to the screen. For now, I just want to print something simple like annual sales, which according to the providers API has the XML output parameters of: \return\resultSet\hit\company-results\finsales <form method="post" action="test_hooversAPI.php"> <table border=0> <tr> <td> <input type="radio" name="methodName" value="FindCompanyByKeyword">FindCompanyByKeyword </td> </tr> <tr> <td> <input type="radio" name="methodName" value="AdvancedCompanySearch">AdvancedCompanySearch </td> </tr> <tr> <td> <input type="radio" name="methodName" value="GetCompanyDetail">GetCompanyDetail </td> </tr> <tr> <td> <input type="radio" name="methodName" value="GetAdvancedSearchLookups">GetAdvancedSearchLookups </td> </tr> <tr> <td> <input type="radio" name="methodName" value="GetPersonDetail">GetPersonDetail </td> </tr> <tr> <td> <input type="radio" name="methodName" value="AdvancedPersonSearch">AdvancedPersonSearch </td> </tr> <tr> <td> <input type="radio" name="methodName" value="FindPersonByKeyword">FindPersonByKeyword </td> </tr> <tr> <td> <input type="submit" value="Submit"> </td> </tr> </table> </form> <br/> <hr/> <br/> <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { print($_POST['methodName']); try { //Create your SoapClient and point to Hapi.wsdl $client = new SoapClient( 'http://hapi-dev.hoovers.com/axis2/Hapi.wsdl', array('trace' => true, 'exceptions' => true) ); //Create the SoapHeader once //The header contains your API KEY $apiKeySoapHeader = new SoapHeader('http://webservice.hoovers.com', 'API-KEY', 'MYKEYHERE'); //Call the chosen web service if($_POST['methodName'] == 'FindCompanyByKeyword') { //Create find company by keyword params $parameters = array( "keyword" => 'Hoover\'s Inc' ); } elseif($_POST['methodName'] == 'AdvancedCompanySearch') { //Search for companies that have 10 to 100 employees in Dallas $parameters = array( "bal" => array( "companysize" => array( "employeesFrom" => 10, "employeesTo" => 100 ), "location" => array( "city" => 'Dallas' ) ) ); } elseif($_POST['methodName'] == 'GetCompanyDetail') { $parameters = array( "uniqueId" => '809194728' ); } elseif($_POST['methodName'] == 'GetPersonDetail') { $parameters = array( "uniqueId" => '2059663' ); } elseif($_POST['methodName'] == 'AdvancedPersonSearch') { $parameters = array( "bal" => array( "companysize" => array( "employeesFrom" => 10, "employeesTo" => 100 ), "location" => array( "city" => 'Dallas' ) ) ); } elseif($_POST['methodName'] == 'FindPersonByKeyword') { $parameters = array( "keyword" => 'Hoover\'s' ); } elseif($_POST['methodName'] == 'GetAdvancedSearchLookups') { //TODO: Might need to be NULL...wait until new version of HAPI goes to SoDevHAPI $parameters = array(); } //Use __soapCall instead of directly calling the method, //as we must pass the API-KEY in the Header $result = $client->__soapCall($_POST['methodName'], array($parameters), NULL, $apiKeySoapHeader); //Now that you have the result data, use it //The data will come back as an object using the names defined in the WSDL dump($result); //echo $industries->return['sIAC']; //echo $result['return']['industries']['sIAC']; //echo "Name: " . $result->return->keyNumbers->fiscal-period . "\n"; //TEMP var_dump($result->return->resultSet); } catch (Exception $e) { print($e); print($client->__getLastRequest()); } } ?> <?php ///////////////// // Much thanks to the group on php.net // Specific code taken from http://us3.php.net/manual/en/function.var-dump.php#80288 //////////////// //////////////////////////////////////////////////////// // Function: dump // Inspired from: PHP.net Contributions // Description: Helps with php debugging function dump(&$var, $info = FALSE) { $scope = false; $prefix = 'unique'; $suffix = 'value'; if($scope) $vals = $scope; else $vals = $GLOBALS; $old = $var; $var = $new = $prefix.rand().$suffix; $vname = FALSE; foreach($vals as $key => $val) if($val === $new) $vname = $key; $var = $old; echo "<pre style='margin: 0px 0px 10px 0px; display: block; background: white; color: black; font-family: Verdana; border: 1px solid #cccccc; padding: 5px; font-size: 10px; line-height: 13px;'>"; if($info != FALSE) echo "<b style='color: red;'>$info:</b><br>"; do_dump($var, '$'.$vname); echo "</pre>"; } //////////////////////////////////////////////////////// // Function: do_dump // Inspired from: PHP.net Contributions // Description: Better GI than print_r or var_dump function do_dump(&$var, $var_name = NULL, $indent = NULL, $reference = NULL) { $do_dump_indent = "<span style='color:#eeeeee;'>|</span> "; $reference = $reference.$var_name; $keyvar = 'the_do_dump_recursion_protection_scheme'; $keyname = 'referenced_object_name'; if (is_array($var) && isset($var[$keyvar])) { $real_var = &$var[$keyvar]; $real_name = &$var[$keyname]; $type = ucfirst(gettype($real_var)); echo "$indent$var_name <span style='color:#a2a2a2'>$type</span> = <span style='color:#e87800;'>&$real_name</span><br>"; } else { $var = array($keyvar => $var, $keyname => $reference); $avar = &$var[$keyvar]; $type = ucfirst(gettype($avar)); if($type == "String") $type_color = "<span style='color:green'>"; elseif($type == "Integer") $type_color = "<span style='color:red'>"; elseif($type == "Double"){ $type_color = "<span style='color:#0099c5'>"; $type = "Float"; } elseif($type == "Boolean") $type_color = "<span style='color:#92008d'>"; elseif($type == "NULL") $type_color = "<span style='color:black'>"; if(is_array($avar)) { $count = count($avar); echo "$indent" . ($var_name ? "$var_name => ":"") . "<span style='color:#a2a2a2'>$type ($count)</span><br>$indent(<br>"; $keys = array_keys($avar); foreach($keys as $name) { $value = &$avar[$name]; do_dump($value, "['$name']", $indent.$do_dump_indent, $reference); } echo "$indent)<br>"; } elseif(is_object($avar)) { echo "$indent$var_name <span style='color:#a2a2a2'>$type</span><br>$indent(<br>"; foreach($avar as $name=>$value) do_dump($value, "$name", $indent.$do_dump_indent, $reference); echo "$indent)<br>"; } elseif(is_int($avar)) echo "$indent$var_name = <span style='color:#a2a2a2'>$type(".strlen($avar).")</span> $type_color$avar</span><br>"; elseif(is_string($avar)) echo "$indent$var_name = <span style='color:#a2a2a2'>$type(".strlen($avar).")</span> $type_color\"$avar\"</span><br>"; elseif(is_float($avar)) echo "$indent$var_name = <span style='color:#a2a2a2'>$type(".strlen($avar).")</span> $type_color$avar</span><br>"; elseif(is_bool($avar)) echo "$indent$var_name = <span style='color:#a2a2a2'>$type(".strlen($avar).")</span> $type_color".($avar == 1 ? "TRUE":"FALSE")."</span><br>"; elseif(is_null($avar)) echo "$indent$var_name = <span style='color:#a2a2a2'>$type(".strlen($avar).")</span> {$type_color}NULL</span><br>"; else echo "$indent$var_name = <span style='color:#a2a2a2'>$type(".strlen($avar).")</span> $avar<br>"; $var = $var[$keyvar]; } } ?>
  11. Hello, I have a table and some of the rows has an empty value in one of the columns. It is blank (in other words, it is not "NULL"). How do I only select the rows that have a value and are not empty. The SELECT WHERE value IS NOT NULL doesn't work, and I understand why since I am putting in blank values. Thanks! Ryan
  12. Hello, I am trying to only show the rows where the sumHits value is >1 and it is not working. I confirmed if I remove the "sumHits>1" (currently in below query) it works just fine. Thanks in advance for your help. SELECT v.organization, v.city, v.region, countries.printable_name, DATE_FORMAT(v.dateTime, '%m/%d/%Y %l:%i %p'), v.visitorID, v.searchWords, COUNT(h.hitID) as sumHits FROM visitors as v, hits as h, countries WHERE v.customerID='11222' AND cast(v.dateTime as date)='2008-08-30' AND h.visitorID=v.visitorID AND v.country=countries.country_code AND sumHits>1 GROUP BY h.visitorID ORDER BY v.dateTime DESC LIMIT 0, 20
  13. My full script is below. When the form is submitted I want to store all the selected values in MySQL. To test, I am trying to just print them to the screen. I can't figure out how to pass the selected items values in the submission form to print. You can see it in action here: http://www.leadliaison.com/filterState.php <?PHP require_once ("mysql_connect.php"); // connect to the db include "configuration.inc"; //require_once ("passport.php"); // connect to the db if (isset($submit)) { for ($n=0; $n <= count($_POST['1stLeft']); $n++) { //echo "hi".$i; echo $_POST['1stLeft'][$n]; echo "<br>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Lead Liaison - Sales Leads</title> <link href="CSS/ll_main.css" rel="stylesheet" type="text/css" /> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> <script type="text/javascript"> function OnTransferBtnClick(blnFromLeft) { var LeftListBox = document.forms[0].lstLeft; var RightListBox = document.forms[0].lstRight; var ListItems = new Array(); FromList = (blnFromLeft ? LeftListBox : RightListBox); ToList = (blnFromLeft ? RightListBox : LeftListBox); for(var i=(FromList.options.length - 1);i>=0;i--) if(FromList.options[i].selected) { ListItems[ListItems.length] = new Option(FromList.options[i].text); FromList.options[i] = null; } for(var i=ListItems.length - 1;i>=0;i--) ToList.options[ToList.options.length] = ListItems[i]; } </script> </head> <body> <div id="container"> <?PHP include "header_internal.php";?> <?php if (isset($message)) { echo '<table width="90%" border="0" align="center"><tr> <td class="rederrormessage"> <div align="center"><img src="images/icon_critalert.gif" width="34" height="34" hspace="10" vspace="5" align="absmiddle" />'.$message.' </div></td> </tr></table>'; } if (isset($success)) { echo '<table width="90%" border="0" align="center"><tr> <td class="successmessage"> <div align="center"><img src="images/icon_confirmation.gif" width="34" height="34" hspace="10" vspace="5" align="absmiddle" />'.$success.' </div></td> </tr></table>'; } ?> <table border="0" align="center" > <tr> <td height="295"> <div align="center"> <div class="containerGrey"> <!-- Container Head --> <div class="container_headGrey"> <img src="images/sidebar_leftSquare.jpg" alt="" class="float_left"/> <img src="images/sidebar_rightSquare.jpg" alt="" class="float_right"/> <div class="container_head_textGrey"> <div align="left"> Choose States and Provinces</div> </div> </div> <!-- Container Content --> <div class="container_contentGrey"> <div align="center"> <form action="<?PHP echo $PHP_SELF; ?>" method="post" name="statesform" id="statesform"> <table width="70%"> <tr> <td height="181"> <!--<select name="lstLeft" multiple size="10"> --> <?PHP $query_getstates = "SELECT state_code, state_name FROM states"; $result_getstates = @mysql_query($query_getstates); // run the query echo "<select name=\"lstLeft\" size=\"10\" multiple>"; while ($row_getstates = mysql_fetch_array($result_getstates, MYSQL_NUM)) { echo "<option value=\"" . $row_getstates[0] . "\">" . $row_getstates[1] . "</option>"; } ?> </select></td> <td> &nbsp </td> <td> <table> <tr> <td> <input Type="Button" Name="btnLtoR" Value=">>" onclick="OnTransferBtnClick(true)" title="Transfer Items Selected in the Left List Box to the Right List Box"> </td> </tr> <tr> <td> <input Type="Button" Name="btnRtoL" Value="<<" onclick="OnTransferBtnClick(false)" title="Transfer Items Selected in the Right List Box to the Left List Box"> </td> </tr> </table> </td> <td> &nbsp </td> <td> <select name="lstRight" MULTIPLE size="10"> </select> </td> </tr> </table> <table width="100%" border="0"> <tr> <td><div align="center"> <input name="submit" type="submit" id="submit" title="Submit this form" value="OK" /> </div></td> </tr> <tr> <td> </td> </tr> </table> </form> </div> </div> </div> </div> </td> </tr> </table> <p> <?PHP mysql_close(); ?> </p> <p> </p> <?PHP include "footer.php"; ?> </div> </body> </html>
  14. Hi Everyone - Can you help me understand why my dynamic selection list broke after adding [] to the name of the selection list, 1stLeft[]? It was working just fine with the small chunck of javascript to setup the left and right menus but when I try to create an array with the values using the php code below it breaks it. Without the [] next to 1stLeft in the name of the selection menu it works fine. I am trying to get it working then print out the values the user selecting (or moved to the box on the right hand side) <script type="text/javascript"> function OnTransferBtnClick(blnFromLeft) { var LeftListBox = document.forms[0].lstLeft; var RightListBox = document.forms[0].lstRight; var ListItems = new Array(); FromList = (blnFromLeft ? LeftListBox : RightListBox); ToList = (blnFromLeft ? RightListBox : LeftListBox); for(var i=(FromList.options.length - 1);i>=0;i--) if(FromList.options.selected) { ListItems[listItems.length] = new Option(FromList.options.text); FromList.options = null; } for(var i=ListItems.length - 1;i>=0;i--) ToList.options[ToList.options.length] = ListItems; } </script> $query_getstates = "SELECT state_code, state_name FROM states"; $result_getstates = @mysql_query($query_getstates); // run the query echo "<select name=\"lstLeft[]\" size=\"10\" multiple>"; while ($row_getstates = mysql_fetch_array($result_getstates, MYSQL_NUM)) { echo "<option value=\"" . $row_getstates[0] . "\">" . $row_getstates[1] . "</option>"; } <input Type="Button" Name="btnLtoR" Value=">>" onclick="OnTransferBtnClick(true)" title="Transfer Items Selected in the Left List Box to the Right List Box"> <input Type="Button" Name="btnRtoL" Value="<<" onclick="OnTransferBtnClick(false)" title="Transfer Items Selected in the Right List Box to the Left List Box"> <select name="lstRight[]" MULTIPLE size="10"> </select> </td>
  15. Well, not really I just don't know how to delete it an no one was responding to my post.
  16. Would it be better to store each of the users filters in a "filter_states" table as individual rows vs storing it as a text block then doing a WHERE IN statement? So, for example, I would have a table called "filter_states" with the following columns: userID filterState filterName row1 33 MI myFilter row2 33 OH myFilter row3 33 TX bobsFilter ... ... ... How would I compare that to another table that had a bunch of records with a column and I only wanted to display the states that the user had in the "filter_states" table with the filterName myFilter?
  17. I don't have to store it that way. I don't know of anyway better. There are 195 countries so the user could have 195 entries in one row of a table. Is that how I should do it? I figured I couldn't store all the users filter in one record because the user could enter an unlimited number of entries and I would just be storing them in randomn columns. There are 52 states so I would likely have the same table with 52 columns ....but, how would I compare the entry in one row, say a table named "filter_countries", with a certain userID to a table called "records" that had a "country" column so I could match only the rows in the "country" column that were contained in the "filter_countries" table with that userID?
  18. Hello, What is the best query to use optimized for speed that will search a table for rows where the column value is contained in a block of text that is stored in another table? For example, if I am storing "Blue, Yellow, Purple, Green" in one large text value in the "color" column of table "Crayons", how do I SELECT the rows in the "Todays_crayons" table if the value in the "color" column matches any of the values in the "color" column (the text block) of the "Crayons" table? Thanks, Ryan
  19. Hello, I already have the following query working successfully. I am looking to add a search capability to only pull the rows where the string in the "state" column of my database is part of a large amount of text. In other words, Users will specify that they only want to see rows where the state column is Michigan, Ohio, Texas, California, Florida, etc... My two questions are: 1) How should I be storing the text in MySQL for the states they want to see? Separated by commas (Michigan, Texas, Ohio...) or just bunched together with no spaces (MichiganTexasOhio...) or a different way? I could store it in any way. Is there a certain format I should store it in, Text, Blob, etc to make it searchable? 2) What would I need to add to the query below to make this search and do it fast? Basically, a search with this logic "only pull the rows where the value in the state column is included in a paragraph of text" $query = "SELECT v.organization, v.city, v.region, v.country, DATE_FORMAT(v.dateTime, '%m/%d/%Y %l:%i %p'), v.visitorID, v.searchWords, COUNT(h.hitID) as sumHits FROM visitors as v, hits as h WHERE v.customerID='$customerID_ck' AND cast(v.dateTime as date)='$sGMTMySqlDate' AND h.visitorID=v.visitorID GROUP BY h.visitorID ORDER BY $sort LIMIT $start, $displayToday";
  20. You are a genious! That solved everything!!! Thank you so much. Ryan
  21. Hello - I need help with a query. I am programming in PHP and trying to make a MySQL query. I have one table, visitors, and a second table, hits. I am trying to display the results of the visitors table. The columns in the visitors table are organization, city, region, country, dateTime, visitorID, and searchWords. In the output as I display each row, I want to add a column from the hits table that adds all entries in hits with the same vistorID as the particular row I am displaying from the visitors table. I am trying the following query but the COUNT seems to not work and I am not sure if the "hits.visitorID=visitors.visitorID" statement is right. Logically, you can get an idea of what I am trying to do with the erroneous query below. Thanks so much for your help!!! $query = "SELECT visitors.organization, visitors.city, visitors.region, visitors.country, DATE_FORMAT(visitors.dateTime, '%m/%d/%Y %l:%i %p'), visitors.visitorID, visitors.searchWords, COUNT(hits.hitID) FROM visitors, hits WHERE visitors.customerID='$customerID_ck' AND cast(visitors.dateTime as date)='$sGMTMySqlDate' AND hits.visitorID=visitors.visitorID ORDER BY $sort LIMIT $start, $displayToday"; Regards, Ryan
  22. Hello, I would love to get some help as I am foreign to Java. I am used to writing in php, not java. I am looking to add a couple of lines of code such as the ones similar below to a foreign website to grab the IP address of the user viewing the page, the page URL itself, and the referring page. The goal is to require the user integrating this code into their website to have to enter as little as possible. <script type="text/javascript" language="javascript">llactid=11222</script> <script type="text/javascript" language="javascript" src="http://www.URLHERE.com/trackEngine.js"></script> I noticed another application that is doing something similar and used the above lines. I loaded their trackEngine.js file into a browser and the following code came up. Can a java expert help me understand what is going on in this javascript file? I simply want to capture the IP, page, and referring page in an application outside of the foreign application and process store it using PHP/MySQL. Perhaps someone could provide suggestions and/or comment on the script below. Thanks a lot! var i; var llactid; var myid; myid = 1; mypage = escape(location.href); myref = escape(document.referrer); myip = escape(location.hostaddress); if (i!="undefined") { if (i>10000) { myid = i; } } if (llactid!="undefined") { if (llactid>10000) { myid = llactid; } } if (myref=="") { myref="None"; } if (mypage=="") { mypage="Unavailable"; } var linkreefer = "http://www.URL.com/trackEngine.php?r=" + myref + "&p=" + mypage + "&i=" + myid; document.write ("<img src='" + linkreefer + "'>"); // START FUNCTION TRACK function Track (myid, page) { var mypage = escape(location.href); var myref = escape(document.referrer); var myip = escape(location.hostaddress); var forward = false; if (page!=null) { mypage=page; forward=true; }; if (myref=="") { myref="None"; }; if (mypage=="") { mypage="Unavailable"; }; var linkreefer = "http://www.URL.com/trackEngine.php?i=" + myid + "&r=" + myref + "&p=" + mypage + "&f=" + forward; document.write ("<img src='" + linkreefer + "'>"); if (forward==true) { window.location = (mypage) }; } // END FUNCTION TRACK
  23. hello - That was the problem. I was outputing something to the browser using some echos at the top to test the script. I removed those and the cookie is properly set now. Thank you!
×
×
  • 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.