Jump to content

westman

Members
  • Posts

    600
  • Joined

  • Last visited

Posts posted by westman

  1. Hi all,
    I am working with some old script to remove files and folders.
     

    $directory = "../pics/$id";
    function delete_directory($directory, $empty=false)
    {
      if(substr($directory,-1) == DIRECTORY_SEPARATOR){
        $directory = substr($directory,0,-1);  }
      
      if(!is_dir($directory) || !is_readable($directory)){
        return false;  }
      
      else{
        $handle = opendir($directory);
        while (false !== ($item = readdir($handle))){
          if($item != '.' && $item != '..'){
            $path = $directory.DIRECTORY_SEPARATOR.$item;
            if(is_dir($path)){
              delete_directory($path);	}
            
    		else{
              unlink($path);
            }
          }
        }
        closedir($handle);
     
        if($empty == false){
          if(!rmdir($directory)){
            return false;	}
        }
        return true;	}
    }	
    delete_directory($directory);

    Will this still work in the new php version?

  2. It works nicely in the link you posted but not for me.
    I am also using this script to call in info to fill class="mail_text".

    $( document ).ready(function() {
        $('.pmbutton').click(function(e) {
    	$('.mail_text').load('scripts/message.php', { id : $(this).data('id'),id2 : $(this).data('id2') });
    });
    });


    Could I somehow insert the code needed in here?

  3. <div id="mail_text" class="mail_text" style="max-height:400px; overflow:auto;">
    &nbsp;
    </div>
    <script type="text/javascript">
    var objDiv = document.getElementById("mail_text");
    objDiv.scrollTop = objDiv.scrollHeight;
    </script>

    I am using Chrome.
    Is there a better peace to put my JS?
    My example is not working. 

  4. I am not a fan of Internet Explorer but trying to get my html and css working well with it.

    #nav {
    	font-family:"Arial Black", Gadget, sans-serif;
    	text-align:left;
        display:inline-block;
        width:0px auto;
    	/*width:100%;
    	text-align:right;*/
        margin:0px auto;
        padding:0;
        background:#5C5B5E; /* background color */
    
        border-radius:10px; /*some css3*/
        -moz-border-radius:10px;
        -webkit-border-radius:10px;
        /*box-shadow:0 2px 2px rgba(0,0,0, .5);
        -moz-box-shadow:0 2px 2px rgba(0,0,0, .5);
        -webkit-box-shadow:0 2px 2px rgba(0,0,0, .5);*/
    }
    #nav li {
        margin:10px;
        float:left;
        position:relative;
        list-style:none;
    }
    #nav ul li:first-child > a {
        -moz-border-radius-topleft:10px; /*some css3*/
        -moz-border-radius-topright:10px;
        -webkit-border-top-left-radius:10px;
        -webkit-border-top-right-radius:10px;
    }
    #nav ul li:last-child > a {
        -moz-border-radius-bottomleft:10px; /*some css3*/
        -moz-border-radius-bottomright:10px;
        -webkit-border-bottom-left-radius:10px;
        -webkit-border-bottom-right-radius:10px;
    }
    #nav ul {
        opacity:0;
        visibility:hidden;
        padding:0;
        width:175px;
        position:absolute;
        background:#5C5B5E; /*sub background color*/
        border:1px solid #5C5B5E; /*sub border color*/
    
        border-radius:10px; /*some css3*/
        -moz-border-radius:10px;
        -webkit-border-radius:10px;
        box-shadow:0 2px 2px rgba(0,0,0, .5);
        -moz-box-shadow:0 2px 2px rgba(0,0,0, .5);
        -webkit-box-shadow:0 2px 2px rgba(0,0,0, .5);
    
        -moz-transition:opacity .25s linear, visibility .1s linear .1s;
        -webkit-transition:opacity .25s linear, visibility .1s linear .1s;
        -o-transition:opacity .25s linear, visibility .1s linear .1s;
        transition:opacity .25s linear, visibility .1s linear .1s;
    }
    #nav ul li {
        float:none;
        margin:0;
    }
    
    <div style="position:relative; z-index:2;">    
    <ul id="nav">
            <li><a href="?p=home#home">Home</a></li><br />
            <li><a href="?p=home#services">Services</a></li><br />
            <li><a href="?p=home#about">About us</a></li><br />
            <li><a href = "javascript:void(0)" onclick = "document.getElementById('signin').style.display='block';document.getElementById('fade').style.display='block'">Login</a></li>
    </ul>
    </div>


    How do I get this to be IE friendly?

  5. Dsonesuk,
    Thank you.
    Here is my new code

    
    $uniqueValueArray = [];
    
    while ($stmt->fetch()) {
    $mail_main[] = $mainRow;
    
    if (!in_array($mainRow, $uniqueValueArray)) {
    $uniqueValueArray[] = $mainRow;
    }else{
    continue;
    }
    
    } // END while ($stmt->fetch()) {
    echo implode(', ', $uniqueValueArray);


    It seems to work well.
    Is there any way I can remove the error Adobe DW is showing me with $uniqueValueArray = []; ?

  6. thank you very much for the examples.
    I am not sure I am using them right in my code.
     

    while ($stmt->fetch()) {
    $mail_main[] = $mainRow;
    
    //$uniqueValueArray = []; this alone shows an error in Dreamweaver
    $uniqueValueArray [] = $mainRow;
    while($row = $stmt->fetch()) {
    
    if (!in_array($row, $uniqueValueArray)) {
    $uniqueValueArray[] = $row;
    }
    }
    
    } // END while ($stmt->fetch()) {
    echo implode(', ', $uniqueValueArray);

    What am I doing so wrong?

  7. I have updated the code once more...

    $main_arr = '';
    $main_arr_array = "";
    // code
    while ($stmt->fetch()) {
    $mail_main[] = $mainRow;
    
    $main_arr_array = explode(",", $main_arr);
    if (in_array($mainRow, $main_arr_array, TRUE)){
    continue;
    //break;
    }else{
    $main_arr .= ''.$mainRow.', ';
    //$main_arr .= implode(", ",$mainRow);
    //$tmparray = implode(", ",$tmparray);
    }
    
    }


    I am still not getting the skip.
    Could you give a code example please?
     

  8. thank you.
    I didn't see that.
    I have updated my code

    $main_arr_array = explode(",", $main_arr);
    if (in_array($mainRow, $main_arr_array, TRUE)){
    continue;
    //break;
    }
    $main_arr .= ''.$mainRow.', ';
    
    echo $main_arr;

    This is the result...
    5, 6, 5, 4, 3, 2, 1,
    I only want one 5 to show.
    How do I skip the loop?

  9. Hi all,
    I would like to escape a loop if $mainRow's value has already been called.
    Here is what I have but it is not working.

    while ($stmt->fetch()) {
    $mail_main[] = $mainRow;
    
    $main_arr .= ''.$main_arr.', '.$mainRow.'';
    $main_arr_array = explode(",", $main_arr);
    if (in_array($mainRow, $main_arr_array, TRUE)){
    continue;
    //break;
    }
    }

     

  10. I fond the problem...
    the closing div in <div style=\"color:FFF;\">$text_div</div> was not been seen by my browser.

    So here is what I did to find the best way to get everything working.
    I used 3 files. pm.php, pm2.php, and pmjs.js

    //pm.php
    <?php
    $subject .= '
    <div align="left" style="background-color:#FFF; height:40px; width:600px; padding: 5px; font-size: 16px; border-radius: 15px; box-shadow: inset 5px 0px 0px 0px rgba(42,42,42,.0); text-shadow: 0px 0px 0px rgba(42,42,42,.75); border: 2px solid #1695C4;">
    
    <div class="link_black" style="padding-top:10px; padding-left:5px; float:left;">
    <div class=\'pmbutton\' data-id=\''.htmlentities($idRow).'\' data-id2=\''.htmlentities($mainRow).'\'  >  '.$subjectRow.'  </div>
    </div>
    <div style="float:right; padding-top:10px; padding-right:5px;">
    date
    </div>
    <div style="clear:both;"></div>
    
    </div>
    <br />
    ';
    ?>
    <html>
      <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="pmjs.js"></script>
        
      </head>
      <body>
    <h1>Some text</h1>
    <?php echo $subject; ?>
    <div class='mail_text'></div>
      </body>
     </html>
    
    // pmjs.js
    
    $( document ).ready(function() {
        $('.pmbutton').click(function(e) {
    	$('.mail_text').load('pm2.php', { id : $(this).data('id'),id2 : $(this).data('id2') });
    });
    
    
      });
    
    //pm2.php
    
    <?php
    $text = htmlentities($_REQUEST['id']);
    $text2 = htmlentities($_REQUEST['id2']);
    
    $text = '
    <div align="center" style="padding:15px;">
    <div align="left" style="padding:5px; background-color:#E0E0E0;">
    <div style="float:left;">
    <strong>name</strong>
    </div>
    <div style="float:right;">
    <strong>'.$text2.'</strong>
    </div>
    <div style="clear:both;"></div>
    ' . $text . '
    </div>
    </div>
    ';
    
    ?>
    
    
    <div>this is the output</div>
    <div>div2  &amp; stuff</div>
    
    <?php echo $text; ?>


    works well.
    Dsonesuk, Thank you for suggesting this as you can see I am using "htmlentities" to help.

  11. I mean
     

    $subject_all_show .= '
    <div align="left" style="background-color:#FFF;">
    <div class="link_black" style="padding-top:10px; padding-left:5px; float:left;">
    <a class="link" href = "javascript:void(0)" onclick =document.getElementById(\'text_div\').innerHTML=\'<div style=\"color:FFF;\">'.$text_div.'</div>\'">Text</a>
    </div>
    <div style="float:right; padding-top:10px; padding-right:5px;">
    date
    </div>
    <div style="clear:both;"></div>
    </div>
    <br />';

    <div style="color:FFF;"> and $text_div need to be together in but it does not work. 

  12. That does not work for me and the <div> needs to add css to $text not to the <a>
    In the end $text will have <div>'s and css inside.

×
×
  • Create New...