Jump to content

Search the Community

Showing results for tags 'mysql to sqlsrv code change'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I tried this: <?php session_start();?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Session Notes Entry Form</title> <meta name="description" content=""> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.2.0/pure-min.css"> <link rel="stylesheet" href="css/main.css"> <link rel="icon" type="image/ico" href="favicon.ico"> </head> <?php include('C:\inetpub\wwwroot\connect.php'); ?> <?php if(isset($_POST['login'])){ $provider_id = mysql_real_escape_string($_POST['provider_id']); $password = mysql_real_escape_string($_POST['password']); $sql = " SELECT COUNT(*) as count FROM providers WHERE provider_id = '$provider_id' AND password = '$password' "; $res = mysql_fetch_assoc(mysql_query($sql)); if($res['count'] == 1){ $logged_in = true; $_SESSION['provider_id'] = $provider_id; $_SESSION['password'] = $password; } else { $logged_in = false; } } elseif(isset($_SESSION['provider_id'])) { $provider_id = $_SESSION['provider_id']; $password = $_SESSION['password']; $sql = " SELECT COUNT(*) as count FROM providers WHERE provider_id = '$provider_id' AND password = '$password' "; $res = mysql_fetch_assoc(mysql_query($sql)); if($res['count'] == 1){ $logged_in = true; } else { $_SESSION = array(); session_destroy(); $logged_in = false; } } else { $logged_in = false; } if(!$logged_in){ $tpl_vars = array(); $tpl_vars['{{title}}'] = "Session Entry | Login"; $provider_id = isset($_POST['provider_id']) ? $_POST['provider_id'] : ''; $tpl_vars['{{content}}'] = str_replace('{{provider_id}}',$provider_id,file_get_contents('tpl/login_form.html')); } else { $session_provider_id = $_SESSION['provider_id']; $sql = "SELECT *,DATE_FORMAT(appointment,'%b %d %Y %h:%i %p') as appt FROM session_notes WHERE provider_id = '$session_provider_id'"; $res = mysql_query($sql); //Table Headers $table = "<table><tr><th>Appointment ID</th><th>Patient ID</th><th>Appointment</th><th>Method(s) Provided</th><th>Response/Goals</th><th>Plan/Comments</th></tr>"; while($row = mysql_fetch_assoc($res)){ $table .= "<tr>"; $table .= "<td>$row[appointment_id]</td>"; $table .= "<td>$row[patient_id]</td>"; $table .= "<td>$row[appt]</td>"; $table .= "<td>".nl2br($row['notes'])."</td>"; $table .= "<td>".nl2br($row['notes2'])."</td>"; $table .= "<td>".nl2br($row['notes3'])."</td>"; $table .= "<td>"; $table .= "<form action='update.php' method='post'>"; $table .= "<input type='submit' value='edit' name='edit'>"; $table .= "<input type='hidden' name='appointment_id' value='$row[appointment_id]'>"; $table .= "</form>"; $table .= "</td>"; $table .= "</tr>"; } $table .= "</table>"; $tpl_vars['{{title}}'] = "Session Notes Entry"; $tpl_vars['{{content}}'] = str_replace('{{table}}',$table,file_get_contents('tpl/notes_form.html')); } //get template & load data $tpl = file_get_contents('tpl/template.html'); echo str_replace(array_keys($tpl_vars),array_values($tpl_vars),$tpl); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <?php session_start();?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Session Notes Entry Form</title> <meta name="description" content=""> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.2.0/pure-min.css"> <link rel="stylesheet" href="css/main.css"> <link rel="icon" type="image/ico" href="favicon.ico"> </head> <?php include('C:\inetpub\wwwroot\connect.php'); ?> <?php if(isset($_POST['login'])){ $provider_id = sqlsrv_escape($_POST['provider_id']); ??? $password = sqlsrv_escape($_POST['password']); ??? $sql = " SELECT COUNT(*) as count FROM [session_entry].[dbo].[providers] WHERE provider_id = '$provider_id' AND password = '$password' "; $results = sqlsrv_fetch_array(sqlsrv_query($sql)); if($res['count'] == 1){ $logged_in = true; $_SESSION['provider_id'] = $provider_id; $_SESSION['password'] = $password; } else { $logged_in = false; } } elseif(isset($_SESSION['provider_id'])) { $provider_id = $_SESSION['provider_id']; $password = $_SESSION['password']; $sql = " SELECT COUNT(*) as count FROM providers WHERE provider_id = '$provider_id' AND password = '$password' "; $results = sqlsrv_fetch_array(sqlsrv_query($sql)); if($res['count'] == 1){ $logged_in = true; } else { $_SESSION = array(); session_destroy(); $logged_in = false; } } else { $logged_in = false; } if(!$logged_in){ $tpl_vars = array(); $tpl_vars['{{title}}'] = "Session Entry | Login"; $provider_id = isset($_POST['provider_id']) ? $_POST['provider_id'] : ''; $tpl_vars['{{content}}'] = str_replace('{{provider_id}}',$provider_id,file_get_contents('tpl/login_form.html')); } else { $session_provider_id = $_SESSION['provider_id']; $sql = "SELECT *,DATE_FORMAT(appointment,'%b %d %Y %h:%i %p') as appt FROM session_notes WHERE provider_id = '$session_provider_id'"; $results = sqlsrv_query($sql); //Table Headers $table = "<table><tr><th>Appointment ID</th><th>Patient ID</th><th>Appointment</th><th>Method(s) Provided</th><th>Response/Goals</th><th>Plan/Comments</th></tr>"; while($row = sqlsrv_fetch_array($results)){ $table .= "<tr>"; $table .= "<td>$row[appointment_id]</td>"; $table .= "<td>$row[patient_id]</td>"; $table .= "<td>$row[appt]</td>"; $table .= "<td>".nl2br($row['notes'])."</td>"; $table .= "<td>".nl2br($row['notes2'])."</td>"; $table .= "<td>".nl2br($row['notes3'])."</td>"; $table .= "<td>"; $table .= "<form action='update.php' method='post'>"; $table .= "<input type='submit' value='edit' name='edit'>"; $table .= "<input type='hidden' name='appointment_id' value='$row[appointment_id]'>"; $table .= "</form>"; $table .= "</td>"; $table .= "</tr>"; } $table .= "</table>"; $tpl_vars['{{title}}'] = "Session Notes Entry"; $tpl_vars['{{content}}'] = str_replace('{{table}}',$table,file_get_contents('tpl/notes_form.html')); } //get template & load data $tpl = file_get_contents('tpl/template.html'); echo str_replace(array_keys($tpl_vars),array_values($tpl_vars),$tpl); doesn't work
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.