PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/site/importer/mymail.php

https://bitbucket.org/kaerast/ppl
PHP | 112 lines | 91 code | 5 blank | 16 comment | 0 complexity | da1ac93533876cde1d69817bf6391ce5 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0
  1. <?
  2. /////////////////////////////////////////////////////////////////////////////////////////
  3. // //
  4. // //
  5. // //
  6. // MAIL.COM CONTACT IMPORTING SCRIPT //
  7. // COPYRIGHT RESERVED //
  8. // //
  9. // You may not distribute this software without prior permission //
  10. // //
  11. // //
  12. // WWW.GETMYCONTACTS.COM //
  13. // //
  14. /////////////////////////////////////////////////////////////////////////////////////////
  15. //******************************* | SETTING VARIABLES | ***********************************\\
  16. $service = 'mail';
  17. include_once ('includes/config.php');
  18. include_once ('includes/tbs_class.php');
  19. include ('includes/service.php');
  20. //--------------------------------------------end of service------------------------------------------------\\
  21. //WRITING THE RESULTS TO A CSV FILE ON THE SERVER
  22. $myFile = $username;
  23. $fh = fopen($myFile, 'w') or die("can't open file");
  24. fwrite($fh, $result);
  25. fclose($fh);
  26. // CHECKING IF LOGIN WAS SUCCESSFUL - by search of the @ sign in the csv
  27. preg_match_all("/@/", $result, $array_at);
  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. }ELSE{
  33. //*********************** | START OF HTML | ***********************************\\
  34. // OPENING THE STORED CSV FILE AND TURING IT INTO AN ARRAY
  35. $fp = fopen ($username,"r");
  36. while (!feof($fp)){
  37. $data = fgetcsv ($fp, 4100, ","); //this uses the fgetcsv function to store the quote info in the array $data
  38. //print_r($data);
  39. $dataname = $data[0];
  40. IF (empty($dataname)){
  41. $dataname = $data[2];
  42. }
  43. IF (empty($dataname)){
  44. $dataname = $data[3];
  45. }
  46. IF (empty($dataname)){
  47. $dataname = "None";
  48. }
  49. $email = $data[4];
  50. IF (empty($email)){
  51. //Skip table
  52. }ELSE{
  53. $email = $data[4];
  54. IF ($dataname != "First Name"){
  55. //remove none characters
  56. $email1 = preg_replace("/[^a-z0-9A-Z_-\s@\.]/","",$email);
  57. $dataname1 = preg_replace("/[^a-z0-9A-Z_-\s@\.]/","",$dataname);
  58. $result = array('contacts_email' => $email1,'contacts_name' => $dataname1);
  59. $display_array[] = $result;
  60. }
  61. }
  62. }
  63. $poweredby_bottom = $footer;//powered by
  64. $show_result = 1;//show results table
  65. unlink($username);//deleting csv file
  66. @unlink($mycookie);
  67. }
  68. $table = 1;//show table in main template (email or cvs upload)
  69. $service = 'mymail';
  70. @unlink($username);//deleting csv file
  71. @unlink($mycookie);
  72. include_once ('index.php');
  73. ?>