# file: usern_reg.html # Copyright (c) 1996-2002 Cuesta Technologies, LLC # All rights reserved. # This document contains confidential and/or proprietary information # beloging to Cuesta Technologies, LLC. # Package: nep # # Purpose: # # Requires: # cw source pwfile.tcl cw source mysql.tcl set pageID PG_12 if {[userIsRegistered]} { cw redirect usern_reg_conf$webPgExtn$nocache+reg@Yes force } set receiveInfo "Check here to receive Newbridge's FREE e-mail newsletter." set receiveInfoSDP "Check here to receive Sundance's FREE e-mail newsletter." cw_val_trimSpace redo_form_values # Check to see if the Submit button was pressed. if {[info exists cw_vals(submit)]} { marked_complain LoginEmail isblank "Please enter your e-mail address." marked_complain LoginEmail is_bad_email "Please enter a valid e-mail address." if {[info exists cw_val(LoginEmail)] && [string length $cw_val(LoginEmail)]} { set cw_val(LoginEmail) [string tolower $cw_val(LoginEmail)] set cw_vals(loginEmail) $cw_val(LoginEmail) } marked_complain Passwd isblank "Please enter your password." marked_complain Conf_Passwd isblank "Please confirm your password." marked_complain Order_req_fname isblank "Please enter your first name." marked_complain Order_req_lname isblank "Please enter your last name." marked_complain userPosition contains educator and Order_req_title isblank "Please select your title." marked_complain Order_req_title contains Other and Order_req_title_Other isblank "Please enter your title since you chose Other." marked_complain userPosition isblank "Please select a position" if {[info exists cw_vals(Passwd)] && [info exists cw_vals(Conf_Passwd)]} { if { [pwvalidate $cw_val(Passwd)] == 0 } { set mark(Passwd) 1 lappend complaints "Passwords may not contain spaces or special characters." } if { [string length $cw_val(Passwd)] && [string length $cw_val(Passwd)] < 4} { set mark(Passwd) 1 lappend complaints "Please type in a valid password (at least 4 characters in length)." } marked_complain Passwd !is Conf_Passwd "The passwords you entered do not match." } ##### DETERMINE IF THE USER ALREADY EXISTS IN THE DATABASE if {![llength $complaints]} { #Nov. 6 2001 Cindy: Using MySQL database replace BDB database MysqlConnectUserDB #Gayathri 06/17/2002 check if the table in database exist; if not create one if {![file exists $mysql_usertb_frmpath]} { MysqlCreateTable $mysqlUsertbl $cw_users_tablepath User_Reg_Key User_Reg_Key cw log 2 "*** inside the create table" } set checknameList {User_Reg_Key Order_req_email} set checkvalueList [list $cw_val(LoginEmail) $cw_val(LoginEmail)] if {[MysqlRecordExist $cdb(mysqlusertable) $checknameList $checkvalueList]} { lappend complaints "A user with that e-mail address already exists. Please use the Sign In page if you have already registered online with Newbridge or our sister company, Sundance Publishing. To register as a new member, enter a different e-mail address." ## Have complaint, disconnect the mysql server. MysqlDisconnect } } ##### END OF VERIFYING IF USER EXISTS IN THE DATABASE if {![llength $complaints]} { ##### ADD USER AND LOG HIM IN # If no complaints, (includes user doesn't exist) # 1. add the user to the database. # User_Reg_Key is the first field of user database # 2. log the user in by setting a var in sdb(User_Reg_Key).? ## Gayathri: Fri Aug 2 11:42:19 PDT 2002 ## need to have MysqlCleancw_val when there is no complaints ## clean the cw_vals and cw_val just before writing to the database, ## if not it gives an error. ## example: testing nep's website will be displayed in the form as ## testing nep\'s website which is not correct. set cw_val(User_Reg_Key) $cw_val(LoginEmail) set cw_val(Order_req_email) $cw_val(LoginEmail) set cw_val(NEPBag) {} set password [crypt [string trim $cw_val(Passwd)] [string trim $cw_val(LoginEmail)]] set cw_val(Password) $password # 3. put the following fields in the sdb so that when we go to the # order form, the form is populated correctly without having to # do a database lookup. set columnList [GetColumnList $cw_users_tablepath] FormToArray dataArray $cw_users_tablepath $columnList set update_time [time_manip [timenow] "YMD"] set dataArray(Initial_Reg_Date) $update_time set dataArray(Last_Update) $update_time set dataArray(Last_Logins) $update_time set sdb(Delete_Online) Keep set dataArray(Registered_For) NEP MysqlCleanArray ### Since sdb is an array here, we have to pass array name sdb to proc. MysqlRecordAdd $cdb(mysqlusertable) dataArray $cw_users_tablepath $columnList MysqlDisconnect FormToArray sdb $cw_users_tablepath $columnList cw stats NEWUSER $sdb(User_Reg_Key) cw stats REGSUCCESS $sdb(User_Reg_Key) unset cw_vals cw redirect usern_reg_conf$webPgExtn$nocache force } } # end of processing set sdp_US_states $cw_US_states ### Set list of states to be removed from $sdp_US_states" set list {AA AE AP AS FM GU MH MP PW VI} foreach b $list { set sdp_US_states [ldelete $sdp_US_states $b] } ###### HTML View Part cw source $new_cw_templatePath/templateSetup.tcl cw source $new_cw_templatePath/templateTop.tcl ######################## # Add your own code here ######################## include_file usern_reg_instructions$cdb(inc_extend) puts "
cw_checkboxes2 userPosition $cdb(userPosition) 2
Login Information...
* E-mail Address:" complain_mark LoginEmail * cw_text LoginEmail {} 20 {} 50
* Password: complain_mark Passwd * cw_password Passwd {} 20
* Confirm Password: complain_mark Conf_Passwd * cw_password Conf_Passwd {} 20
Personal Information...
* First Name: complain_mark Order_req_fname * cw_text Order_req_fname {} 20
* Last Name: complain_mark Order_req_lname * cw_text Order_req_lname {} 20
State: cw_popup Order_req_state $sdp_US_states select {} {} $sdb(Order_req_state)
Zip Code: cw_text Order_req_zip $sdb(Order_req_zip) 10
* Are you a(n): complain_mark userPosition *
If you are an educator, please provide your title:
complain_mark Order_req_title * #cw_checkboxes2 Order_req_title $cdb(userTitle) 3 "Other" 20 cw_popupE Order_req_title $cdb(userTitle) Select... Other
If you are an educator, what grades are you involved in?
cw_checkboxes2 TeacherGrade $cdb(userGrade) 3
If you are a parent, what grade(s) are your children in?
cw_checkboxes2 ParentGrade $cdb(userGrade) 3
Preferences...
Please check your areas of interest for Newbridge Educational Publishing:
cw_checkboxes2 NEPInterest $cdb(NEPuserInterest) 2
if {[info exists cw_vals(NEPReceiveInfo)]} { puts "$receiveInfo" } else { puts "$receiveInfo" }
include_file usern_reg_sdpnote$cdb(inc_extend)
Please check your areas of interest for Sundance Publishing:
cw_checkboxes2 Interest $cdb(SDPuserInterest) 2
if {[info exists cw_vals(ReceiveInfo)]} { puts "$receiveInfoSDP" } else { puts "$receiveInfoSDP" }
How did you learn about our Web site?
cw_textarea Order_req_aboutus {rows=5 cols=30 wrap=soft"}
include_file $pagename\_bottom$cdb(inc_extend)
basic_form_buttons {Sign Up} {Clear Changes} {Redo Entire Form} puts "

" cw source $new_cw_templatePath/templateBottom.tcl