wonderphp

Some wonder in PHP


General

General

  • Install Spark IM client on Linux

    Install Spark IM client on Linux

    Make sure you should install JAVA before proceeding Spark installation because it’s mandatory to run Spark. # Checking JAVA Version # $ java -version java version “1.7.0_95” OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode) # Download Spark Archive file # $ sudo wget http://download.igniterealtime.org/spark/spark_2_7_6.tar.gz # Extract Spark Archive… Continue reading

  • open new window popup using javascript

    <script> function popupW() { window.open(‘http://google.com&#8217;,’banco’,’toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no’); return true; } popupW(); </script> Continue reading

  • Add recurring task php

    <?php $startDate = $postData[‘start_date’]; $endDate = $postData[‘end_date’]; $endDate = date(“Y-m-d”, strtotime($endDate . ” +1 day”)); /* For weekly schedule * frequency_id: *      ‘1’ => ‘Daily’, *      ‘2’ => ‘alternative day’, *      —-Every——– *      ‘3’ => ‘Monday’, *      ‘4’ => ‘Tuesday’, *      ‘5’ => ‘Wednesday’, *      ‘6’ => ‘Thursday’, *      ‘7’ => ‘Friday’, *      ‘8’ =>… Continue reading

  • phpmyadmin not working after updating php

    Create a link in /var/www like this: sudo ln -s /usr/share/phpmyadmin /var/www/ Note: since 14.04 you may want to use /var/www/html/ instead of /var/www/ (same for php 5) If thats not working for you, you need to include phpmyadmin inside apache configuration. Open apache.conf using your favorite editor, mine is vim 🙂 sudo vim /etc/apache2/apache2.conf… Continue reading

  • equal height elements

    function equalHeight(group) { var tallest = 0; group.each(function() { var thisHeight = $(this).height(); if(thisHeight > tallest) { tallest = thisHeight; } }); group.height(tallest); } equalHeight($(“.commonclass”)); Continue reading

  • Hour dropdown

    <select id=’time’> <?php for($i = 1; $i <= 24; $i++): ?> <option value=”<?= $i; ?>”><?= date(“h.iA”, strtotime(“$i:00″)); ?></option> <?php endfor; ?> </select> <select id=’time’> <option value=”1″>01.00AM</option> <option value=”2″>02.00AM</option> <option value=”3″>03.00AM</option> <option value=”4″>04.00AM</option> <option value=”5″>05.00AM</option> <option value=”6″>06.00AM</option> <option value=”7″>07.00AM</option> <option value=”8″>08.00AM</option> <option value=”9″>09.00AM</option> <option value=”10″>10.00AM</option> <option value=”11″>11.00AM</option> <option value=”12″>12.00PM</option> <option value=”13″>01.00PM</option> <option value=”14″>02.00PM</option> <option value=”15”>03.00PM</option> <option… Continue reading

  • Sending HTML Mail via PHP

    <?php require_once "Mail.php"; require_once "Mail/mime.php"; // see http://pear.php.net/manual/en/package.mail.mail-mime.php // for further extended documentation on Mail_Mime $from = "Web Master “; $to = “Nobody “; $subject = “Test HTML email using PHP Pear w/ SMTP\r\n\r\n”; $text = “This is a text test email message”; $html = “This is an html test email message This Is A… Continue reading

  • Installing PEAR Mail for PHP On Ubuntu

    Just run these commands in terminal sudo apt-get install php-pear sudo pear install mail sudo pear install Net_SMTP sudo pear install Auth_SASL sudo pear install mail_mime and if you want to check that its running or not try code for send mail at Sending HTML Mail via PHP Continue reading

  • html page form enlarge in mobile device

    $(‘input[type=search]’).on(‘focus’, function(){ // replace CSS font-size with 16px to disable auto zoom on iOS $(this).data(‘fontSize’, $(this).css(‘font-size’)).css(‘font-size’, ’16px’); }).on(‘blur’, function(){ // put back the CSS font-size $(this).css(‘font-size’, $(this).data(‘fontSize’)); }); Continue reading

  • Get geolocation contry,city,region_name using js

    function getcurrentlocation() { theUrl=”http://freegeoip.net/json/”+myIP(); xmlhttp.open(‘get’, theUrl, true); xmlhttp.onreadystatechange = ReplyUrl; xmlhttp.send(null); } function ReplyUrl() { if(xmlhttp.readyState == 4) { if(xmlhttp.responseText != “”) { var response = xmlhttp.responseText; var parsedJSON = eval(‘(‘+response+’)’); var location; location = document.getElementById(‘location’).value; console.log(parsedJSON.city+”, “+parsedJSON.region_name+”, “+parsedJSON.country_name); if(parsedJSON.city) location =location+”,”+parsedJSON.city; if(parsedJSON.region_name) location =location+”,”+parsedJSON.region_name; if(parsedJSON.country_name) location =location+”,”+parsedJSON.country_name; console.log(location); document.getElementById(‘location’).value = location; } else {… Continue reading

About Me

A seasoned web developer with over 14 years of experience, has honed a craft across a variety of frameworks and platforms.

Newsletter