Во случајов база е многу робусно решение. Можи да помини и со txt,xml,csv... датотеки.:smir:Друже, не те разбрав баш најдобро... сакаш да направиш да речеме Бележник и одкако ќе го направиш да ја стартуваш апликацијата, потоа да пишуваш некои забелешки, да ги зачуваш и да ја изгаснеш апликацијата... потоа на наредно пуштање на апликацијата работите кои си ги напишал да ги има во програмата.
За тоа мислиш или... ?
Ако мислиш за тоа што го објаснив погоре ќе ти треба база каде што ќе се запишуваат и зачувуваат податоците кои ги внесуваш и после на наредно стартување на апликацијата истите тие податоци ќе ги вчиташ од базата каде што биле запишани.
Може и такаВо случајов база е многу робусно решение. Можи да помини и со txt,xml,csv... датотеки.:smir:
Ако треба да „процесираш“ некои податоци кои се само на страната на клиентот (нема потреба од прибирање податоци од серверот т.е. нема потреба од PHP) треба да користиш JavaScript.Имам прашање во врска со PHP/HTML .
На пример имам две Text Field контроли. И од како ќе стиснам на некое копче да ми го испечати збирот од овие полиња но без да ми ја рефрешира страницата.
Ова без врска кажав пример за собирање, муабетот ми е како да процесира некои податоци без рифреш да направи
Види побарај некои туториjали за Ajax. То е то шо ти треба.Кој и програмски јазик да го користам кога ке направам Submit на формата ми се рефрешира страницата
//Plugin options
var DpPath, aLogin, aTimer, timerL, random, shuffle;
//Other variables
var displayPics;
var scriptTitle = "Display Picture Changer";
var devName = ".NET Developer For Rent";
var scriptVersionMajor = 1;
var scriptVersionMinor = 2;
//index of next picture
var picIndex = 0;
var currentPicIndex = 0;
//ActiveX Stuff
var WScript = new ActiveXObject('WScript.Shell');
var winShell = new ActiveXObject("Shell.Application");
var fsoObj = new ActiveXObject("Scripting.FileSystemObject");
////////////////
// Initialize //
////////////////
function OnEvent_Initialize(MessengerStart)
{
if (!MessengerStart)
{
initialize();
}
}
/////////////
// Sign In //
/////////////
function OnEvent_Signin(Email)
{
initialize();
}
////////////////////////////
// Option control Clicked //
////////////////////////////
function OnDPCOptionsEvent_CtrlClicked(PlusWnd, ControlId)
{
switch (ControlId)
{
case "BtnOk":
optionsOKClicked(PlusWnd);
break;
case "BtnBrowse":
optionsBrowseClicked(PlusWnd);
break;
}
}
//////////////////////////////
// Option button OK Clicked //
//////////////////////////////
function optionsOKClicked(PlusWnd)
{
DpPath = PlusWnd.GetControlText('EdtDpDir');
//strip leading spaces
while(DpPath.indexOf(' ') == 0)
{
DpPath = DpPath.substr(1);
}
aLogin = PlusWnd.Button_IsChecked('CkAutoLogin');
aTimer = PlusWnd.Button_IsChecked('CkAutoRotate');
if (isNaN(PlusWnd.GetControlText('EdtRTime')))
{
timerL = 60000;
}
else
{
timerL = PlusWnd.GetControlText('EdtRTime') * 1000;
}
random = PlusWnd.Button_IsChecked('RadRandom');
shuffle = PlusWnd.Button_IsChecked('CkShuffle');
if(Messenger.MyEmail != "")
{
SaveSettings(Messenger.MyEmail);
}
populateDp();
if(aTimer)
{
ChangeDp();
}
PlusWnd.Close(1);
}
//////////////////////////////////
// Option button browse Clicked //
//////////////////////////////////
function optionsBrowseClicked(PlusWnd)
{
PlusWnd.SetControlText('EdtDpDir', browseFolderDialog());
}
//////////////////
// Menu Clicked //
//////////////////
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
switch (MenuItemId)
{
case "Options":
displayOptions();
break;
case "Change":
ChangeDp();
break;
case "Steal":
if (Location == 2)
{
StealDp(OriginWnd);
}
else
{
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Call this function from the chatwindow of the contact you wish to steal the display picture from.", "", "");
}
break;
case "Delete":
DeleteDp();
break;
case "Reload":
reloadDpList();
break;
case "StartRotate":
rotationStart();
break;
case "StopRotate":
rotationStop();
break;
case "About":
displayAbout();
break;
}
}
///////////////////////////
// About Control Clicked //
///////////////////////////
function OnWndAboutEvent_CtrlClicked(PlusWnd, ControlId)
{
switch (ControlId)
{
case "gotowebsite":
WScript.run("http://www.dotnetdeveloperforrent.be");
PlusWnd.Close(1);
break;
case "lblOptions":
displayOptions();
PlusWnd.Close(1);
break;
case "lblChange":
ChangeDp();
break;
case "lblDelete":
DeleteDp();
break;
case "lblReload":
reloadDpList();
break;
case "lblRotateStart":
rotationStart();
break;
case "lblRotateStop":
rotationStop();
break;
}
}
//////////////
// Commands //
//////////////
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
var m = Message.toLowerCase();
switch (m)
{
case "/dpcoptions":
displayOptions();
return "";
case "/dpcchange":
ChangeDp();
return "";
case "/dpcsteal":
StealDp(ChatWnd);
return "";
case "/dpcdelete":
DeleteDp();
return "";
case "/dpcreload":
reloadDpList();
return "";
case "/dpcrotatestart":
rotationStart();
return "";
case "/dpcrotatestop":
rotationStop();
return "";
case "/dpcabout":
displayAbout();
return "";
case "/dpcstealsilent":
//not documented
StealDpSilent(ChatWnd);
return "";
}
return Message;
}
////////////////////
// start rotation //
////////////////////
function rotationStart()
{
if (!aTimer)
{
aTimer = true;
ChangeDp();
}
}
////////////////////
// stop rotation //
////////////////////
function rotationStop()
{
aTimer = false;
stopTimer();
}
////////////////
// initialize //
////////////////
function initialize()
{
if(Messenger.MyEmail != "")
{
GetSettings(Messenger.MyEmail);
populateDp();
if( aLogin )
{
ChangeDp();
}
else if (aTimer)
{
startTimer();
}
}
else
{
initOptions();
}
}
///////////////////////////////
// Initialize plugin options //
///////////////////////////////
function initOptions()
{
DpPath = WScript.SpecialFolders("MyDocuments");
if (DpPath == null || DpPath == '')
{
DpPath = "C:\\";
}
aLogin = true;
aTimer = true;
timerL = 60000;
random = false;
shuffle = true;
displayPics = new Array();
}
////////////////////////////////////
// Steal Display picture Silently //
// (Undocumented) //
////////////////////////////////////
function StealDpSilent(ChatWnd)
{
var contact = (new Enumerator(ChatWnd.Contacts)).item();
var dp = contact.DisplayPicture;
if (dp != "")
{
if(fsoObj.FileExists(dp))
{
var baseName = fsoObj.GetBaseName(dp);
var ext = fsoObj.GetExtensionName(dp);
if (ext == "")
{
ext = "png";
}
var newPath = fsoObj.BuildPath(DpPath, baseName + "." + ext);
var count = 1;
while (fsoObj.FileExists(newPath))
{
newPath = fsoObj.BuildPath(DpPath, baseName + "[" + count + "]." + ext);
count++;
}
fsoObj.CopyFile(dp, newPath);
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Display Picture stolen silently!", "", "");
}
}
else
{
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Contact has no display picture", "", "");
}
}
///////////////////////////
// Steal Display picture //
///////////////////////////
function StealDp(ChatWnd)
{
//stop timer to not interrupt functionality
stopTimer();
var contact = (new Enumerator(ChatWnd.Contacts)).item();
var dp = contact.DisplayPicture;
if (dp != "")
{
if(fsoObj.FileExists(dp))
{
var baseName = fsoObj.GetBaseName(dp);
var ext = fsoObj.GetExtensionName(dp);
if (ext == "")
{
ext = "png";
}
var newPath = fsoObj.BuildPath(DpPath, baseName + "." + ext);
var count = 1;
while (fsoObj.FileExists(newPath))
{
newPath = fsoObj.BuildPath(DpPath, baseName + "[" + count + "]." + ext);
count++;
}
fsoObj.CopyFile(dp, newPath);
currentPicIndex = displayPics.length;
picIndex = 0;
displayPics[currentPicIndex] = newPath;
Messenger.MyDisplayPicture = newPath;
var chat = Messenger.OpenChat(contact.Email);
if (chat != null && chat.EditChangeAllowed)
{
chat.SendMessage("/me has stolen (!N)'s Display Picture! (6)\n\n[B]'" + scriptTitle + "'[/B]\n(-- " + devName + " --)\n\n");
}
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Display Picture stolen!", "", "");
}
}
else
{
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Contact has no display picture", "", "");
}
//restart timer
if (aTimer)
{
startTimer();
}
}
////////////////////////////
// Delete Display picture //
////////////////////////////
function DeleteDp()
{
//stop timer to not interrupt functionality
stopTimer();
var retVal = WScript.Popup("Current display picture will be removed from the list!\nDo you also want to remove the display picture from the filesystem?", 60, "Delete Display Picture", 4+32);
var tmp = displayPics.splice(currentPicIndex,1);
ChangeDp();
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Display Picture removed from list", "", "");
if (retVal == 6)
{
if(fsoObj.FolderExists(DpPath))
{
var dir = fsoObj.GetFolder(DpPath);
fsoObj.DeleteFile(tmp[0], true);
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Display Picture removed from filesystem", "", "");
}
}
}
////////////////////////////
// Change Display Picture //
////////////////////////////
function ChangeDp()
{
stopTimer();
if(displayPics != "" && displayPics.length > 0)
{
if (random)
{
currentPicIndex = Math.floor(Math.random()*displayPics.length);
fileName = displayPics[currentPicIndex];
}
else
{
currentPicIndex = picIndex;
fileName = displayPics[currentPicIndex];
picIndex++;
if (picIndex >= displayPics.length)
{
picIndex = 0;
}
}
try
{
if (fsoObj.FileExists(fileName))
{
Messenger.MyDisplayPicture = fileName;
}
}
catch(exception){}
//restart timer
if (aTimer)
{
startTimer();
}
}
else
{
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "No pictures in current folder", "", "displayOptions");
}
}
//////////////////////////
// Browse Folder Dialog //
//////////////////////////
function browseFolderDialog()
{
var folder = winShell.BrowseForFolder(0, "Select the directory containing your display pictures. No other pictures should be contained with this directory.", 0, 0);
var fPath = "";
if (folder != null)
{
if (folder.Items() != null)
{
if (folder.Items().Item() != null)
{
fPath = folder.Items().Item().Path;
}
}
}
if (fPath == "")
{
fPath = DpPath;
}
return fPath;
}
////////////////////////////
// Display Options Window //
////////////////////////////
function displayOptions()
{
plusWnd = MsgPlus.CreateWnd('windows.xml', 'DPCOptions');
plusWnd.SetControlText('EdtDpDir', DpPath);
plusWnd.Button_SetCheckState('CkAutoLogin', aLogin);
plusWnd.Button_SetCheckState('CkAutoRotate', aTimer);
plusWnd.SetControlText('EdtRTime', (timerL / 1000));
plusWnd.Button_SetCheckState('RadRandom', random);
plusWnd.Button_SetCheckState('RadSlide', !random);
plusWnd.Button_SetCheckState('CkShuffle', shuffle);
}
////////////////////////////
// Display About Window //
////////////////////////////
function displayAbout()
{
MsgPlus.CreateWnd('about.xml', 'WndAbout');
}
/////////////////////////////////////
// Reload Display Pictures Array //
/////////////////////////////////////
function reloadDpList()
{
populateDp();
currentPicIndex = 0;
picIndex = 0;
ChangeDp();
}
}
/////////////////////////////////////
// Populate Display Pictures Array //
/////////////////////////////////////
function populateDp()
{
if(fsoObj.FolderExists(DpPath))
{
Dir = fsoObj.GetFolder(DpPath);
Files = new Enumerator(Dir.files);
displayPics = new Array();
while(!Files.atEnd())
{
File = Files.item();
fExt = fsoObj.GetExtensionName(File.Name).toLowerCase();
if(fExt == "jpg" || fExt == "gif" || fExt == "bmp" || fExt == "png")
{
displayPics[displayPics.length] = File;
}
Files.moveNext();
}
if (shuffle)
{
shuffleDp();
}
}
else
{
MsgPlus.DisplayToast(scriptTitle + " v " + scriptVersionMajor + "." + scriptVersionMinor, "Directory " + DpPath + " does not exist.", "", "displayOptions");
}
}
////////////////////////////////////
// Shuffle Display Pictures Array //
////////////////////////////////////
function shuffleDp()
{
var tmp = new Array();
while (displayPics.length > 0)
{
var i = Math.floor(Math.random()*displayPics.length);
if (i > displayPics.length - 1) i = displayPics.length - 1;
tmp[tmp.length] = displayPics.splice(i,1)[0];
}
displayPics = tmp;
}
/////////////////
// Start Timer //
/////////////////
function startTimer()
{
if(aTimer)
{
MsgPlus.AddTimer("PDCTimer", timerL);
}
}
/////////////////
// Stop Timer //
/////////////////
function stopTimer()
{
MsgPlus.CancelTimer("PDCTimer");
}
/////////////////
// Event Timer //
/////////////////
function OnEvent_Timer(TimerId)
{
if(TimerId == "PDCTimer")
{
if (aTimer)
{
ChangeDp();
}
else
{
stopTimer();
}
}
}
//////////////////////
// Get The Settings //
//////////////////////
function GetSettings(email)
{
try
{
DpPath = WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\DpPath');
timerL = WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\timerL');
aLogin = (WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\aLogin') == "Yes");
aTimer = (WScript.RegRead(MsgPlus.ScriptRegPath + email +
'\\aTimer') == "Yes");
random = (WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\random') == "Yes");
shuffle = (WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\shuffle') == "Yes");
if(timerL < 1000 || timerL > 86400000)
{
timerL = 1800000;
}
}
catch(exception)
{
initOptions();
SaveSettings(email);
}
}
///////////////////////
// Save The Settings //
///////////////////////
function SaveSettings(email)
{
try
{
var tLogin,tTimer,trandom,tshuffle;
tLogin = (aLogin?"Yes":"No");
tTimer = (aTimer?"Yes":"No");
trandom = (random?"Yes":"No");
tshuffle = (shuffle?"Yes":"No");
if(timerL < 1000 || timerL > 86400000)
{
timerL = 1800000;
}
WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\DpPath', DpPath);
WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\aLogin', tLogin);
WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\aTimer', tTimer);
WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\timerL', timerL);
WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\random', trandom);
WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\shuffle', tshuffle);
}
catch(exception){}
// Done by Tomaz
// Thanks to Slash !
var online;
var offline;
var nchat;
var nomecontatto;
var chat;
function ContaContatti(){
online=0;
offline=0;
var Contacts = Messenger.MyContacts;
for(var e = new Enumerator(Contacts); !e.atEnd(); e.moveNext()){
item = e.item();
if(item.Status != 1 && item.Status != 0){
online++;
}
offline++;
}
}
function ContaChat(){
nchat=Messenger.CurrentChats.Count;
if (nchat=="0"){
nchat="[c=4]"+nchat+"[/c] ";
}else{
nchat="[c=9]" + nchat + "[/c] ";
}
}
function OnEvent_Timer(timer1){
var inizio="[a=1][c=0]";
var fine="[/a][/c]";
var barra="|";
var messpers;
ContaChat();
ContaContatti();
messpers= inizio + " Opened chats : " + nchat + barra;
messpers+= " Online : " + "[c=9]" + online + "[/c]/[c=4]" + offline +"[/c] "+ barra;
if(nomecontatto=="[c=4]No-one[/c] ")
messpers+= " Talking with : " + nomecontatto + fine;
else
messpers+= " Talking with : " +"[c=9]" + nomecontatto + "[/c]"+ fine;
Messenger.MyPersonalMessage=messpers;
MsgPlus.AddTimer("timer1",500);
}
function OnEvent_Signin(Email){
nomecontatto="[c=4]No-one[/c] ";
MsgPlus.AddTimer("timer1",500);
}
function OnEvent_Initialize(MessengerStart){
nomecontatto="[c=4]No-one[/c] ";
MsgPlus.AddTimer("timer1",500);
}
function Amp(){
nomecontatto="[c=4]No-one[/c] ";
MsgPlus.AddTimer("timer1",500);
}
function Dmp(){
MsgPlus.CancelTimer("timer1");
Messenger.MyPersonalMessage="";
}
function OnEvent_ChatWndSendMessage(ChatWnd,message){
if(message == '/Amp'){
Amp();
return "";
}
if(message == '/Dmp'){
Dmp();
return "";
}
return message;
}
function OnEvent_MenuClicked(MenuItemId,Location,ChatWnd) {
switch(MenuItemId) {
case 'Amp':
Amp();
break;
case 'Dmp':
Dmp();
break;
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){
var backup;
chat=ChatWnd;
contatto=ChatWnd.Contacts;
if(contatto.Count == 1) {
var e = new Enumerator(contatto);
var Cnt = e.item();
nomecontatto = Cnt.Email.split("@");
nomecontatto = nomecontatto[0];
}
}
function OnEvent_ChatWndDestroyed(ChatWnd){
if(chat.Handle==ChatWnd.Handle){
nomecontatto="[c=4]Nessuno[/c] ";
}
}
function OnEvent_ChatWndCreated(ChatWnd){
var contatto;
chat=ChatWnd;
contatto=ChatWnd.Contacts;
if(contatto.Count == 1) {
var e = new Enumerator(contatto);
var Cnt = e.item();
nomecontatto = Cnt.Email.split("@");
nomecontatto = nomecontatto[0];
}
int brojki[18] = {3,6,7,12,32,34,54,56,33,17,14,45,63,56,51,87,99,47};
int kupchinja[4][9]; // 4 купчиња со капацитет 9 елементи
int brojac = 0;
for(int i=0; i<4; i++){
for(int j=0; j<9; j++){
brojac++;
if(brojac<18){
kupchinja[i][j]=brojki[brojac];
}
else
{
kupchinja[i][j]=NULL; // Празните ќе бидат нули
}
}
}