iT邦幫忙

0

r shiny 製作會員登入系統

目前小弟利用r shiny+mysql製作會員登入系統
但碰到一問題,就是當資料庫裡面的會員帳密相同時,我應該如何讓他進入首頁
目前我是先讓他印出表格https://ithelp.ithome.com.tw/upload/images/20180816/201108472glQ8FWrBL.png


# Define UI for application that draws a histogram
ui <- fluidPage(
   
   # Application title
   titlePanel("統資幣登入系統"),
   
   # Sidebar with a slider input for number of bins 
   sidebarLayout(
      sidebarPanel(
        
      ),
      
      # Show a plot of the generated distribution
      mainPanel(textInput(inputId="account1", 
                          label="帳號"),
                textInput(inputId="password1", 
                          label="密碼"),
                submitButton("送出"),
                tableOutput("value3")
      )
   )
)

# Define server logic required to draw a histogram
server <- function(input, output) {
  output$value3 <- renderTable({
  con = dbConnect(RMySQL::MySQL(), 
                  user="03351220", 
                  password="03351220", 
                  host="localhost",
                  dbname="03351220")
  queryStr1 = paste("SELECT * FROM `login` WHERE `ACCOUNT`='",input$account1,"' and `PASSWORD`='",input$password1,"'",sep="")
  dbGetQuery(conn=con, statement=queryStr1) 
  dbDisconnect(con)
  })
}

# Run the application 
shinyApp(ui = ui, server = server)
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答