websoftexpert
-
Posts
21 -
Joined
-
Last visited
Posts posted by websoftexpert
-
-
Thanks, its done.
-
Thanks for valuable reply. But I need to edit existing csv file as it used by other php files for displaying data on web application. Also csv file is created automatically by another software on regular interval based on stock available in real time. In real time stock may drop below prescribed limit. So we need to handle this by editing existing csv file.
Thanks
-
Another code but not working
$myFile = "sample_csv.csv"; //exit(); /**/ $fh = fopen($myFile, 'r+'); while (($data = fgetcsv($fh, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { // echo $data[$c] . "<br />\n"; if($c>3) { //echo $c . "<br />\n"; echo $data[$c] . "<br />\n"; $fields = $data[$c]; if(($fields < 1000) && $fields) { $fields = 10000; } fputcsv($fh, $fields); } } } fclose($fh);
-
Here is code I written
$myFile = "sample_csv.csv"; //exit(); /**/ $fh = fopen($myFile, 'r+'); $theData = fread($fh, filesize($myFile)); //$theData = fgets($fh); $theData = explode("\n", $theData); //print_r($theData); //$theData = nl2br($theData); // converting line break in "<br />" for($i=1; $i<(count($theData)-1);$i++) { $theDataArray = explode(",",$theData[$i]); print "<P>"; //print_r($theDataArray); print "</P>"; //exit; $unit1 = trim($theDataArray[4]); $unit2 = trim($theDataArray[5]); $unit3 = trim($theDataArray[6]); $unit4 = trim($theDataArray[7]); $unit5 = trim($theDataArray[8]); print "<P>"; foreach ($theDataArray as $fields) { print $fields; print ","; if(($fields < 1000) && $fields) { $fields = 10000; } fputcsv($fh, $fields); } print "</P>"; }// for($i=1; $i<(count($theData)-1);$i++) fclose($fh);
Please check and let me know what is wrong in above code. The above is reading csv file but not editing.
-
Hi
I want to edit value of csv file and save edited version of csv file based on condition.
I know how to put condition but do not how to edit that particular line and position which I want to edit in php
attached is sample csv file in pdf format in which I want to edit.
There are column Unit1, Unit2, Unit3, Unit4 etc
suppose if value of unit4 of day 8 is below 100 then I can reset it value to 1000 by php code and save csv file
Thanks for heping us
-
I think so
following value in php.ini file
sendmail_from = no value sendmail_path = /usr/sbin/sendmail -t -i Path to sendmail = /usr/sbin/sendmail -t -i
If you need full php.ini file info, let me know
Thanks
-
use strstr, if it returns true reset $sentance variable .
thanks
I have a text string (which I can't change).
I need to remove from it an entire sentence where a provided value exists in that sentence somewhere.
Example:
$sentence = "The quick brown fox jumped over the lazy dog. This is a test. Thank you."; function remove_sentence($remove_value, $sentence) { //remove all sentences containing $value from $sentence return $new_sentence } remove_sentence("quick brown", $sentence); // returns 'This is a test. Thank you.'
Can someone help me complete this?
-
Hi
I have a website in which I am facing problem in sending EMAIL from FROM. Below is the error details.
=================================================================
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
p.rma@xxxx.com
Gid 5369 is not permitted to relay mail, or has directly called /usr/sbin/exim instead of /usr/sbin/sendmail.
=================================================================
Below is code I am using for sending email
mail($your_email, $subject, $message, "From: $YourName <$EmailAddress>\r\n" . "Reply-To: $YourName <$EmailAddress>\r\n" . "Return-Path: $YourName <$EmailAddress>\r\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"); mail($your_email, $subject, $message, "From: $YourName <$EmailAddress>");
Both of above was working in php 5.2 but not in php5.3
Plz advice/help
Thanks
-
-
Here is code
SMTPClass.php
class SMTPClient { function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body) { $this->SmtpServer = $SmtpServer; $this->SmtpUser = base64_encode ($SmtpUser); $this->SmtpPass = base64_encode ($SmtpPass); $this->from = $from; $this->to = $to; $this->subject = $subject; $this->body = $body; if ($SmtpPort == "") { $this->PortSMTP = 25; }else{ $this->PortSMTP = $SmtpPort; } } function SendMail () { if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP)) { fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n"); $talk["hello"] = fgets ( $SMTPIN, 1024 ); fputs($SMTPIN, "auth login\r\n"); $talk["res"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this->SmtpUser."\r\n"); $talk["user"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this->SmtpPass."\r\n"); $talk["pass"]=fgets($SMTPIN,256); fputs ($SMTPIN, "MAIL FROM: <".$this->from.">\r\n"); $talk["From"] = fgets ( $SMTPIN, 1024 ); fputs ($SMTPIN, "RCPT TO: <".$this->to.">\r\n"); $talk["To"] = fgets ($SMTPIN, 1024); fputs($SMTPIN, "DATA\r\n"); $talk["data"]=fgets( $SMTPIN,1024 ); fputs($SMTPIN, "To: <".$this->to.">\r\nFrom: <".$this->from.">\r\nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n"); $talk["send"]=fgets($SMTPIN,256); //CLOSE CONNECTION AND EXIT ... fputs ($SMTPIN, "QUIT\r\n"); fclose($SMTPIN); // } return $talk; } }
Index.php
$SmtpServer="mail.domainnama.com"; $SmtpPort="25"; $SmtpUser="email@domainname.com"; $SmtpPass="password"; include('SMTPClass.php'); if($_SERVER["REQUEST_METHOD"] == "POST") { $to = xyz@receiverdomainname.com; $from = xyz@senderdomainname.com; $subject = "Subject here"; $body = $_POST['message']; $body = 'Hello xyz@receiverdomainname.com, <BR><BR> The password for your account at http://domainname.com/ has been reset. <BR><BR> Your Ligin Id is xyz@receiverdomainname.com and Password is xxxxxxxx . Please login and change your password immediately.<BR><BR> Please <a href="http://domainname.com/">click here</a> to Login. <BR><BR> Thanks & regards <BR><BR> Webmaster (domainname.com) <BR><BR>'; $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body); $SMTPChat = $SMTPMail->SendMail();
Important note : I have not written the above code but tested it. it works for plain email but not for html email.
I also want send CC and BCC also.
Any help will be appreciated.
Thanks
-
Hi
I am also trying to sent email using SMTP. I have used similar example on internet but that is not working. I think I am missing require page require("Mail.php").
Can you provide me complete working code along with missing require file?
Thanks in advance
-
Hi
I want to send HTML Email with SMTP Authentication but unable to that. I get a code in which I can send Plain Email with SMTP Authentication but not working with HTML Email
Plz help
Thanks
a
-
Hi
Do you have any example?
Please see below.
<?php system("your.sh"); ?>
Am I right?
Thanks
-
Hi
I have shell script (.sh). I have execute it via php file. How to do this?
And how to pass variable in shell script.
Thanks
-
Thanks. Problem Resolved.
-
How? I used following code but I didn't work
for($ii=0;$ii<count($_GET); $ii++)
{
print "<P> ----------------------- $ii -------------------------</P>";
print "<P> +++++++++++++++++++++++++ "; print($_GET['$ii']); print " +++++++++++++++++++++++++</P>";
}
Keep in mind I don't know all variables name coming from $_GET request
-
Hi
How to get value of all $_Request variable so that we can validate for cross scripting. see below
http://srijanlinux.com/consentRequestNew.php?requestId=24753
print count($_GET);
// return ---------- 1
print_r($_GET);
// return ----------- Array ( [requestId] => 24753 )
Now I want to validate value of requestId. I know I can validate by getting using $_GET['requestId'].
But there are changes that I don't know variable name then How validate unknown variable which might be put by hacker.
Thanks
akash
-
Hi
thx for the link. Initially I read I thought It was bit difficult to undersatnd but now I think It is not after getting few things and example.
thanks again
A SINHA
-
Hi
I am new to PHP Chart. I need something tutotrial like help or probabely code sample. I got no. of sample on this forum but didn't work. plz let me know if u can help me.
thanks
A SINHA
-
Hi I wish to create histogram Chart from database table.
There are 13 column in table
Column 1 = 8
Column 2 = 5
Column 3 = 8
Column 4 = 5
Column 5 = 8
Column 6 = 6
Column 7 = 7
Column 8 = 8
Column 9 = 9
Column 10 = 8
Column 11 = 12
Column 13 = 4
Column 13 = 2
I wish to create histogram Chart as shown in attached file
I am using PHP4, But I also work in PHP 5 also.
thanks in advance
A sinha
[attachment deleted by admin]
jquery calender not working via ajax page load in php
in Javascript Help
Posted
I have html page with calender select input. It is working fine when I open in localhost but I call same code in php page via ajax it is not working. Below is HTML Code
If I am call above code in php page and loading that page via ajax the above code not working.
I am using 2 php file delete.php, deleteDateCalender.php
code for delete.php
code for deleteDateCalender.php
deleteDateCalender.php called on click of test button in delete.php
Can anyone see what is wrong in the above code?
Any help will be appreciated.