1. Using 'true' and 'false' in Euphoria
- Posted by John Dutcher <jfdutcher1958 at yahoo.com> Jun 02, 2005
- 498 views
The error posted below is followed by the CGI script that causes it. I'm trying to understand what format my 'true' and 'false' need to be in to be acceptable. I have used 'integer' for them, set them up as CONSTANTS etc. I was sure I had seen code examples using 'true' and 'false' as I am doing.....but I gather that can't be............. * **************************************************************** *** The error when the script runs ************* **************************************************************** login_process.exw:17 in function datab_find() true/false condition must be an ATOM user = {107'k',107'k',107'k',107'k',107'k',107'k',107'k',107'k'} pswd = {104'h',104'h',104'h',104'h',104'h',104'h',104'h',104'h'} data = <no value> j = 1 ... called from login_process.exw:63 Global & Local Variables \EUPHORIA\include\machine.e: mem = 741368 check_calls = 1 \EUPHORIA\include\misc.e: pretty_end_col = <no value> pretty_chars = <no value> pretty_start_col = <no value> pretty_level = <no value> pretty_file = <no value> pretty_ascii = <no value> pretty_indent = <no value> pretty_ascii_min = <no value> pretty_ascii_max = <no value> pretty_line_count = <no value> pretty_line_max = <no value> pretty_dots = <no value> pretty_fp_format = <no value> pretty_int_format = <no value> pretty_line = <no value> \EUPHORIA\include\file.e: SLASH = 92'\' my_dir = -2 \EUPHORIA\include\get.e: input_file = <no value> input_string = {52'4',48'0'} string_next = 3 ch = -1 \EUPHORIA\include\database.e: current_db = 3 current_table = 23 db_names = { {117'u',112'p',115's',116't',97'a',116't',100'd',99'c', 46'.',101'e',100'd',98'b'} } db_file_nums = {3} db_lock_methods = {0} current_lock = 0 key_pointers = {546} db_fatal_id = 0 mem0 = 1139160 mem1 = 1139161 mem2 = 1139162 mem3 = 1139163 memseq = {1139160,4} \EUPHORIA\include\graphics.e: BLUE = 1 CYAN = 3 RED = 4 BROWN = 6 BRIGHT_BLUE = 9 BRIGHT_CYAN = 11 BRIGHT_RED = 12 YELLOW = 14 \EUPHORIA\include\aku.e: tp = <no value> tp2 = <no value> pppath = 92'\' hapuscon_kernel32 = 2011693056 hapuscon_freeconsole = 0 hapuscon_tp = 1 euob_hasil = 0 aku_getval_tp = <no value> \EUPHORIA\include\cgia.e: qs = {117'u',115's',101'e',114'r',105'i',100'd',61'=',107'k',107'k',107'k', 107'k',107'k',107'k',107'k',107'k',38'&',112'p',115's',119'w',100'd',61'=', 104'h',104'h',104'h',104'h',104'h',104'h',104'h',104'h',38'&',115's',116't', 97'a',116't',117'u',115's',61'=',78'N',101'e',119'w'} xnama = { {117'u',115's',101'e',114'r',105'i',100'd'}, {112'p',115's',119'w',100'd'}, {115's',116't',97'a',116't',117'u',115's'} } xisi = { {107'k',107'k',107'k',107'k',107'k',107'k',107'k',107'k'}, {104'h',104'h',104'h',104'h',104'h',104'h',104'h',104'h'}, {78'N',101'e',119'w'} } lenq = {52'4',48'0'} login_process.exw: names = { {117'u',115's',101'e',114'r',105'i',100'd'}, {112'p',115's',119'w',100'd'}, {115's',116't',97'a',116't',117'u',115's'} } i = 1 userid = {107'k',107'k',107'k',107'k',107'k',107'k',107'k',107'k'} password = {104'h',104'h',104'h',104'h',104'h',104'h',104'h',104'h'} true = 1 false = 0 ********************************************************************** ********** the script ********************************************** ********************************************************************** -- Process the 'login.html' form used by upstate-ny-dance-calendar.com. include database.e include cgia-en.e object names integer i sequence userid, password userid = {} password = {} global atom true, false true = 1 false = 0 function datab_find(sequence user, sequence pswd) sequence data for j = 1 to db_table_size() do if db_record_key(j) = 0 then return false else data = db_record_data(j) if compare(data[1], user) = 0 then if compare(data[2], pswd) = 0 then return true end if end if end if end for return false end function function table_select() integer j j = db_select_table("calendar") if j != DB_OK then return false else return true end if end function function datab_open() integer j j = db_open("upstatdc.edb", DB_LOCK_NO) if j != DB_OK then return false else return true end if end function parsePost() names = listNames() if compare(names[1], "userid") = 0 then if compare(names[2], "pswd") = 0 then userid = getValue(names[1]) password = getValue(names[2]) i = datab_open() if i = true then i = table_select() if i = true then i = datab_find(userid, password) if i = true then if compare(names[3], "Returning") = 0 then puts(1, "Location: good_login.html") puts(1, "Content-type: text/html") puts(1, " ") else puts(1, "Location: loginerr.html") puts(1, "Content-type: text/html") puts(1, " ") end if else if compare(names[3], "New") = 0 then puts(1, "Location: good_login.html") puts(1, "Content-type: text/html") puts(1, " ") else puts(1, "Location: loginerr.html") puts(1, "Content-type: text/html") puts(1, " ") end if end if else puts(1, "Location: datab_err.html") puts(1, "Content-type: text/html") puts(1, " ") end if else puts(1, "Location: datab_err.html") puts(1, "Content-type: text/html") puts(1, " ") end if else puts(1, "Location: loginerr.html") puts(1, "Content-type: text/html") puts (1, " ") end if else puts(1, "Location: loginerr.html") puts(1, "Content-type: text/html") puts(1, " ") end if --for i = 1 to length(names) do -- puts(1, "<p>" & names[i] & "=" & getValue(names[i])) --end for
2. Re: Using 'true' and 'false' in Euphoria
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 02, 2005
- 499 views
John Dutcher wrote: > > > The error posted below is followed by the CGI script that causes it. > I'm trying to understand what format my 'true' and 'false' need to be in > to be acceptable. I have used 'integer' for them, set them up as CONSTANTS > etc. I was sure I had seen code examples using 'true' and 'false' as I am > doing.....but I gather that can't be............. > * > **************************************************************** > *** The error when the script runs ************* > **************************************************************** > login_process.exw:17 in function datab_find() > true/false condition must be an ATOM This message has nothing to do with your constants true and false. It means that you have an 'if' statement somewhere in which at least one of the operands is a sequence. I suspect its this line ... > if db_record_key(j) = 0 then Is it possible that the record key is a sequence? -- Derek Parnell Melbourne, Australia irc://irc.sorcery.net:9000/euphoria
3. Re: Using 'true' and 'false' in Euphoria
- Posted by John Dutcher <jfdutcher1958 at yahoo.com> Jun 02, 2005
- 487 views
It's 'more' than possible ..... thanks for the insight. Should be able to fix it now. Thanks, John D.