Quantcast

What works and what is paused · Email is limited to account activation and password resets.

Jump to content


Photo

Need some code fixed up... [PHP]


  • Please log in to reply
19 replies to this topic

#1 Maha

Maha
  • haha

  • 1039 posts


Users Awards

Posted 25 April 2012 - 05:24 AM

Ok so basically this is the code:

Spoiler


Basically it lets a user vote 4 times per 12 hours. But it gives the user 1 point per vote BEFORE they vote, it does it when the click the Link.

When I need it to do is be able to check if the user has actually voted on the links before the Points are awarded. Either Award 1 point for 1 vote after they HAVE voted or award 4 Points For all 4 Votes after it checks if they HAVE voted.

...

Basically as Long as it gives the points per vote, only IF they actually have VOTED and if it doesn't give the points per vote, only IF they HAVEN'T VOTED it should be good...

The code in the spoiler is already implemented here: www.insanityflyff.com (Apologies if Link isn't allowed)

If you have anymore questions Please ask me.

I would rather this work be done free but if unable to be done I can pay with NP. Just let me know your NP price and I will attempt to converse with you and organize a deal of sorts.

Will need the code done A.S.A.P

Edited by Magnetism, 25 April 2012 - 06:05 AM.


Advertisement

    #2 Inkheart

    Inkheart
    • 268 posts

    Posted 25 April 2012 - 05:31 AM

    I just threw up in my mouth a little.

    #3 Waser Lave

    Waser Lave
    • 25516 posts


    Users Awards

    Posted 25 April 2012 - 05:34 AM

    I just threw up in my mouth a little.


    I already told him to clean it up first but I guess he ignored me, lol.

    #4 Maha

    Maha
    • haha

    • 1039 posts


    Users Awards

    Posted 25 April 2012 - 05:41 AM

    I already told him to clean it up first but I guess he ignored me, lol.


    ._. I didn't ignore you I am just refreshing myself online before I do for the final product... Sorry..

    #5 Waser Lave

    Waser Lave
    • 25516 posts


    Users Awards

    Posted 25 April 2012 - 05:43 AM

    ._. I didn't ignore you I am just refreshing myself online before I do for the final product... Sorry..


    My point was that you'll have a better chance of finding somebody to help you if they can actually read the code. You're effectively doubling the workload because they'd have to clean it all up themselves first.

    #6 Maha

    Maha
    • haha

    • 1039 posts


    Users Awards

    Posted 25 April 2012 - 05:47 AM

    My point was that you'll have a better chance of finding somebody to help you if they can actually read the code. You're effectively doubling the workload because they'd have to clean it all up themselves first.


    http://www.mediafire...cihm4gncn7dw2os

    https://www.virustot...0e07e/analysis/

    ^The File and Virus Scan...

    Maybe copy and pasting changed the layout...

    Edited by Magnetism, 25 April 2012 - 05:51 AM.


    #7 Inkheart

    Inkheart
    • 268 posts

    Posted 25 April 2012 - 06:28 AM

    Maybe copy and pasting changed the layout...


    The "layout" is the least of your troubles.

    #8 Irradium

    Irradium
    • Pyro (699) Maniac

    • 892 posts


    Users Awards

    Posted 25 April 2012 - 07:18 AM

    I just threw up in my mouth a little.


    ^This. I have no experience in PHP, but I can see dirty code at a glance. No offense. :)

    #9 RitzWin

    RitzWin
    • 241 posts

    Posted 25 April 2012 - 08:46 AM

    Sadly, schools don't teach the importance of clean code. I was lucky enough to get a job where they taught the importance of clean code (made us read the book- "clean code", which in retrospect was very valuable)
    I spend lots of time refactoring, and the result is very easy code to work with.
    If you look at the code in my daily doer, it's VERY easy to add new dailies.

    #10 Maha

    Maha
    • haha

    • 1039 posts


    Users Awards

    Posted 25 April 2012 - 10:41 PM

    ._. My code isn't that bad is it D:?

    #11 Melchoire

    Melchoire
    • 5284 posts


    Users Awards

    Posted 26 April 2012 - 12:10 AM

    Sadly, schools don't teach the importance of clean code. I was lucky enough to get a job where they taught the importance of clean code (made us read the book- "clean code", which in retrospect was very valuable)
    I spend lots of time refactoring, and the result is very easy code to work with.
    If you look at the code in my daily doer, it's VERY easy to add new dailies.


    I never got what was so hard about writing clean code. In my mind there isn't really much to it...

    #12 RitzWin

    RitzWin
    • 241 posts

    Posted 26 April 2012 - 08:34 AM

    I never got what was so hard about writing clean code. In my mind there isn't really much to it...


    After reading 'clean code'... I realized I knew very little about clean code. My education had served me very poorly when it came to writing maintainable code. It's still a year later, and I take pride in making my code as simple as possible. I'm happy to show off my code (as you can see in the daily doer). However I'm always improving... it's not like you just 'know' how to do it. For me, at least, it is/was learned.

    I remember the days of using variables like 'x' or 'tempvar' or re-writing the same code multiple times with shame. :(

    Here's a good reference if you want to keep a maintenance job forever though :)
    http://freeworld.thc...unmaintain.html

    Edited by RitzWin, 26 April 2012 - 08:36 AM.


    #13 Parent

    Parent
    • 1 posts

    Posted 26 April 2012 - 08:59 AM

    After reading 'clean code'... I realized I knew very little about clean code. My education had served me very poorly when it came to writing maintainable code. It's still a year later, and I take pride in making my code as simple as possible. I'm happy to show off my code (as you can see in the daily doer). However I'm always improving... it's not like you just 'know' how to do it. For me, at least, it is/was learned.

    I remember the days of using variables like 'x' or 'tempvar' or re-writing the same code multiple times with shame. :(

    Here's a good reference if you want to keep a maintenance job forever though :)
    http://freeworld.thc...unmaintain.html


    lol that link is pretty freaking funny. I especially loved the math section "openParen = (slash + asterix) / equals;"

    #14 RitzWin

    RitzWin
    • 241 posts

    Posted 26 April 2012 - 09:05 AM

    Lol yea, I love it so many good ones:

    Use accented characters on variable names. E.g.typedef struct { int i; } ínt;where the second ínt's í is actually i-acute. With only a simple text editor, it's nearly impossible to distinguish the slant of the accent mark.[/list]

    Code That Masquerades As Comments and Vice Versa
    Include sections of code that is commented out but at first glance does not appear to be.for(j=0; j<array_len; j+ =8){
    total += array[j+0 ];
    total += array[j+1 ];
    total += array[j+2 ]; /* Main body of
    total += array[j+3]; * loop is unrolled
    total += array[j+4]; * for greater speed.
    total += array[j+5]; */

    total += array[j+6 ];
    total += array[j+7 ];
    }[/list]Without the colour coding would you notice that three lines of code are commented out?[/list]

    Edited by RitzWin, 26 April 2012 - 09:06 AM.


    #15 Melchoire

    Melchoire
    • 5284 posts


    Users Awards

    Posted 26 April 2012 - 11:55 AM

    After reading 'clean code'... I realized I knew very little about clean code. My education had served me very poorly when it came to writing maintainable code. It's still a year later, and I take pride in making my code as simple as possible. I'm happy to show off my code (as you can see in the daily doer). However I'm always improving... it's not like you just 'know' how to do it. For me, at least, it is/was learned.

    I remember the days of using variables like 'x' or 'tempvar' or re-writing the same code multiple times with shame. :(

    Here's a good reference if you want to keep a maintenance job forever though :)
    http://freeworld.thc...unmaintain.html


    Haha seen it =P

    They have competitions to see who can come up with the most obfuscated code as well...
    /*
                                      	+
                                 		+
                                    	+
                                    	+
                                    	[ 		>i>n[t
                                 		*/   #include<stdio.h>
                        	/*2w0,1m2,]_<n+a m+o>r>i>=>(['0n1'0)1;
                 		*/int/**/main(int/**/n,char**m){FILE*p,*q;int    	A,k,a,r,i/*
               		#uinndcelfu_dset<rsitcdti_oa.nhs>i/_*/;char*d="P%"   "d\n%d\40%d"/**/
             		"\n%d\n\00wb+",b[1024],y[]="yuriyurarararayuruyuri*daijiken**akkari~n**"
          	"/y*u*k/riin<ty(uyr)g,aur,arr[a1r2a82*y2*/u*r{uyu}riOcyurhiyua**rrar+*arayra*="
       	"yuruyurwiyuriyurara'rariayuruyuriyuriyu>rarararayuruy9uriyu3riyurar_aBrMaPrOaWy^?"
      	"*]/f]`;hvroai<dp/f*i*s/<ii(f)a{tpguat<cahfaurh(+uf)a;f}vivn+tf/g*`*w/jmaa+i`ni("/**
     	*/"i+k[>+b+i>++b++>l[rb";int/**/u;for(i=0;i<101;i++)y[i*2]^="~hktrvg~dmG*eoa+%squ#l2"
     	":(wn\"1l))v?wM353{/Y;lgcGp`vedllwudvOK`cct~[|ju {stkjalor(stwvne\"gt\"yogYURUYURI"[
     	i]^y[i*2+1]^4;/*!*/p=(n>1&&(m[1][0]-'-'||m[1][1]  !='\0'))?fopen(m[1],y+298):stdin;
      	/*y/riynrt~(^w^)],]c+h+a+r+*+*[n>)+{>f+o<r<(-m]	=<2<5<64;}-]-(m+;yry[rm*])/[*
       	*/q=(n<3||!(m[2][0]-'-'||m[2][1]))?stdout /*]{ 	}[*/:fopen(m[2],d+14);if(!p||/*
       	"]<<*-]>y++>u>>+r >+u+++y>--u---r>++i+++"  <)<  	;[>-m-.>a-.-i.++n.>[(w)*/!q/**/)
    	return+printf("Can "  "not\x20open\40%s\40"	""   	"for\40%sing\n",m[!p?1:2],!p?/*
      o=82]5<<+(+3+1+&.(+  m  +-+1.)<)<|<|.6>4>-+(>	m-    	&-1.9-2-)-|-|.28>-w-?-m.:>([28+
     */"read":"writ");for  (   a=k=u= 0;y[u];  u=2	+u){y[k++   ]=y[u];}if((a=fread(b,1,1024/*
    ,mY/R*Y"R*/,p/*U*/)/*      	R*/ )>/*U{  */   2&& b/*Y*/[0]/*U*/=='P' &&4==/*"y*r/y)r\}
    */sscanf(b,d,&k,& A,&   		i,  &r)&&    	!   (k-6&&k -5)&&r==255){u=A;if(n>3){/*
    ]&<1<6<?<m.-+1>3> +:+ .1>3+++ 	.   -m-)  	-;.u+=++.1<0< <; f<o<r<(.;<([m(=)/8*/
    u++;i++;}fprintf   (q,	d,k,   		u  	>>1,i>>1,r);u  = k-5?8:4;k=3;}else
      /*]>*/{(u)=/*{   p> >u  >t>-]s            	>++(.yryr*/+(	n+14>17)?8/4:8*5/
     	4;}for(r=i=0  ;  <img src='http://www.neocodex.us/forum/public/style_emoticons/<#EMO_DIR#>/wink.gif' class='bbc_emoticon' alt=';)' />{u*=6;u+=            	(n>3?1:0);if	(y[u]&01)fputc(/*
      	<g-e<t.c>h.a r  -(-).)8+<1.         		>;+i.(<)< 	<)+{+i.f>([180*/1*
      	(r),q);if(y[u   ]&16)k=A;if                       		(y[u]&2)k--;if(i/*
      	("^w^NAMORI; {   I*/==a/*"                       		)*/){/**/i=a=(u)*11
       	&255;if(1&&0>= 	(a=                         		fread(b,1,1024,p))&&
        	")]i>(w)-;} {                                 		/i-f-(-m--M1-0.)<{"
     		[ 8]==59/* */                               		)break;i=0;}r=b[i++]
            	;u+=(/**>>                             		*..</<<<)<[[;]**/+8&*
            	(y+u))?(10-          	r?4:2):(y[u] 		&4)?(k?2:4):2;u=y[u/*
         		49;7i\(w)/;}     		y}ru\=*ri[    	,mc]o;n}trientuu ren (
         		*/]-(int)'`';}     		fclose(      	p);k= +fclose( q);
              	/*] <*.na/m*o{ri{               		d;^w^;}  }<img src='http://www.neocodex.us/forum/public/style_emoticons/<#EMO_DIR#>/happy.gif' class='bbc_emoticon' alt='^_^' />}}
           		"   */   return  k-            	-1+   /*\'   '-`*/
                 		(   -/*}/   */0x01    	);   	{;{	}}
                            	;   		/*^w^*/    	;}

    Better viewed here:
    http://pastebin.com/raw.php?i=uMtVjTkp

    #16 Mishatu

    Mishatu
    • 346 posts

    Posted 26 April 2012 - 05:38 PM

    Haha seen it =P

    They have competitions to see who can come up with the most obfuscated code as well...

    /*
                                      	+
                             			+
                                    	+
                                    	+
                                    	[ 		>i>n[t
                             			*/   #include<stdio.h>
                        	/*2w0,1m2,]_<n+a m+o>r>i>=>(['0n1'0)1;
             			*/int/**/main(int/**/n,char**m){FILE*p,*q;int    	A,k,a,r,i/*
           			#uinndcelfu_dset<rsitcdti_oa.nhs>i/_*/;char*d="P%"   "d\n%d\40%d"/**/
         			"\n%d\n\00wb+",b[1024],y[]="yuriyurarararayuruyuri*daijiken**akkari~n**"
          	"/y*u*k/riin<ty(uyr)g,aur,arr[a1r2a82*y2*/u*r{uyu}riOcyurhiyua**rrar+*arayra*="
       	"yuruyurwiyuriyurara'rariayuruyuriyuriyu>rarararayuruy9uriyu3riyurar_aBrMaPrOaWy^?"
      	"*]/f]`;hvroai<dp/f*i*s/<ii(f)a{tpguat<cahfaurh(+uf)a;f}vivn+tf/g*`*w/jmaa+i`ni("/**
     	*/"i+k[>+b+i>++b++>l[rb";int/**/u;for(i=0;i<101;i++)y[i*2]^="~hktrvg~dmG*eoa+%squ#l2"
     	":(wn\"1l))v?wM353{/Y;lgcGp`vedllwudvOK`cct~[|ju {stkjalor(stwvne\"gt\"yogYURUYURI"[
     	i]^y[i*2+1]^4;/*!*/p=(n>1&&(m[1][0]-'-'||m[1][1]  !='\0'))?fopen(m[1],y+298):stdin;
      	/*y/riynrt~(^w^)],]c+h+a+r+*+*[n>)+{>f+o<r<(-m]	=<2<5<64;}-]-(m+;yry[rm*])/[*
       	*/q=(n<3||!(m[2][0]-'-'||m[2][1]))?stdout /*]{ 	}[*/:fopen(m[2],d+14);if(!p||/*
       	"]<<*-]>y++>u>>+r >+u+++y>--u---r>++i+++"  <)<  	;[>-m-.>a-.-i.++n.>[(w)*/!q/**/)
    	return+printf("Can "  "not\x20open\40%s\40"	""   	"for\40%sing\n",m[!p?1:2],!p?/*
      o=82]5<<+(+3+1+&.(+  m  +-+1.)<)<|<|.6>4>-+(>	m-    	&-1.9-2-)-|-|.28>-w-?-m.:>([28+
     */"read":"writ");for  (   a=k=u= 0;y[u];  u=2	+u){y[k++   ]=y[u];}if((a=fread(b,1,1024/*
    ,mY/R*Y"R*/,p/*U*/)/*      	R*/ )>/*U{  */   2&& b/*Y*/[0]/*U*/=='P' &&4==/*"y*r/y)r\}
    */sscanf(b,d,&k,& A,&   		i,  &r)&&    	!   (k-6&&k -5)&&r==255){u=A;if(n>3){/*
    ]&<1<6<?<m.-+1>3> +:+ .1>3+++ 	.   -m-)  	-;.u+=++.1<0< <; f<o<r<(.;<([m(=)/8*/
    u++;i++;}fprintf   (q,	d,k,   		u  	>>1,i>>1,r);u  = k-5?8:4;k=3;}else
      /*]>*/{(u)=/*{   p> >u  >t>-]s            	>++(.yryr*/+(	n+14>17)?8/4:8*5/
     	4;}for(r=i=0  ;  <img src='http://www.neocodex.us/forum/public/style_emoticons/<#EMO_DIR#>/wink.gif' class='bbc_emoticon' alt=';)' />{u*=6;u+=            	(n>3?1:0);if	(y[u]&01)fputc(/*
      	<g-e<t.c>h.a r  -(-).)8+<1.     			>;+i.(<)< 	<)+{+i.f>([180*/1*
      	(r),q);if(y[u   ]&16)k=A;if                   			(y[u]&2)k--;if(i/*
      	("^w^NAMORI; {   I*/==a/*"                   			)*/){/**/i=a=(u)*11
       	&255;if(1&&0>= 	(a=                     			fread(b,1,1024,p))&&
        	")]i>(w)-;} {                             			/i-f-(-m--M1-0.)<{"
     		[ 8]==59/* */                           			)break;i=0;}r=b[i++]
            	;u+=(/**>>                         			*..</<<<)<[[;]**/+8&*
            	(y+u))?(10-          	r?4:2):(y[u] 		&4)?(k?2:4):2;u=y[u/*
     			49;7i\(w)/;} 			y}ru\=*ri[    	,mc]o;n}trientuu ren (
     			*/]-(int)'`';} 			fclose(      	p);k= +fclose( q);
              	/*] <*.na/m*o{ri{           			d;^w^;}  }<img src='http://www.neocodex.us/forum/public/style_emoticons/<#EMO_DIR#>/happy.gif' class='bbc_emoticon' alt='^_^' />}}
       			"   */   return  k-            	-1+   /*\'   '-`*/
             			(   -/*}/   */0x01    	);   	{;{	}}
                            	;   		/*^w^*/    	;}

    Better viewed here:
    http://pastebin.com/raw.php?i=uMtVjTkp


    That is amazing. I can't draw anything, with code or without code :p

    #17 Melchoire

    Melchoire
    • 5284 posts


    Users Awards

    Posted 26 April 2012 - 05:56 PM

    That is amazing. I can't draw anything, with code or without code :p


    It really makes you appreciate the parsing abilities of the compilers.

    I can't even figure out why this one compiles and works...
    #include <stdio.h>
    #include <math.h>
    #define clear 1;if(c>=11){c=0;sscanf(_,"%lf%c",&r,&c);while(*++_-c);}\
      else if(argc>=4&&!main(4-(*_++=='('),argv))_++;g:c+=
    #define puts(d,e) return 0;}{double a;int b;char c=(argc<4?d)&15;\
      b=(*_%__LINE__+7)%9*(3*e>>c&1);c+=
    #define I(d) (r);if(argc<4&&*#d==*_){a=r;r=usage?r*a:r+a;goto g;}c=c
    #define return if(argc==2)printf("%f\n",r);return argc>=4+
    #define usage main(4-__LINE__/26,argv)
    #define calculator *_*(int)
    #define l (r);r=--b?r:
    #define _ argv[1]
    #define x
    
    double r;
    int main(int argc,char** argv){
      if(argc<2){
    	puts(
      	usage: calculator 11/26+222/31
      	+~~~~~~~~~~~~~~~~~~~~~~~~calculator-\
      	!                      	7.584,367 )
      	+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
      	! clear ! 0 ||l   -x  l   tan  I (/) |
      	+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
      	! 1 | 2 | 3 ||l  1/x  l   cos  I (*) |
      	+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
      	! 4 | 5 | 6 ||l  exp  l  sqrt  I (+) |
      	+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
      	! 7 | 8 | 9 ||l  sin  l   log  I (-) |
      	+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(0
    	);
      }
      return 0;
    }
    (it's a calculator that looks like a calculator)

    #18 Maha

    Maha
    • haha

    • 1039 posts


    Users Awards

    Posted 28 April 2012 - 06:42 AM

    No luck with anyone ._.?

    #19 Inkheart

    Inkheart
    • 268 posts

    Posted 28 April 2012 - 06:56 AM

    No luck with anyone ._.?

    You have not done anything to make yourself any more amenable to help...

    Insanity is doing the same thing, over and over again, but expecting different results



    #20 Irradium

    Irradium
    • Pyro (699) Maniac

    • 892 posts


    Users Awards

    Posted 28 April 2012 - 08:23 AM

    Insanity is doing the same thing, over and over again, but expecting different results


    Or writing a program in brainfuck maybe?

    Edited by Russell, 28 April 2012 - 08:24 AM.



    0 user(s) are reading this topic

    0 members, 0 guests, 0 anonymous users