php-general Digest 2 Jan 2010 21:09:43 -0000 Issue 6518
Topics (messages 300777 through 300781):
Re: Arrays & Regexp - Help Requested
300777 by: Mari Masuda
Re: PHP uploaded files logs
300778 by: Kim Madsen
mod rewrite
300779 by: Sudhakar
300780 by: LinuxManMikeC
Regexp and Arrays
300781 by: Allen McCabe
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
I think the problem is here:
echo '<input type="' . $input_type . '" ';
[...snip...]
elseif ($input_type == 'textarea')
{
echo 'rows="7" cols="30" ';
echo 'value="';
if ($field['null'] == 'YES') // CAN BE NULL?
{
echo 'NULL';
}
echo '" ';
}
because to create a textarea, the HTML is <textarea rows="7" cols="30">default
text</textarea>. It looks like your code is trying to make a textarea that
starts with <input type='.... which won't work. See
http://www.w3.org/TR/html401/interact/forms.html#h-17.7 for how to use textarea.
On Jan 1, 2010, at 3:38 PM, Allen McCabe wrote:
> echo '<input type="' . $input_type . '" ';
> if ($input_type == 'text')
> {
> echo 'size="';
> $length = printByType($field['type'], 'INPUT_LENGTH');
> echo $length;
> echo '" ';
> echo 'value="';
> if ($field['null'] == 'YES') // CAN BE NULL?
> {
> echo 'NULL';
> }
> echo '" ';
> }
> elseif ($input_type == 'textarea')
> {
> echo 'rows="7" cols="30" ';
> echo 'value="';
> if ($field['null'] == 'YES') // CAN BE NULL?
> {
> echo 'NULL';
> }
> echo '" ';
> }
--- End Message ---
--- Begin Message ---
Daniel Egeberg wrote on 01/01/2010 17:10:
No, Apache doesn't log POST data only the request.
And even if it did, not all hosting companies give you access to your
access and error log files...
Making your own logfile is a good way to debug, for instance I had a
problem with creating a zip header, in that case you can't print to the
screen, so putting debug info in a php generated logfile is a easy way
to move on...
--
Kind regards
Kim Emax - masterminds.dk
--- End Message ---
--- Begin Message ---
hi
i am using a cms which requires mod_rewrite to be enabled for seo urls
in the wamp that i use in my local machine in the httpd.conf file i have
this line and removed the comment
LoadModule rewrite_module modules/mod_rewrite.so
when i view the phpinfo i can see that mod_rewrite is on in the Loaded
Modules
i am guessing that my hosting might not allow to edit the httpd.conf file so
i tried adding the following to the .htaccess which is in the root directory
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
and uploaded the .htaccess file and when i viewed the phpinfo i do not see
mod_rewrite for my webserver
also on my server i would be installing the cms in a separate folder after
the root directory, so i guess the .htaccess file should be
Options +FollowSymLinks
RewriteEngine On
RewriteBase /foldername
how do i go about enabling mod_rewrite in the .htaccess file as i might not
be able to edit httpd.conf
please advice.
thanks
--- End Message ---
--- Begin Message ---
On Sat, Jan 2, 2010 at 12:52 AM, Sudhakar <sudhakarar...@gmail.com> wrote:
> hi
>
> i am using a cms which requires mod_rewrite to be enabled for seo urls
>
> in the wamp that i use in my local machine in the httpd.conf file i have
> this line and removed the comment
> LoadModule rewrite_module modules/mod_rewrite.so
>
> when i view the phpinfo i can see that mod_rewrite is on in the Loaded
> Modules
>
> i am guessing that my hosting might not allow to edit the httpd.conf file so
> i tried adding the following to the .htaccess which is in the root directory
>
> Options +FollowSymLinks
> RewriteEngine On
> RewriteBase /
>
> and uploaded the .htaccess file and when i viewed the phpinfo i do not see
> mod_rewrite for my webserver
>
> also on my server i would be installing the cms in a separate folder after
> the root directory, so i guess the .htaccess file should be
> Options +FollowSymLinks
> RewriteEngine On
> RewriteBase /foldername
>
>
> how do i go about enabling mod_rewrite in the .htaccess file as i might not
> be able to edit httpd.conf
>
> please advice.
>
> thanks
>
Can't be done in .htaccess. Ask tech support to enable it or switch
hosting providers.
--- End Message ---
--- Begin Message ---
I have been plauged for a few days by this, can anyone see a problem with
this function??
function printByType($string, $mode)
{
(string) $string;
$lengths = array(
'VARCHAR' => 10
, 'TINYINT' => 1
, 'TEXT' => 10
, 'DATE' => 7
, 'SMALLINT' => 1
, 'MEDIUMINT' => 2
, 'INT' => 2
, 'BIGINT' => 3
, 'FLOAT' => 4
, 'DOUBLE' => 4
, 'DECIMAL' => 4
, 'DATETIME' => 10
, 'TIMESTAMP' => 10
, 'TIME' => 7
, 'YEAR' => 4
, 'CHAR' => 7
, 'TINYBLOB' => 10
, 'TINYTEXT' => 10
, 'BLOB' => 10
, 'MEDIUMBLOB' => 10
, 'MEDIUMTEXT' => 10
, 'LONGBLOB' => 10
, 'LONGTEXT' => 10
, 'ENUM' => 5
, 'SET' => 5
, 'BIT' => 2
, 'BOOL' => 1
, 'BINARY' => 10
, 'VARBINARY' => 10);
$types = array(
'VARCHAR' => 'text'
, 'TINYINT' => 'text'
, 'TEXT' => 'textarea'
, 'DATE' => 'text'
, 'SMALLINT' => 'text'
, 'MEDIUMINT' => 'text'
, 'INT' => 'text'
, 'BIGINT' => 'text'
, 'FLOAT' => 'text'
, 'DOUBLE' => 'text'
, 'DECIMAL' => 'text'
, 'DATETIME' => 'text'
, 'TIMESTAMP' => 'text'
, 'TIME' => 'text'
, 'YEAR' => 'text'
, 'CHAR' => 'text'
, 'TINYBLOB' => 'textarea'
, 'TINYTEXT' => 'textarea'
, 'BLOB' => 'textarea'
, 'MEDIUMBLOB' => 'textarea'
, 'MEDIUMTEXT' => 'textarea'
, 'LONGBLOB' => 'textarea'
, 'LONGTEXT' => 'textarea'
, 'ENUM' => 'text'
, 'SET' => 'text'
, 'BIT' => 'text'
, 'BOOL' => 'text'
, 'BINARY' => 'text'
, 'VARBINARY' => 'text');
switch ($mode)
{
case 'INPUT_LENGTH':
foreach ($lengths as $key => $val)
{
(string) $key;
(int) $val;
// DETERMINE LENGTH VALUE eg. int(6) GETS 6
preg_match('#\((.*?)\)#', $string, $match);
(int) $length_value = $match[1];
// SEARCH
$regex = "/" . strtolower($key) . "/i";
$found = preg_match($regex, $string);
if ($found !== false)
{
// DETERMINE ADD INTEGER eg. If the length_value is long enough,
determine number to increase html input length
switch ($length_value)
{
case ($length_value <= 7):
return $length_value;
break;
case ($length_value > 7 && $length_value < 15):
return $val += ($length_value/2);
break;
case ($length_value > 14 && $length_value < 101):
$result = ($length_value / 5);
$divide = ceil($result);
return $val += $divide;
break;
case ($length_value > 100):
return 40;
break;
default:
return 7;
break;
}
return $val;
}
else
{
return 7; // default value
}
}
break;
case 'INPUT_TYPE':
foreach ($types as $key => $val)
{
(string) $val;
(string) $key;
// SEARCH
$regex = "/" . strtolower($key) . "/i";
$found = preg_match($regex, $string);
if ($found === false)
{
return 'text'; // default value
}
else
{
return $val;
}
}
break;
}
} // END function printByType()
--- End Message ---