Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Wednesday, February 22, 2012

Why does my input type=text value get truncated?

SkyHi @ Wednesday, February 22, 2012
When you insert values into textboxes dynamically, you have to remember the same rules that hold true for basic HTML. When you use a string, you must store it within quotes to prevent premature concatenation. :-) 

    <... value=<%=value%>> 

Becomes: 

    <... value="<%=value%>"> 

One thing you want to be careful of is embedded quotes. You might try using ' or " as the delimiter, and eliminating the other for possible entry (using client-side validation of course; the value is destroyed before you'd be able to validate for it on the server side). If you have to allow both ' and ", you could consider using the rarely used "back-apostrophe" (`). You can also try to user Server.HTMLEncode() on the value, before slipping it into the HTML element. 

If you do this: 

<... value='<%="foo's bar"%>'>

This evaluates to: 

<... value='foo's bar'>

And everything after 'foo' is ignored, because the browser interprets that as the end of the string. 


Solution:



; Logging Options


; Defines what classes of security alerts are logged to the syslog daemon.
; Logging of errors of the class S_MEMORY are always logged to syslog, no
; matter what this configuration says, because a corrupted heap could mean that
; the other logging options will malfunction during the logging process.
;suhosin.log.syslog =
; log in /var/log/messages
suhosin.log.syslog = 511    





; Defines the maximum number of variables that may be registered through a POST
; request.
;suhosin.post.max_vars = 200
suhosin.post.max_vars = 1000


; Defines the maximum number of variables that may be registered through the
; COOKIE, the URL or through a POST request. This setting is also an upper
; limit for the variable origin specific configuration directives.
;suhosin.request.max_vars = 200
suhosin.request.max_vars = 1000





REFERENCES
http://classicasp.aspfaq.com/forms/why-does-my-input-type-text-value-get-truncated.html
http://www.frihost.com/forums/vt-104933.html

Monday, November 22, 2010

alternate row colors in PHP/HTML

SkyHi @ Monday, November 22, 2010
<?php
function doAlt($n) {
    if ($n % 2) {
        return 'alt';
    }
}
?>

for ($i = 0; $i <= 4; $i++)  {
    echo '
Row '.$i.'
'; }


$posts = array("Monday","Tuesday","Wednesday","Thursday","Friday","Satursday","Sunday");
$i = '';
foreach($posts as $post){
        echo '
'.$post.'
'; $i++; }


include_once('../smtp/includes/mysqli_connect.php');
$query = "SELECT username, password FROM mailbox";
if ($result = mysqli_query($dbc, $query)) {
        $i='';
        while($row = mysqli_fetch_assoc($result)) {
                echo '
'.$row['username'].$row['password'].'
'; $i++; } /* free result set */ mysqli_free_result($result); } /* close connection */ mysqli_close($dbc);



<style>
.row {
background-color:#000000;
color:#FFFFFF;
width:300px;
}

.rowalt {
background-color:#C0C0C0;
color:#FF0000;
width:300px;
}
</style>


REFERENCES
http://stackoverflow.com/questions/399137/easiest-way-to-alternate-row-colors-in-php-html
http://meetdustin.com/blog/articles/alternating-a-css-class-using-the-modulus-php-arithmetic-operator/
http://www.webdesign.org/web-programming/php/alternating-row-colors.12072.html