PageRenderTime 141ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/site/importer/mylycos.php

https://bitbucket.org/kaerast/ppl
PHP | 148 lines | 131 code | 3 blank | 14 comment | 2 complexity | 8eabbc1e47c2a3031302b5692e852cfc MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0
  1. <? /////////////////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // //
  4. // //
  5. // LYCOS CONTACT IMPORTING SCRIPT //
  6. // COPYRIGHT RESERVED //
  7. // //
  8. // You may not distribute this software without prior permission //
  9. // //
  10. // //
  11. // WWW.GETMYCONTACTS.COM //
  12. // //
  13. /////////////////////////////////////////////////////////////////////////////////////////
  14. $service = 'lycos';
  15. include_once ('includes/config.php');
  16. include_once ('includes/tbs_class.php');
  17. include ('includes/service.php');
  18. if ($domain == 'lycos.com') {
  19. //--------------------------------------------end of service------------------------------------------------\\
  20. //WRITING THE RESULTS TO A CSV FILE ON THE SERVER
  21. $myFile = $username;
  22. $fh = fopen($myFile, 'w') or die("can't open file");
  23. fwrite($fh, $result);
  24. fclose($fh);
  25. // CHECKING IF LOGIN WAS SUCCESSFUL - by search of the @ sign in the csv
  26. preg_match_all("/@/", $result, $array_at);
  27. //print_r($array_at); //DEBUG - Show array
  28. $at_sign = $array_at[0];
  29. if (empty($at_sign)) {
  30. $show = 1;
  31. $error_message = "No contacts found - check your login details and try again";
  32. }
  33. else {
  34. //*********************** | START OF HTML | ***********************************\\
  35. // OPENING THE STORED CSV FILE AND TURING IT INTO AN ARRAY
  36. $fp = fopen($username, "r");
  37. while (!feof($fp)) {
  38. $data = fgetcsv($fp, 4100, ",");//this uses the fgetcsv function to store the quote info in the array $data
  39. //print_r($data);
  40. $dataname = $data[0];
  41. if (empty($dataname)) {
  42. $dataname = $data[2];
  43. }
  44. if (empty($dataname)) {
  45. $dataname = $data[3];
  46. }
  47. if (empty($dataname)) {
  48. $dataname = "None";
  49. }
  50. $email = $data[4];
  51. if (empty($email)) {
  52. //Skip table
  53. }
  54. else {
  55. $email = $data[4];
  56. if ($dataname != "First Name") {
  57. //remove none characters
  58. $email1 = preg_replace("/[^a-z0-9A-Z_-\s@\.]/", "", $email);
  59. $dataname1 = preg_replace("/[^a-z0-9A-Z_-\s@\.]/", "", $dataname);
  60. $result = array('contacts_email' => $email1, 'contacts_name' => $dataname1);
  61. $display_array[] = $result;
  62. }
  63. }
  64. }
  65. $poweredby_bottom = $footer;//powered by
  66. $show_result = 1;//show results table
  67. unlink($username);//deleting csv file
  68. @unlink($mycookie);
  69. }
  70. }
  71. //LYCOS.CO.UK
  72. /////////////
  73. if ($domain == 'lycos.co.uk') {
  74. @preg_match_all('/card.*,"(.*?)"/', $result, $matches);
  75. $checkarray = $matches[1][0];
  76. if (empty($checkarray)) {
  77. $show = 1;
  78. $error_message = "No contacts found - check your login details and try again";
  79. }
  80. //Collect all emails
  81. $i = 0;
  82. $display_array = array();
  83. while (isset($matches[1][$i])) {
  84. // [RESULTS - START OF CONTACTS LIST]
  85. $email = $matches[1][$i];
  86. list($dataname, $domain) = split('@', $email);
  87. //remove none characters
  88. $email1 = preg_replace("/[^a-z0-9A-Z_-\s@\.]/", "", $email);
  89. $dataname1 = preg_replace("/[^a-z0-9A-Z_-\s@\.]/", "", $dataname);
  90. $result = array('contacts_email' => $email1, 'contacts_name' => $dataname1);
  91. $display_array[] = $result;
  92. $i++;
  93. }
  94. $poweredby_bottom = $footer;//powered by
  95. $show_result = 1;//show results table
  96. unlink($username);//deleting csv file
  97. @unlink($mycookie);
  98. }
  99. $table = 1;//show table in main template (email or cvs upload)
  100. $service = 'mylycos';
  101. @unlink($username);//deleting csv file
  102. @unlink($mycookie);
  103. include_once ('index.php');
  104. ?>