prosoxi.com | Author Archives

Author Archives | kostas

display an object inf javascript

Here’s how to show the contents of a object in Javascript

function concatObject(obj) {
  str='';
  for(prop in obj)
  {
    str+=prop + " value :"+ obj[prop]+"\n";
  }
  return(str);
}

 Continue Reading

Posted in JavaScript - Ajax, Programming0 Comments

Quotes in mysql queries – security issue

Remember to check numeric data as well. If an application generates a query such as SELECT * FROM table WHERE ID=234 when a user enters the value 234,the user can enter the value 234 OR 1=1 to cause the application to generate the query SELECT * FROM table WHERE ID=234 OR 1=1.As a result, the server retrieves every row in the table. This exposes every row and causes excessive server load. The simplest way to protect from this type of attack is to use single quotes around the numeric constants: SELECT * FROM table WHERE ID='234'.  If the user enters extra information, it all becomes part of the string. In a numeric context, MySQL automatically converts this string to a number and strips any trailing nonnumeric characters from it. It means that if the user enters 234myname the value remains 234. Another option is to do a check before the mysql query if the value is numeric.

Source http://dev.mysql.com/doc/refman/5.0/en/security-guidelines.html

Posted in MySQL0 Comments

htaccess – friendly url tips

suppose you want example

#weeddingplans
RewriteRule ^weddingplanners$ shop.php?sub=31&id=7 [L,S]

RewriteCond %{REQUEST_URI} /shop.php [NC]
RewriteCond %{QUERY_STRING} ^id=7&sub=31
RewriteRule (.*) http://www.wedstar.gr/weddingplanners? [R=301]

Posted in Programming0 Comments

friendly url with htaccess

suppose you want /articles.php?cat=$1&art=$2 to become magazine/1/2

then you need these two rules:

#articles.php?cat=$1&art=$2
RewriteRule ^magazine/([^/]*)/([^/]*)$ /articles.php?cat=$1&art=$2&marker [L]

RewriteCond %{REQUEST_URI} /articles\.php [NC]
RewriteCond %{QUERY_STRING} ^cat=(.*)&art=(.*)
RewriteCond %{QUERY_STRING} !marker

RewriteRule (.*) http://mydomain/%1/%2? [R=301,L]

Posted in .htaccess0 Comments

Setup network interface in linux systems

Κάποιες χρήσιμες εντολές για το σετάρισμα κάρτας δικτύου (π.χ. eth0) σε περιβάλλον linux.

  • View:  ifconfig -a (ή eth0)
  • Assign ip address to interface: ifconfig eth0 192.168.1.102 netmask 255.255.255.0 up

ifconfig’s syntax and command layout:

ifconfig <interface> <ip_address> [ netmask <netmask> ]
Continue Reading

Posted in Linux, Network2 Comments

Display correctly Greek characters at subject of an email

You can use this function when the subject at an email is not displayed correctly.

The idea is to base64_encode the subject header.  Something like Continue Reading

Posted in Linux, PHP, Tips & Tricks0 Comments

Ajax – dynamic content with link history

Use this script to update content dynamicaly. Original source from

http://www.unfocus.com/projects/historykeeper/ Continue Reading

Posted in JavaScript - Ajax, PHP0 Comments

Page break with php-fckeditor

php code

<?php
if (stripos($row_latestnews['nws_text_gr'],”<div style=\”page-break-after: always;\”><span style=\”display: none;\”>&nbsp;</span></div>”)<1)
echo substr($row_latestnews['nws_text_gr'],0,180);
else
{
$str=split(“<div style=\”page-break-after: always;\”><span style=\”display: none;\”>&nbsp;</span></div>”,$row_latestnews['nws_text_gr']);
echo $str[0];

}

?>

Posted in JavaScript - Ajax, PHP0 Comments


Domain Finder

Domain Finder Tool by Truste.gr

read more for domains

Advertisers

Wedstar all about wedding - gamos - γαμος
Κατασκευή ιστοσελίδων
Domain Names | Hosting

Adds