PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/site/importer/mymailru.php

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