Prijava na forum:
Ime:
Lozinka:
Prijavi me trajno:
Trajanje:
Registruj nalog:
Ime:
Lozinka:
Ponovi Lozinku:
E-mail:

ConQUIZtador
nazadnapred
Korisnici koji su trenutno na forumu 0 članova i 1 gost pregledaju ovu temu.


Tema za pitanja
o SMF forumu, phpBB2 i phpBB3 forumu, Wordpress i Joomla CMS sistemima!

Za vecinu drugih pitanja nacicete odgovor citajuci Top teme!

Idi dole
Stranice:
Počni novu temu Nova anketa Odgovor Štampaj Dodaj temu u favorite Pogledajte svoje poruke u temi
Tema: Zasto php kod nece da pise csv file????  (Pročitano 1573 puta)
21. Feb 2013, 13:57:52
Udaljen sa foruma
Clan u razvoju


Zodijak
Pol
Poruke 36
Browser
Opera 12.14
jel zna neko zašto ovaj php kod ne piše u csv file?
Hvala
Kod:
<?php
// Enter your domain without trailing slash
$config['domain'] = 'http://eeee.net';


// Would you like to recieve an email if someone subscribe?
$config['sendmail'] = true;
// Your email address for subscribers and contact form
$config['emailaddress'] = 'kurac@live.com';




// Should a csv file be generated?
$config['savecsv'] = false;
// the name of the CSV file
$config['csvfile'] = 'emails.csv';




// Use MailChimp? (http://www.mailchimp.com/)
$config['mailchimp'] = false;

// API Key - get won at http://admin.mailchimp.com/account/api-key-popup
$config['mc_apikey'] = 'YOUR MAILCHIMP APIKEY';
 
   
// Login to MC account, go to List, then settings, and look for the List ID entry
$config['mc_listId'] = 'YOUR MAILCHIMP LIST ID';




// Use Campaignmonitor? (http://www.campaignmonitor.com/)
$config['campaignmonitor'] = false;

// API Key - see http://www.campaignmonitor.com/api/
$config['cm_apikey'] = 'YOUR CAMPAIGNMONITOR APIKEY';
 
   
// Login to CM account, select a client from the list, go to Lists & Subscribers, then select or create a list, and go to 'change name/type'
$config['cm_listId'] = 'YOUR CAMPAIGNMONITOR LIST ID';
 
 
 
 


// do not edit beneath this point

// make some constants for easy access
foreach($config as $conf => $val){
define('CONF_'.strtoupper($conf),$val);
}

ovo mu je endzajn

Kod:
<?php
//Stop if no Ajax request
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH'])){
header('Location: ./');
exit;
}
if (
function_exists ('ini_set')){
//prevent display errors
 
 ini_set("display_errors"0);
 
  //but log them
 
 ini_set('log_errors'); 
 
  //in the document root
 
 ini_set('error_log'getcwd().'/php_error.log' );
}
//just for development
//error_reporting (E_ALL);

//include the config file
include('config.php');

$the_email addslashes($_POST["email"]);

$return['success'] = false;
$valid checkEmail($the_email);

//write CSV file?
if(CONF_SAVECSV && $valid){
$return['success'] = saveAsCSV($the_email);
}
//Send Email?
if(CONF_SENDMAIL && $valid){
$return['success'] = sendIt($the_email);
}
//Add to Mailchimnp list?
if(CONF_MAILCHIMP && $valid){
$return['success'] = addToMailChimp($the_email);
}
//Add to Mailchimnp list?
if(CONF_CAMPAIGNMONITOR && $valid){
$return['success'] = addToCampaignMonitor($the_email);
}
//output success as JSON
echo json_encode($return);






//Functions

