/********************************************************************* * io_log - v.1.0 by Stig Johansen 9531.47 * * io_log - v.1.1 modified by Rune Johansen 9758.88 * * * * io_log: is a collection of functions making a bulletin with not * * only login hours by users, but also logout hours. This file * * contains 2 functions which should be used in your ASCRIPT.BZ, * * RSCRIPT.BZ and GSCRIPT.BZ. If you implement all of these, the * * script will function quite satisfactory. * * * * usage: * * Blogin(number); * * * * where number is either 0 or 1: * * 0 = Ordinary user (use in ascript) * * 1 = New user (use in rscript) * * * * Blogout(); * * * * examples: * * ->ascript.bz<- * * #include * * * * function main() { * * Blogin(0); * * } * * ->end<- * * * * ->rscript.bz<- * * #include * * * * function main() { * * Blogin(1); * * } * * ->end<- * * * * ->gscript.bz<- * * #include * * * * function main() { * * Blogout(); * * } * * ->end<- * * * * You may have to change the paths etc. before using this function. * * It uses the following paths: * * * * $data/ : datafiles storage, should always * * be there * * /bull69.gr : bulletin file * * * * You should have an event running every midnight which deletes the * * following files: $data/$io_log.* * * and it should also delete the bulletin file (menus/bull69.gr) * * * * io_log will NOT add local logins, but you can include them by * * setting local_net_allowed to 1 in readcfig(). * * * * This source file is hereby released to the Public Domain by the * * author: Stig Johansen. * * I can be reached at these addresses: * * FidoNet: Stig Johansen@2:210/20 * * * * Have fun... and: release all of your source codes!!! * **********************************************************************/ // make_header(): makes a new file with header if it don't exist // lname = pathname to list-file // returns true if header was made! int make_header(char destination) { int fil; if ((fil=fopen(destination,"rt"))==-1) { fil=fopen(destination,"wt"); fprintf(fil,"\e[40m\e[1;1H\e[2J\e[0;1;34;44mÚÄ´\e[41m \e[37mlogins \e[34;44mÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\e[0;30;44m¿\e[0m\n"); fprintf(fil,"\e[1;34;44m³ \e[0;30;44mÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\e[1;34m¿ \e[0;30;44m³\e[0m\n"); fprintf(fil,"\e[1;34;44m³ \e[0;30;44m³ \e[1;37mno\e[0;44m. \e[1;33muser \e[35mspeed \e[32mlogin \e[31mlogout \e[36mnode \e[34m³ \e[0;30;44m³\e[0m\n"); fprintf(fil,"\e[1;34;44m³ \e[0;30;44mÀ\e[1;34mÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ \e[0;30;44m³\e[0m\n"); fprintf(fil,"\e[1;34;44m³ \e[0;30;44mÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\e[1;34m¿ \e[0;30;44m³\e[0m\n"); fclose(fil); return (1); } fclose(fil); return(0); } // copyfile(): Copies a file // int copyfile(char destination,source) { char inputt; char fil1, fil2; if ((fil1=fopen(destination,"wt"))!=-1) { fil2=fopen(source,"rt"); while (!feof(fil2)) { inputt = fgets(fil2); if (!feof(fil2)) fprintf(fil1,"%s\n",inputt); } fclose(fil2); fclose(fil1); } } // append_footer(): appends a footer to a file // int append_footer(char destination) { int fil; if ((fil=fopen(destination,"at"))!=-1) { fprintf(fil,"\e[1;34;44m³ \e[0;30;44mÀ\e[1;34mÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ \e[0;30;44m³\e[0m\n"); fprintf(fil,"\e[1;34;44m³ \e[31m! = new user \e[0;30;44m³\e[0m\n"); fprintf(fil,"\e[1;34;44mÀ\e[0;30;44mÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\e[0m\n"); fclose(fil); } } int a_total_nr, a_today_nr, a_temp; int s_total, s_today; char bname, lname, inputt, nodef; int linenumber; int local_net_allowed; int readcfig() { bname = strcat(bg_menudir,"bull69.gr"); nodef = sprintf("$data/$io_list.%u",bv_nodenumber); lname = "$data/$io_list.lst"; s_total = "$data/$io_tot"; s_today = "$data/$io_list.day"; local_net_allowed = 0; } int read_and_updatestat() { int fil; a_total_nr = 0; if ((fil=fopen(s_total,"rt"))!=-1) { a_total_nr = fgets(fil); fclose(fil); } a_total_nr = a_total_nr + 1; fil=fopen(s_total,"wt"); fprintf(fil,"%i\n",a_total_nr); fclose(fil); a_today_nr = 0; if ((fil=fopen(s_today,"rt"))!=-1) { a_today_nr = fgets(fil); fclose(fil); } a_today_nr = a_today_nr + 1; fil=fopen(s_today,"wt"); fprintf(fil,"%i\n",a_today_nr); fclose(fil); fil=fopen(nodef,"wt"); fprintf(fil,"%u\n",a_today_nr+4); fclose(fil); } char mixedcase(char s) { char temp,dest,ch,len,i; char upcase, upcasenext; temp = stlocase(s); len = strlen(temp)+1; upcase = 1; upcasenext = 0; dest = ""; for (i=1;i