Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. <head>

     

    
    <?php
    
    echo"
    <script>
    function showHide(inID) {
         if (document.getElementById(inID).style.display == 'none') {
              document.getElementById(inID).style.display = 'block';
         } else {
              document.getElementById(inID).style.display = 'none';
         }
    }
    
    function Show(inID) {
         if (document.getElementById(inID).style.display == 'none') {
              document.getElementById(inID).style.display = 'block';
         } else {
              document.getElementById(inID).style.display = 'block';
         }
    }
    
    function Hide(inID) {
         if (document.getElementById(inID).style.display == 'block') {
              document.getElementById(inID).style.display = 'none';
         } else {
              document.getElementById(inID).style.display = 'none';
         }
    }
    </script>
    ";
    ?>

    </head>

     

    <body>

     

    <?php
    
    echo"
    
    <a href=\"javascript:void(0)\" onclick=\"Show('somthing')\">read more...</a>
    <a href=\"javascript:void(0)\" onclick=\"Hide('somthing')\">read more...</a>
    <a href=\"javascript:void(0)\" onclick=\"showHide('somthing')\">read more...</a>
    
    <div id='something' style='display: none'>reas more content</div>
    
    ";
    
    ?>

    </body>

  2. 
    <a href="javascript:void(0)" onclick="Show('somthing')">read more...</a>
    <a href="javascript:void(0)" onclick="Hide('somthing')">read more...</a>
    <a href="javascript:void(0)" onclick="showHide('somthing')">read more...</a>
    
    <div id='something' style='display: none'>reas more content</div>
    
    

  3. <script>
    function showHide(inID) {
         if (document.getElementById(inID).style.display == 'none') {
              document.getElementById(inID).style.display = 'block';
         } else {
              document.getElementById(inID).style.display = 'none';
         }
    }
    
    function Show(inID) {
         if (document.getElementById(inID).style.display == 'none') {
              document.getElementById(inID).style.display = 'block';
         } else {
              document.getElementById(inID).style.display = 'block';
         }
    }
    
    function Hide(inID) {
         if (document.getElementById(inID).style.display == 'block') {
              document.getElementById(inID).style.display = 'none';
         } else {
              document.getElementById(inID).style.display = 'none';
         }
    }
    </script>
    

  4. When the query is sent the code for the <texrarea> is iserted as follows...

     

     

    $AdditionalComments=stripslashes($_POST['AdditionalComments']);
    $AdditionalComments=htmlentities($AdditionalComments, ENT_QUOTES);
    $AdditionalComments=nl2br($AdditionalComments);
    
    
    The DB TEXT Field contains: 
    
    Angelo&#039;s Test
    <br />
    <br />
    Info after breaks
    
    

     

     

     

     

    The problem is when I display the <texrarea> for updating it shows  <br />

     

    So I suppose the question is how can I display a $row without dispaying the <br />

     

     

  5. This gets it close:

     

    $file_1="../documents/Appraisal Agreement.doc";
    $file_2="../documents/Overview.pdf";
    
    $InputFile = array("Appraisal Agreement","Overview");
    
    $files = array("$file_1","$file_2");
    
    
    foreach($files as $filenames){
    
    $ext = end(explode('.', $filenames));
    
    $ext = substr(strrchr($filenames, '.'), 1);
    
    $ext = substr($filenames, strrpos($filenames, '.') + 1);
    
    $ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filenames);
    
    $exts = split("[/\\.]", $filenames);
    
    $n = count($exts)-1;
    $ext = $exts[$n];
    
    $THE_EXT[]= ".".$ext;
    
    }
    
    foreach($InputFile as $InputName){
    
    $THE_NAME[]= $InputName;
    
    }
    
    $FinalArray = array_merge($THE_NAME, $THE_EXT);
    
    print_r ($FinalArray);

     

     

    Array ( [0] => Appraisal Agreement [1] => Overview [2] => .doc [3] => .pdf )

     

  6. I am trying to take away "../documents/" and just end up with:

     

    $FinalArray = array("Agreement.doc","Overview.pdf");

     

    At the end of the code I would like an array with these values:

     

    This code ain't workin'...

     

    <?
    
    $file_1="../documents/Agreement.doc";
    $file_2="../documents/Overview.pdf";
    
    $InputFile = array("Appraisal Agreement","Overview");
    
    $files = array("$file_1","$file_2");
    
    
    foreach($files as $filenames){
    
    $ext = end(explode('.', $filenames));
    
    $ext = substr(strrchr($filenames, '.'), 1);
    
    $ext = substr($filenames, strrpos($filenames, '.') + 1);
    
    $ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filenames);
    
    $exts = split("[/\\.]", $filenames);
    
    $n = count($exts)-1;
    $ext = $exts[$n];
    
    $THE_EXT.$ext;
    
    }
    
    foreach($InputFile as $InputName){
    
    $THE_NAME= $InputName;
    
    }
    
    
    $FinalArray = PROBLEM
    
    ?>
    

  7. There are a couple of problems:

     

    1. The pages stall excessively while running the script.

     

    3. This send the attachment (doc) but rewrites the content.

     

    2. If I send a pdf (with the appropriate headers) I get a corrupted pdf in my inbox

     

    Without the attach code it sends a perfect html email.

     

    NOTE: This is on a windows server.

     

    Cant anyone help me out with this?

     

    <?php
    
    $message = "
    
    <table border='0' width='750'>
    <tr>
    	<td>TEST</td>
    </tr>
    </table>
    
    
    ";
    
    $filename = "TradeMark.doc";
    $filetype = "application/doc";
    $filecontents = file_get_contents($filename);
    
    $Name = "Senders Name"; 
    $email = "from@my_site.com";
    $recipient = "to@my_site.com"; 
    $subject = "Subject for reviever"; 
    
    $emailid=md5(time());
    $headers = "From: ". $Name . " <" . $email . ">\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: multipart/mixed;";
    $headers .= "boundary=$emailid\r\n--".$emailid."\r\n";
    //$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
    $headers .= "Content-Type: text/html; charset=\"utf-8\"\r\n";
    $headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n".$message."\r\n--".$emailid."\r\n";
    $headers .="Content-Type: ".$filetype."; name=\"".$filename."\"\r\n";
    $headers .="Content-Transfer-Encoding: base64\r\n";
    $headers .="Content-Disposition: attachment; filename=\"$filename\"\r\n\r\n".chunk_split(base64_encode($filecontents))."\r\n--".$emailid."--";
    
    mail($recipient, $subject, $message, $headers);
    
    
    ?>

     

    I know about php mailer, and swift; but I really don't want the extensive coding for a simple task.

  8. I do not want any special characters but spaces and capital Letters are OK

     

    The code below is blocking spaces and capital letters I think

     

    if (!preg_match('/^[^a-z0-9-_]+$/i',$docName)){
    $error="<script>alert('The Document Name May Only Contain Letter And Numbers')</script>";
    }

     

    Any help?

  9. I am delteting a file from a directory and get this error.

     

    unlink(test.pdf) [function.unlink]: No such file or directory in...

     

    HOWEVER THE FILE IS BEING DELETED???

     

    <?
    $docName=$_POST['docName'];
    $location=$_POST['location'];
    $id=$_POST['id'];
    
    $TheFile=$location;
    unlink($TheFile);
    
    $delete=mysql_query("DELETE FROM documents WHERE id='$id'");
    ?>
    

     

    Can anyone explain this?

  10. This code shows Zero if there are now rows.  It makes sence but is there a way to not show the Zero and start with 1?

     

    $DocCount = mysql_query("SELECT * FROM documents");
    $num_rows = mysql_num_rows($DocCount);
    
    $i=$num_rows;
    while($i<=3)
    {
    echo "$num_rows document(s) in this row.";
    
    $i++
    }

     

    So if there are no rows the output would be:

    "1 document(s) in this row"

     

    $help="hopeful";

     

    if ($help=="useful") {echo "Thank you PHP Freaks!";}

     

    else  {echo "Dang...I'll keep banging my head";}

     

  11. The ip was comming from a diferrent page (sorry I didn't include that code).

     

    $ip=$_SERVER['REMOTE_ADDR'];

     

    This works...I changed to a while loop

     

    $query = mysql_query("SELECT * FROM adminip");
    
    while($row = mysql_fetch_array($query)) < CHANGED
     {
     $deny[]=$row[content]; // < CHANGED
     }
    
    //print_r($deny); << shows the array
    
    if (!in_array ($ip, $deny)) {
    
    echo("THIS SITE IS UNDERGOING CONSTRUCTION");
    exit();
    
    }

  12. Here is what I use:

     

    if (isset($_POST['importFile'])){
    
    
    $target_path = "";
    
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
    
    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        $thefile=basename( $_FILES['uploadedfile']['name']);
    } else{
        echo "There was an error uploading the file, please try again!";
    }
    
    
    
    include ("../con.php");
    
      $fcontents = file ("$thefile");  
      
      # expects the csv file to be in the same dir as this script 
      
      for($i=0; $i<sizeof($fcontents); $i++) {  
      
          $line = trim($fcontents[$i]);  
          
          $arr = explode("\t", $line);  
          
          $sql = "insert into TABLE values (' ', '". substr(implode("''", $arr),1) ."')";  
                      
          mysql_query($sql); 
          
          if(!mysql_error()) { 
          header("location: import_form.php"); 
          }
          
      elseif(mysql_error()){
      echo "IMPORT FAILED";
      }  
    }
    
    mysql_query("INSERT INTO uploaded (id, name, stamp) VALUES ('', '$thefile', '$DATE_TIME_STAMP')");
    
    mysql_close($con);
    
    $myFile = "$thefile";
    unlink($myFile);
    
    }  // END IF SUBMIT

  13. I only want to allow the IPs in my DB to acces my site.

     

    I think I am close but the script I have isn't working right.

     

    Any help today?

     

    <?php
    
    $query = mysql_query("SELECT * FROM adminip WHERE id='1'");
    $row = mysql_fetch_array($query);
    
    $deny = array($row[content]);
    
    //print_r($deny);  // << I can see ti IP arrray from the DB
    
    if (!array_key_exists($ip, $deny)) {
    
    echo("THIS SITE IS UNDERGOING CONSTRUCTION");
    exit();
    
    }
    
    
    ?>

     

    Thank you!

  14. I need to take an id number in a row and have php decide if it is an even or odd number.

     

    This is for asthetics only. 

     

    If the row is odd it will display a slightly different color background.

     

    <?
    $result = mysql_query("SELECT * FROM feeschedule");
    while($row = mysql_fetch_array($result))
      {
      $id=$row['id'];
      $appType=$row['appType'];
      
      echo"
    <tr ***I AM USING IT HERE TO DISPLAY A DIFFERENT COLOR BACKGROUND***>
    <td class='displayText'>$appType</td>
    <td class='displayText'>$<input type='' name='24hr$id' value='' /></td>
    <td class='displayText'>$<input type='' name='3days$id' value='' /></td>
    <td class='displayText'>$<input type='' name='7days$id' value='' /></td>
    </tr>
      ";
    
      }	
    ?>	

     

    Thanks PHP Freaks!

  15. Make sure nothing is being echo-ed or printed on these pages:

     

    require_once("includes/session.php");

    require_once("includes/connection.php");

    require_once("includes/functions.php");

     

    ------------------------------------------------------------

     

    The problem in the code presented is:

     

    echo "beforeHeader"."<br/>"; // NO HTML BEFORE THE HEADER REDIRECT

    header('Location: imgSelect.php');

     

     

     

  16. How can I test for file type and only allow gif, jpeg, png witht the script below?

     

    function findexts ($filename) 
    { 
    $filename = strtolower($filename) ; 
    $exts = split("[/\\.]", $filename) ; 
    $n = count($exts)-1; 
    $exts = $exts[$n]; 
    return $exts;
    } 
    
    $ext = findexts ($_FILES['uploaded']['name']) ; 
    
    $new = $_SESSION['LOGO'].".";
    
    $target = "logos/";
    
    $target = $target . $new.$ext; 
    
    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
    {
    ...stuff
    }

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