//send Mail
function sendIt($email){
$subject 'New email on '.CONF_DOMAIN;
$msg 'Hello!'."\n";
$msg .= '"'.$email.'" has just joined the List!'."\n\n";
if(CONF_SAVECSV){
$msg .= 'get the full list here: '.CONF_DOMAIN.'/'.CONF_CSVFILE."\n\n";
}
$header 'From: Your Relaunch <'.CONF_EMAILADDRESS.'>' "\r\n" .
'X-Mailer: PHP/' phpversion();
return true;
return mail(CONF_EMAILADDRESS$subject$msg$header);
}

//saves CSV File
function saveAsCSV($email){
$f = @fopen(CONF_CSVFILE'a+');
if (!$f) {
return false;
} else {
$data $email.';'.date('Y-d-m h:i:s')."\n"
$bytes fwrite($f$data);
fclose($f);
return true;
}
}

//add to MailChimp List
function addToMailChimp($email){

require_once 'inc/mailchimp/MCAPI.class.php';

$api = new MCAPI(CONF_MC_APIKEY);

$merge_vars = array();

$email_type 'html';

$retval $api->listSubscribe(CONF_MC_LISTID$email$merge_vars$email_typefalse);

if($api->errorCode){
return false;
} else {
return true;
}
}
//add to CampaignMonitor List
function addToCampaignMonitor($email){

require_once 'inc/campaignmonitor/csrest_subscribers.php';

$wrap = new CS_REST_Subscribers(CONF_CM_LISTIDCONF_CM_APIKEY);
$result $wrap->add(array(
'EmailAddress' => $email,
'Resubscribe' => true
));

if(!$result->was_successful()) {
return false;
} else {
return true;
}
}

//verify the email
function checkEmail($email){
return ($email && preg_match('#^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$#',$email));
}

if (!
function_exists('json_encode'))
{
 
 function json_encode($a=false)
 
 {
 
   if (is_null($a)) return 'null';
 
   if ($a === false) return 'false';
 
   if ($a === true) return 'true';
 
   if (is_scalar($a))
 
   {
 
     if (is_float($a))
 
     {
 
       // Always use "." for floats.
 
       return floatval(str_replace(",""."strval($a)));
 
     }

 
     if (is_string($a))
 
     {
 
       static $jsonReplaces = array(array("\\""/""\n""\t""\r""\b""\f"'"'), array('\\\\''\\/''\\n''\\t''\\r''\\b''\\f''\"'));
 
       return '"' str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
 
     }
 
     else
        return $a
;
 
   }
 
   $isList true;
 
   for ($i 0reset($a); $i count($a); $i++, next($a))
 
   {
 
     if (key($a) !== $i)
 
     {
 
       $isList false;
 
       break;
 
     }
 
   }
 
   $result = array();
 
   if ($isList)
 
   {
 
     foreach ($a as $v$result[] = json_encode($v);
 
     return '[' join(','$result) . ']';
 
   }
 
   else
    
{
 
     foreach ($a as $k => $v$result[] = json_encode($k).':'.json_encode($v);
 
     return '{' join(','$result) . '}';
 
   }
 
 }
}
?>
« Poslednja izmena: 21. Feb 2013, 20:54:47 od Fman »
IP sačuvana
social share
Nema ništa lepše nego kada mi koleginica da da joj mazim macu u toku radnog vremena.
Pogledaj profil GTalk Skype Facebook
 
Prijava na forum:
Ime:
Lozinka:
Zelim biti prijavljen:
Trajanje:
Registruj nalog:
Ime:
Lozinka:
Ponovi Lozinku:
E-mail:
Svedok stvaranja istorije


Zodijak Gemini
Pol Muškarac
Poruke 29198
Zastava Niš
OS
Windows 7
Browser
Mozilla Firefox 17.0
mob
Nokia Lumia 930
Kod:
// Should a csv file be generated?
$config['savecsv'] = true;

Verovatno je ovo u pitanju, nemam vreme da gledam drugi fajl.
IP sačuvana
social share
Pogledaj profil
 
Prijava na forum:
Ime:
Lozinka:
Zelim biti prijavljen:
Trajanje:
Registruj nalog:
Ime:
Lozinka:
Ponovi Lozinku:
E-mail:
Moderator
Jet set burekdzija


Nimalo ne licim na svoj avatar :))

