Jump to content

Archived

This topic is now archived and is closed to further replies.

rush

Need help with php scripts

Recommended Posts

Hi,

I have created an extension with firefox which will work as a quick image upload tool for my image server.

Now the issue is my server needs to have some supporting php scripts for this to work.

Can someone help me on this..??
thanks for reading

The actual javascript is this:

[code]window.addEventListener("load", initOverlay, false);
var didit = 0;

function initOverlay() {
  var menu = document.getElementById("yourFiles");
  menu.addEventListener("popupshowing", contextPopupshowing, false);
}


function contextPopupshowing() {
if (didit==1) { return false; }
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://***.***.com/emyfiles.php",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
        doList(xmlhttp.responseText);
}
}
xmlhttp.send(null);
}

function doList(data) {
var files=data.split("\n");
var fields;
var uid;
var fname;
var output="";
var incat = document.getElementById("yourFiles");
for (var i=0; i < files.length -2; i++ ) {
        fields=files[i].split("\t");
        uid = fields[0];
        fname = fields[1];
        output += i + ": <a href=\"http://***.***.com/files/" + uid + "/" + fname + "\">" + fname + "</a><br />\n";
        var ja = document.createElement("menuitem");
        ja.setAttribute("label",fname);
        ja.setAttribute("oncommand","gotourl(\"http://***.***.com/detail.php?id=" + uid + "\");");
    incat.childNodes[0].appendChild(ja);
}
didit=1;
}


function gotourl(url) {
const newTab = getBrowser().addTab(url);

getBrowser().selectedTab = newTab;
generatedPage = window;
}


// This is my javascript, which will pop up my message
// in an alert box.

var hush = {
loadSite: function(mode) {
gotourl('http://***.***.com');
return false;
},

loadLink: function(mode) {
var url = 'test';
if (mode == 1) {
    url = gContextMenu.linkURL();
}
if (mode == 2) {
    url = gContextMenu.imageURL;
}
if (url == '' || url == 'undefined' || url=='Undefined') {
    if (mode == 1) {
        window.alert('Please select a link');
        return false;
    }
    if (mode == 2) {
        window.alert('Please select an image');
        return false;
    }
}
gotourl('http://***.***.com/process.php?remotefile=' + url);
return false;
}[/code]

Someone please help, thanks

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.