Jump to content

websoftexpert

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by websoftexpert

  1. 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

     

     

     

    <html>
       <head>
       <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
       <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
       <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
       <script>
          $(function() {
          $( "#datepicker" ).datepicker({
                numberOfMonths: 3,
                showButtonPanel: true
          });
          });
       </script>
       </head>
    
       <body>
       <input type="text" id="datepicker" />
       </body>
       </html>
    

     

     

     

    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

     

    <html>
    <head>
    <title>test</title>
    
     <script>
    
            function deleteCalDateAjax()
            {
    
            if (window.XMLHttpRequest)
              {// code for IE7+, Firefox, Chrome, Opera, Safari
              xmlhttp=new XMLHttpRequest();
              }
            else
              {// code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            xmlhttp.onreadystatechange=function()
              {
              if (xmlhttp.readyState==4 && xmlhttp.status==200)
                 {
                     //alert(xmlhttp.responseText);
                     document.getElementById("calenderDIV").innerHTML=xmlhttp.responseText;
                     //alert(xmlhttp.responseText);
                 }
              }
    
                xmlhttp.open("GET","deleteDateCalender.php",true);
                xmlhttp.send(null); 
            }
    
     </script>
    
    </head>
    
    <body>
    
                            <form>
                                <input type="button" value="test" onclick="deleteCalDateAjax();" />
                                <div id="calenderDIV">
                                 
                                </div>
                            </form>
    </body>
    </html> 

     

    code for deleteDateCalender.php

     

    <input type="text" id="datepicker" />
    
    
      <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
     <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
     <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
     <script>
     $(function() {
          $( "#datepicker" ).datepicker({
                numberOfMonths: 3,
                showButtonPanel: true
          });
     });
     </script>
    

     

     

     

    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.

  2. 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

  3. 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);
    

  4. 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.

  5. 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

    sample_csv.pdf

  6. 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?

  7. 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

  8. 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

  9. 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

     

     

     

     

     

     

  10. 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]

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.