else if ( Db_Holder == "shortcont" || Db_Holder == "shortReplycont" ){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/config.cgi"; if(AreTheyNumbers(GetCfg("SnShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count))){ Db_Short_Int=(int)ToInt(GetCfg("SnShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count)); } if ( Db_Holder == "shortcont" ){ Db_Short_Holder=InputParser("cont", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ Db_Short_Holder=InputParser("Replycont", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } if( Db_Short_Int != 0 ){ cout << Db_Short_Holder.substr (0,Db_Short_Int); } else{ cout << Db_Short_Holder; } } else if (Db_Holder == "shortcont2"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/config.cgi"; if(AreTheyNumbers(GetCfg("SnShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count))){ Db_Short_Int=(int)ToInt(GetCfg("SnShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count)); } Db_Short_Holder=InputParser("cont", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); if( Db_Short_Int != 0 ){ cout << Db_Short_Holder.substr (0,Db_Short_Int); } else{ cout << Db_Short_Holder; } } else if (Db_Holder == "shortcont3"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/config.cgi"; if(AreTheyNumbers(GetCfg("SnShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count))){ Db_Short_Int=(int)ToInt(GetCfg("SnShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count)); } Db_Short_Holder=InputParser("cont", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); if( Db_Short_Int != 0 ){ cout << Db_Short_Holder.substr (0,Db_Short_Int); } else{ cout << Db_Short_Holder; } } else if (Db_Holder == "previewshortcont"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/config.cgi"; if(AreTheyNumbers(GetCfg("SnPreviewShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count))){ Db_Short_Int=(int)ToInt(GetCfg("SnPreviewShortCont", filename_holder.c_str(), SystemVar_String, SystemVar_Count)); } Db_Short_Holder=InputParser("cont", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); if( Db_Short_Int != 0 ){ cout << Db_Short_Holder.substr (0,Db_Short_Int); } else{ cout << Db_Short_Holder; } } else if (Db_Holder == "contforreply"){ Db_Short_Holder=InputParser("cont", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); Db_Short_Holder=Db_Short_Holder.replace(0,0,">> "); for ( int j=1; j <= Db_Short_Holder.length(); j++ ){ if ( Db_Short_Holder.substr(j,1) == "\n"){ Db_Short_Holder=Db_Short_Holder.replace(j,1,"\n>> "); } } Db_Short_Holder=Db_Short_Holder.replace(0,0,"\n\n\n"); cout << Db_Short_Holder; } else if (Db_Holder == "date.modify"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/config.cgi"; cout << InputParser("date", dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else if (Db_Holder == "todayvisits"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/today.cgi"; if(ifstream(filename_holder.c_str())){ if ( GetCfg("date", filename_holder, SystemVar_String, SystemVar_Count) == GetDate() ){ string temp_1=GetCfg("today", filename_holder, SystemVar_String, SystemVar_Count); ofstream make_today(filename_holder.c_str(),ios::out); make_today << "today=" << ToString((int)ToInt(temp_1)+1) << "\n"; make_today << "date=" << GetDate() << "\n"; make_today.close(); } else{ ofstream make_today(filename_holder.c_str(),ios::out); make_today << "today=1\n"; make_today << "date=" << GetDate() << "\n"; make_today.close(); } } else{ ofstream make_today(filename_holder.c_str(),ios::out); make_today << "today=1\n"; make_today << "date=" << GetDate() << "\n"; make_today.close(); } //chmod 666; string change_perm="chmod 666 "; change_perm+=filename_holder; system(change_perm.c_str()); //refresh today when date is same. cout << GetCfg("today", filename_holder, SystemVar_String, SystemVar_Count); } else if (Db_Holder == "totalvisits"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/total.cgi"; if(ifstream(filename_holder.c_str())){ string temp_1=GetCfg("total", filename_holder, SystemVar_String, SystemVar_Count); ofstream make_total(filename_holder.c_str(),ios::out); make_total << "total=" << ToString((int)ToInt(temp_1)+1) << "\n"; make_total.close(); } else{ ofstream make_total(filename_holder.c_str(),ios::out); make_total << "total=1\n"; make_total.close(); } //chmod 666; string change_perm="chmod 666 "; change_perm+=filename_holder; system(change_perm.c_str()); cout << GetCfg("total", filename_holder, SystemVar_String, SystemVar_Count); } else if (Db_Holder == "count"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+="_read.cgi"; if(ifstream(filename_holder.c_str())){ cout << GetCfg("read", filename_holder, SystemVar_String, SystemVar_Count); } else{ cout << 0; } } else if (Db_Holder == "Replycount"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+="_replyread.cgi"; if(ifstream(filename_holder.c_str())){ cout << GetCfg("replyread", filename_holder, SystemVar_String, SystemVar_Count); } else{ cout << 0; } } else if (Db_Holder == "downcount"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+="_down.cgi"; if(ifstream(filename_holder.c_str())){ cout << GetCfg("down", filename_holder, SystemVar_String, SystemVar_Count); } else{ cout << 0; } } else if (Db_Holder == "file1.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file1.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file1", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file1.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file2.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file2.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file2", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file2.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file3.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file3.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file3", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file3.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file4.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file4.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file4", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file4.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file5.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file5.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file5", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file5.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file6.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file6.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file6", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file6.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file7.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file7.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file7", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file7.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file8.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file8.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file8", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file8.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file9.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file9.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file9", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file9.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else if (Db_Holder == "file10.preview"){ filename_holder="system/db/"; filename_holder+=GetPar("db", SystemVarPar_String, SystemVarPar_Count); filename_holder+="/data/"; filename_holder+=ToString(dbf-1); filename_holder+=".cgi"; if ( InputParser_file("file10.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count) == "" ){ cout << InputParser_file("file10", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } else{ cout << InputParser_file("file10.preview", filename_holder, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } } else{ cout << InputParser(Db_Holder, dbf-1, SystemVar_String, SystemVar_Count, SystemVarPar_String, SystemVarPar_Count); } //if the value == no //if the value == whatever. } } else { cout << "($db" << ch; } } else { cout << "($d" << ch; } Db_Holder=""; System_Count=0; }
this is a piece of my source code.
Shouldn't be that long when efficiently programmed.
That's why I breifly skimmed through 3 c++ books, and realized how dumb i was being.
i really need to change my whole source code.
it's so bad, it's like a horror movie.
if i want to change one thing, look at how many things i need to change.
I wanted to die when I needed to change something.
So please, have sympathy and help me.
just look at the above source code.
imagine you have something like that.