/functions.php
https://bitbucket.org/kenzone/hairloss · PHP · 522 lines · 353 code · 169 blank · 0 comment · 17 complexity · ce14b12a57281f1326c388c2e7b42d8f MD5 · raw file
- <?php
-
- function select_all_doctor()
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM doctor";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<td>";
- echo $row['strClinicName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strTownName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strStateName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPostcode'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPhone'];
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
- function search_doctor_by_state_and_town_admin($newVariablestate,$newVariabletown)
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM doctor where strStateName= '". $newVariablestate ."' and strTownName= '". $newVariabletown ."'";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<script type='text/javascript'>","function popup2(){newwindow=window.open('updatedoctor.php?docid=" . $row['ID']."','name','height=400,width=500,left=400,top=200'); newwindow.focus();};","</script>";
-
- echo "<td>";
- echo "<a href='javascript:popup2();' >". $row['strClinicName'] ."</a>";
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strTownName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strStateName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPostcode'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPhone'];
- echo "</td>";
-
- echo "<script type='text/javascript'>","function popup(){newwindow=window.open('deletedoctor.php?docid=" . $row['ID']."','name','height=200,width=300,left=450,top=250'); newwindow.focus();};","</script>";
-
- echo "<td>";
- echo "<input type='button' value='Delete' onclick='popup()' />";
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
- function search_doctor_by_state_and_town($newVariablestate,$newVariabletown)
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM doctor where strStateName= '". $newVariablestate ."' and strTownName= '". $newVariabletown ."'";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<td>";
- echo $row['strClinicName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strTownName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strStateName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPostcode'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPhone'];
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
- function search_doctor_postcode_admin($postcode)
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM doctor where strPostcode= '". $postcode ."'";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<script type='text/javascript'>","function popup2(){newwindow=window.open('updatedoctor.php?docid=" . $row['ID']."','name','height=400,width=500,left=400,top=200'); newwindow.focus();};","</script>";
-
- echo "<td>";
- echo "<a href='javascript:popup2();' >". $row['strClinicName'] ."</a>";
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strTownName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strStateName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPostcode'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPhone'];
- echo "</td>";
-
- echo "<script type='text/javascript'>","function popup(){newwindow=window.open('deletedoctor.php?docid=" . $row['ID']."','name','height=200,width=300,left=450,top=250'); newwindow.focus();};","</script>";
-
- echo "<td>";
- echo "<input type='button' value='Delete' onclick='popup()' />";
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
- function search_doctor_postcode($postcode)
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM doctor where strPostcode= '". $postcode ."'";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<td>";
- echo $row['strClinicName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strAddress2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strTownName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strStateName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPostcode'];
- echo "</td>";
-
- echo "<td>";
- echo $row['strPhone'];
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
-
- function insert_survey($surveytype,$date)
- {
- include "config/config.php";
- mysql_query("INSERT INTO survey (Type, CreateDate) VALUES ('" . $surveytype . "', '" . $date . "')");
-
- include "config/con_close.php";
- return;
-
- }
-
- function insert_registration($date,$cert,$cert1,$reg,$reg1,$clinic,$doctor,$address,$address2,$town,$postcode,$email,$telephone,$fax,$cert2,$reg2)
- {
- include "config/config.php";
- mysql_query("INSERT INTO registration (RegCreateDate,CertNo,CertNo1,RegNo,RegNo1,ClinicName,Doctor,Address1,Address2,Town,PostCode,Email,Tel,Fax,CertNo2,RegNo2) VALUES ('" . $date . "', '" . $cert . "','" . $cert1 . "','" . $reg . "','" . $reg1 . "','" . $clinic . "','" . $doctor . "','" . $address . "','" . $address2 . "','" . $town . "','" . $postcode . "','" . $email . "','" . $telephone . "','" . $fax . "','" . $cert2 . "','" . $reg2 . "')");
-
- include "config/con_close.php";
- return;
-
- }
-
- function login($username,$password)
- {
- include "config/config.php";
-
- $result = mysql_query("SELECT Username,Password FROM admin WHERE Username = '" . $username . "' AND Password = '" . $password . "'");
-
- if (mysql_num_rows($result) == 0 || mysql_num_rows($result) > 1)
- {
- $_SESSION['login'] = "";
-
- echo "<script>";
- echo "alert('Invalid username or password')";
- echo "</script>";
- }
- else
- {
- $_SESSION['login'] = "1";
-
- echo "<script>";
- echo "window.location='search.php';";
- echo "</script>";
- }
-
- include "config/con_close.php";
- return;
- }
-
- function delete_doctor($doctorID)
- {
- include "config/config.php";
-
- mysql_query("DELETE FROM doctor WHERE ID= '" . $doctorID . "'");
-
-
- include "config/con_close.php";
- return;
-
- }
-
- function update_doctor_table($clinicname,$address_1,$address_2,$town,$state,$postcode,$phone,$DocID)
- {
- include "config/config.php";
-
- mysql_query("UPDATE doctor Set strClinicName = '" . $clinicname . "', strAddress1 = '" . $address_1 . "',strAddress2 = '" . $address_2 . "',strTownName = '" . $town . "',strStateName = '" . $state . "',strPostcode = '" . $postcode . "',strPhone = '" . $phone . "' Where ID = '" . $DocID . "'");
-
- include "config/con_close.php";
- return;
-
- }
-
- function insert_doctor($clinicname,$address_1,$address_2,$town,$state,$postcode,$phone)
- {
- include "config/config.php";
- mysql_query("INSERT INTO doctor (strClinicName, strAddress1, strAddress2,strTownName,strStateName,strPostcode,strPhone) VALUES ('" . $clinicname . "', '" . $address_1 . "', '" . $address_2 . "', '" . $town . "', '" . $state . "', '" . $postcode . "', '" . $phone . "')");
-
- include "config/con_close.php";
- return;
-
- }
-
- function search_all_survey()
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM survey";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<td>";
- echo $row['Type'];
- echo "</td>";
-
- echo "<td>";
- echo $row['CreateDate'];
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
- function search_all_registration()
- {
- include "config/config.php";
-
- $sql = "SELECT * FROM registration";
-
- $result = mysql_query($sql);
-
- $count =1;
- while($row = mysql_fetch_array($result))
- {
-
- echo "<tr>";
-
- echo "<td>" . $count . "</td>";
-
- echo "<td>";
- echo $row['RegCreateDate'];
- echo "</td>";
-
- echo "<td>";
- echo $row['CertNo'];
- echo "</td>";
-
- echo "<td>";
- echo $row['CertNo1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['CertNo2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['RegNo'];
- echo "</td>";
-
- echo "<td>";
- echo $row['RegNo1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['RegNo2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['ClinicName'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Doctor'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Address1'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Address2'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Town'];
- echo "</td>";
-
- echo "<td>";
- echo $row['PostCode'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Email'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Tel'];
- echo "</td>";
-
- echo "<td>";
- echo $row['Fax'];
- echo "</td>";
-
- echo "</tr>";
-
-
- $count = $count + 1;
-
- if($count == 2)
- {
-
- }
- }
-
- include "config/con_close.php";
- }
-
- ?>