jump to navigation

My First PHP 5 Class Contribution at phpclasses.org February 13, 2007

Posted by ordinarywebguy in Javascript, MySQL, OOP, PHP, PHP 5.
4 comments

Entry: MySQL Data Abstraction Layer Class and Data Manipulation Class

After getting bored working with PHP 4 and deciding to get my hands dirty with PHP 5 and its OOP capability, it got me to have the classes and example and contribute it at phpclasses.org. I would have to say that its worth messing with it as you’ve be able to define the ranges or scopes of your classes, methods and its properties. Whew! I also have to say that I missed a lot of features of PHP 5 since we’re still using PHP 4 at work. And what I did was to convert the said classes to PHP 4 to be able to ulitize it. There’s only a minor modifications to it, removed access specifiers (public, private and protected) and turn “self::” to “$this->”, “__construct” to “name of class itself” and thats it.

Anyway back to my entry, you can download it here or view demo here. I’m hoping that it’ll be approved within 12 days by phpclasses people and be able helped somebody in learning PHP 5 and OOP.

GMaps with PHP and Mysql January 17, 2007

Posted by ordinarywebguy in GMaps, Google Maps, MySQL, PHP.
6 comments

I’ve seen lots of gmaps website integration samples and tutorials but I mostly found out that it’s still using the old way of getting the latitude and longitude for a particular location in other website’s geocoding services http://rpc.geocoder.us/ for US locations and http://geocoder.ca/ for US and Canada locations then storing it in database, extracting it to xml file or within javascript code. That was when gmaps doesn’t have yet the GClientGeocoder() class. And here’s my version of it.

Extracting data in DB.

gmaps_js.php


var gmarkers = [];
var htmls = [];function gmapsLoad() {
if(GBrowserIsCompatible()) {
if(!document.getElementById(‘map’)) return false;
var map = new GMap2(document.getElementById(‘map’));
//map.enableContinuousZoom();
//map.enableDoubleClickZoom();
map.addControl(new GSmallMapControl());
map.addControl(new GScaleControl());
var geocoder = new GClientGeocoder();

var icon = new GIcon();
var markerStyle = ‘Push-Pin’;
var markerColor = ‘Slate’;
icon.image = ‘http://google.webassist.com/google/markers/pushpin/slate.png’;
icon.shadow = ‘http://google.webassist.com/google/markers/pushpin/shadow.png’;
icon.iconSize = new GSize(40,41);
icon.shadowSize = new GSize(40,41);
icon.iconAnchor = new GPoint(7,38);
icon.infoWindowAnchor = new GPoint(26,4);
icon.printImage = ‘http://google.webassist.com/google/markers/pushpin/slate.gif’;
icon.mozPrintImage = ‘http://google.webassist.com/google/markers/pushpin/slate_mozprint.png’;
icon.printShadow = ‘http://google.webassist.com/google/markers/pushpin/shadow.gif’;
icon.transparent = ‘http://google.webassist.com/google/markers/pushpin/slate_transparent.png’;
0) {

### START OF LOOP ###
var address_ {LOOP INDEX}= {
infowindowtext: “{LOCATION INFO ARRAY }”,
full: “{LOCATION ADDRESS ARRAY}”
};

htmls[] = address_{LOOP INDEX}.infowindowtext;

geocoder.getLatLng (
address_{LOOP INDEX}.full,
function(point) {
if(point) {
map.setCenter(point, 13);
var marker = new GMarker(point, icon);
GEvent.addListener(marker, ‘click’, function() {
marker.openInfoWindowHtml(address_{LOOP INDEX}.infowindowtext);
});
gmarkers[] = marker;
map.addOverlay(marker);
}
else {
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}

}
); /*end geocoder.getLatLng*/

### END OF LOOP ###

} /*endif*/
} /*end function */

function myclick(i) {
if (gmarkers[i])
gmarkers[i].openInfoWindowHtml(htmls[i]);
else {
var htstring = htmls[i];
var stripped = htstring.replace(/(]+)>)/ig,”");
alert(“Location not found: ” + stripped);
} /*endif*/
} /*end function */

gmaps_call.js

window.onunload = function() {
GUnload();
}
/*gmaps_onload*/
if(window.gmapsLoad) gmapsLoad();

See demo here or download files here.

One Stop PHP Resources and It’s Peer September 8, 2006

Posted by ordinarywebguy in Ajax, Cool Websites, Java, Javascript, MySQL, OOP, PHP, PHP Blogs, PostgreSQL, Ruby.
1 comment so far

FeedPHP is going to be the largest repository of feeds from PHP and related news sources. This one stop news source parses feeds from thousands other php website and displays the titles. As we know, MySQL, PostgreSQL, AJAX are also relevant to PHP, so FeedPHP collects feeds from those sources as well.

Visit it here: http://www.feedphp.com/

All thanks to Hasin Hayder.

MySQL Freaks Site is Down September 7, 2006

Posted by ordinarywebguy in MySQL.
add a comment

Finally, after posting in phpFreaks forum what I’ve discovered in the site MySQL Freak Site’s Vulnerability, site admins disabled the site and redirect it to http://www.phpfreaks.com/forums/index.php/board,3.0.html.

I felt that I somehow helped them with the integrity of the site. Hopefully site admins will immediately fix the vulnerability of it. The site helped me a lot both in my job and personal learnings in mysql.

I am waiting for the time that the site will be up and live again. Goodluck to MySQLFreaks.com admins.

MySQL Freaks Site’s Vulnerability July 20, 2006

Posted by ordinarywebguy in MySQL.
add a comment

One day, I needed a mysql statement syntax and browse to mysqlfreaks.com . I tried to log in my account in phpfreaks.com but seems not to work at all (just trying). Then after a few clicks on searching, it to came to suprise me what I discovered. Click the image to see.
I was logged in as phpfreak (admin user). Whew! This is not good on the side of mysqlfreaks admins. If I was in black hat side, I’ll then mess with the site. (Good thing I am in white hat) I immediately submitted them a report about the bug. Let us see if they’ll do something about to fix it.

Here’s what I did:
1. Visit http://www.mysqlfreaks.com.
2. Put any string on both username and password fields.
3. Click submit.
4. Browse to http://mysqlfreaks.com/mysql_statements.php

Now, you can see what the above image is.

Note: Please don’t mess with the site.