Zodijak Scorpio
Pol Muškarac
Poruke 6660
Zastava Srbija
OS
Windows 7
Browser
Mozilla Firefox 19.0
mob
LG Nexus 4
poruka izmenjena, obrati paznju na recnik. Znam kako ume da nervira, al nije razlog za takvo pisanje ovde.
IP sačuvana
social share
Vezbom do savrsenstva Smiley Smile
Pogledaj profil WWW Twitter Facebook
 
Prijava na forum:
Ime:
Lozinka:
Zelim biti prijavljen:
Trajanje:
Registruj nalog:
Ime:
Lozinka:
Ponovi Lozinku:
E-mail:
Udaljen sa foruma
Clan u razvoju


Zodijak
Pol
Poruke 36
OS
Windows XP
Browser
Opera 12.14
Kod:
// Should a csv file be generated?
$config['savecsv'] = true;

Verovatno je ovo u pitanju, nemam vreme da gledam drugi fajl.
to je to,

SVAKA cast CARE !!!
IP sačuvana
social share
Nema ništa lepše nego kada mi koleginica da da joj mazim macu u toku radnog vremena.
Pogledaj profil GTalk Skype Facebook
 
Prijava na forum:
Ime:
Lozinka:
Zelim biti prijavljen:
Trajanje:
Registruj nalog:
Ime:
Lozinka:
Ponovi Lozinku:
E-mail:
Svedok stvaranja istorije


Zodijak Gemini
Pol Muškarac
Poruke 29198
Zastava Niš
OS
Windows XP
Browser
Chrome 24.0.1312.57
mob
Nokia Lumia 930
Samo si trebao malo da zvirneš u kod. Smiley
IP sačuvana
social share
Pogledaj profil
 
Prijava na forum:
Ime:
Lozinka:
Zelim biti prijavljen:
Trajanje:
Registruj nalog:
Ime:
Lozinka:
Ponovi Lozinku:
E-mail:
Idi gore
Stranice:
Počni novu temu Nova anketa Odgovor Štampaj Dodaj temu u favorite Pogledajte svoje poruke u temi
nazadnapred
Prebaci se na:  
Oznake: pise csv nece file php

Poslednji odgovor u temi napisan je pre više od 6 meseci.  

Temu ne bi trebalo "iskopavati" osim u slučaju da imate nešto važno da dodate. Ako ipak želite napisati komentar, kliknite na dugme "Odgovori" u meniju iznad ove poruke. Postoje teme kod kojih su odgovori dobrodošli bez obzira na to koliko je vremena od prošlog prošlo. Npr. teme o određenom piscu, knjizi, muzičaru, glumcu i sl. Nemojte da vas ovaj spisak ograničava, ali nemojte ni pisati na teme koje su završena priča.

web design

Forum Info: Banneri Foruma :: Burek Toolbar :: Burek Prodavnica :: Burek Quiz :: Najcesca pitanja :: Tim Foruma :: Prijava zloupotrebe

Izvori vesti: Blic :: Wikipedia :: Mondo :: Press :: Naša mreža :: Sportska Centrala :: Glas Javnosti :: Kurir :: Mikro :: B92 Sport :: RTS :: Danas

Prijatelji foruma: Triviador :: Domaci :: Morazzia :: TotalCar :: FTW.rs :: MojaPijaca :: Pojacalo :: 011info :: Burgos :: Alfaprevod

Pravne Informacije: Pravilnik Foruma :: Politika privatnosti :: Uslovi koriscenja :: O nama :: Marketing :: Kontakt :: Sitemap

All content on this website is property of "Burek.com" and, as such, they may not be used on other websites without written permission.

Copyright © 2002- "Burek.com", all rights reserved. Performance: 0.083 sec za 16 q. Powered by: SMF. © 2005, Simple Machines LLC.