PHP: Find maximum odd number of sequence in an array

This is php program that finds the maximum odd number of sequence in an array. By editing, in case of even number also be found out. Code: [php] <?php $x = array(1,7,4,5,7,5,6,3,4,6,87,53,45,567,45,43,66,56,57,5); $tot = count($x); $y = $res = array(); $y[0] = array(); $k = $j = 0; for($i = 0; $i $val) if($max == count($val)) $k = $key; echo “The number of maximum odd sequesnce: $maxThe numbers are:”; var_dump($y[$k]); ?> [/php] Waiting for any better solutions.

Continue Reading

You may also like

A little trick to store data into mysql database from a large form

Sometimes we feel boring to write mysql insertion query to store data into database from a large form where are too many input fields (such as about 50 fields). We face problem to handle all the fields, sometimes we miss the field name. Here is a small trick to store data from such a large form. In this trick, we have to do same naming of table fields and input fields. For example – [html][/html] Then the field name of the database will be “first_name” Then the php code will be: Suppose, name of the submit button is submit [html][/html] […]

Continue Reading

You may also like

jSlider Plugin for jQuery (for 3 horizontal div)

This is my first jQuery plugin. Not so perfect, but it can be used I think This plugin is very easy to use. Doc: This is a small slider content plugin for three horizontal floated div. By clicking on top menu, the divs switch. 1. Just pass the master div id which is wrapping the three floating div in the parameter field named master. 2. Pass id of the three floated divs’ in label parameter under jid index 3. Pass id of the three links’ in label parameter under links index That’s It! You don’t have to mention floated div […]

Continue Reading

You may also like

A Very Simple jQuery Drop Down Menu Plugin

This is a very simple jquery Drop Down Menu Plugin, vertically no doubt. Add latest jQuery in your html like: [html] [/html] [if u don’t have jQuery in your server] HTML Code: [html] Message Write Message Inbox Sent Reward Get reward Send Reward My Reward Friends [/html] Just declare a class named “parent” in the li tag in which you have a submenu. Then its is done. CSS Code: [css] div#menu ul li{ float:left; } div#menu ul li a{ display:block; line-height:27px; text-align:center; color:#FFFFFF; font-size:12px; padding:0 13px; border-right:1px solid #017302; } div#menu ul li a:hover, div#menu ul li a.active{ text-decoration:none; } […]

Continue Reading

You may also like

Setup a web server in Linux Ubuntu

Try the following code in terminal: sudo apt-get install apache (For installing Apache web server) sudo apt-get install php (Install the latest version of PHP) sudo apt-get install mysql-server (Install the latest version of MySQL server) sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin (To link phpmyadmin in your webserver’s root directory) sudo /etc/init.d/apache2 force-reload (To force restart Apache server (now you could access localhost/phpmyadmin from your web browser) That’s It! In the installation you may be asked for mysql password for root. Set as you wish but remember it as you will need it. Thanks: Ronju vai

Continue Reading

You may also like

Some Security Issue (php)

Never, Ever, Trust Your Users It can never be said enough times, you should never, ever, ever trust your users to send you the data you expect. I have heard many people respond to that with something like “Oh, nobody malicious would be interested in my site”. Leaving aside that that could not be more wrong, it is not always a malicious user who can exploit a security hole – problems can just as easily arise because of a user unintentionally doing something wrong. So the cardinal rule of all web development, and I can’t stress it enough, is: Never, […]

Continue Reading

You may also like

Face Ditector Jquery Plugin

Face detection is a common feature in most digital cameras today; the white or red square that pops around someones face when we are focusing the camera on that person. Face detection algorithms enables the software to pinpoint the locations and sizes of human faces in digital images, whatever the surrounding objects may be. Face-Detection is a jQuery plugin that enables you to detect human faces in images. Besides the crucial algorithm that does the main work it uses HTML5 Canvas element to grab the image data. This means that the plugin only works on browsers that support the HTML5 […]

Continue Reading

You may also like

header() function in the middle of a php page

We can’t use header() function in the middle of a page in php. header() function is used for redirection. If the page prints something before this function then we get a message like “header already sent by….blablabla”. But we have another way to use header() function in anywhere of a page. We have to use two more function to make it working perfectly. Those two are: ob_start() in the first line of a page a and ob_flush() in the last line of that page We can omit the second one but there are some problem. I will discuss it later. […]

Continue Reading

You may also like