BillyBoB Posted March 10, 2008 Share Posted March 10, 2008 I get: Parse error: syntax error, unexpected T_RETURN in /var/www/html/test.php on line 15 Code: $o027asdf04qvnola==""?return"lkas45n87x02xhy"; I just started using the short code for if's and so on. Thats probably where my error is can anyone help me out? Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/ Share on other sites More sharing options...
uniflare Posted March 10, 2008 Share Posted March 10, 2008 what? lol ive never wseen that short code before, if your assigning a variable depending on a true or false if statement try this: $variable = ($var1 == $var2)? "var1 == var2" : "var1 != var2"; hope this helps (T_RETURN means the string "return" after the ? symbol in your syntax btw. its fine with the ? but not anything after that... Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/#findComment-488150 Share on other sites More sharing options...
BillyBoB Posted March 10, 2008 Author Share Posted March 10, 2008 Essentially all I'm trying to do is find out if the varible "$o027asdf04qvnola" is equal to "" if it is true then I would return the string "lkas45n87x02xhy" Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/#findComment-488154 Share on other sites More sharing options...
teng84 Posted March 10, 2008 Share Posted March 10, 2008 return ($o027asdf04qvnola=="")?"kas45n87x02xhy":"putsomevaluehere as default"; Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/#findComment-488159 Share on other sites More sharing options...
uniflare Posted March 10, 2008 Share Posted March 10, 2008 beat me but oh well ill post this anyway: hmm, try: <?php function checkit($arg){ return ($arg == null)? "lkas45n87x02xhy" : $arg; } $o027asdf04qvnola = "test"; echo checkit($o027asdf04qvnola); echo("<br>"); $o027asdf04qvnola = ""; echo checkit($o027asdf04qvnola); // echoes: // test<br> // lkas45n87x02xhy ?> this function, you want to "return" the string so im assuming this is inside a function, just take the return .... line and put it instead of the return in your function.... im sure you wil understand it Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/#findComment-488162 Share on other sites More sharing options...
BillyBoB Posted March 10, 2008 Author Share Posted March 10, 2008 ill just put the if commands in instead I am building a SerialKey Identifier thats why i want it to be confusing to decompile i think im going to have to obfuscate it with something. Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/#findComment-488164 Share on other sites More sharing options...
uniflare Posted March 10, 2008 Share Posted March 10, 2008 are you going to be realeasing your source code? if so it wont really matter what you do with it php is extremely easy to hack if they have the source code... if your going to compile this script into a .exe then it will still be reasonably easy to decompile/dissasemble and hack, for serial-key validation i would use c++ or visual basic, and add a lot of routines to throw them off... for more information look into assembly language and how it works (extremely complicated for beginners). maybe someone has some more ideas about serial-key validation in php... (maybe store a list of known serial-keys in a secure db), ------- what is this serial0key for? a php script? or a windows program? Link to comment https://forums.phpfreaks.com/topic/95305-parse-error-in-t_return/#findComment-488458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.