Last active
August 29, 2015 14:21
-
-
Save Luguan/535353094cc15c2f8888 to your computer and use it in GitHub Desktop.
Revisions
-
Luguan revised this gist
Jun 7, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,11 +31,11 @@ function addItems($user, $today, $kommentar, $franvaro, $uppgift){ global $dbh; $addStmt = $dbh->prepare('INSERT INTO Arbetsuppgift(Date, Namn, Kommentar, Narvaro, Extrauppgift) VALUES(:date, :username, :kommentar, :narvaro, :uppgift)'); $addStmt->bindValue (':date', $today); $addStmt->bindValue (':username', $user); $addStmt->bindValue (':kommentar', $kommentar); $addStmt->bindValue (':narvaro', $$franvaro); $addStmt->bindValue (':uppgift', $uppgift); return $addStmt->execute(); -
Luguan revised this gist
Jun 7, 2015 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,16 +3,16 @@ if (isset($_POST['Field4'])) { $franvaro=htmlspecialchars($_POST['field106']); if ($_POST['Field106']=="Second Choice") $franvaro="Närvarande"; else if ($_POST['Field106']=="Third Choice") $franvaro="Sen ankomst"; else if ($_POST['Field106']=="Forth Choice") $franvaro="Frånvarande"; $uppgift; $extra= $_POST['text']; @@ -22,13 +22,13 @@ $uppgift=$uppgift." ".$extra[$i]; } addItems($_SESSION['username'], date("Ymd"), $_POST['Field4'], $franvaro, $uppgift); echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>'; } function addItems($user, $today, $kommentar, $franvaro, $uppgift){ global $dbh; $addStmt = $dbh->prepare('INSERT INTO Arbetsuppgift(Date, Namn, Kommentar, Narvaro, Extrauppgift) VALUES(:date, :username, :kommentar, :narvaro, :extrauppgift)'); -
Luguan revised this gist
Jun 3, 2015 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,10 @@ else if ($_POST['Field106']=="Forth Choice") $frånvaro="Frånvarande"; $uppgift; $extra= $_POST['text']; for ($i=0; $i<count($extra); $i++){ $extra[$i]= $extra[$i]; $uppgift=$uppgift." ".$extra[$i]; @@ -24,11 +27,6 @@ echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>'; } function addItems($user, $today, $kommentar, $narvaro, $uppgift){ global $dbh; -
Luguan revised this gist
Jun 2, 2015 . 1 changed file with 3 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,8 @@ <?php $dbh = new PDO('mysql:host=julkalender3d.se.mysql;dbname=julkalender3d_s', 'julkalender3d_s', 'amax3Ds'); if (isset($_POST['Field4'])) { $frånvaro=htmlspecialchars($_POST['field106']); if ($_POST['Field106']=="Second Choice") @@ -27,36 +25,21 @@ echo 'alert("message successfully sent")'; echo '</script>'; $extra= $_POST['text']; $i = 0; } function addItems($user, $today, $kommentar, $narvaro, $uppgift){ global $dbh; $addStmt = $dbh->prepare('INSERT INTO Arbetsuppgift(Date, Namn, Kommentar, Narvaro, Extrauppgift) VALUES(:date, :username, :kommentar, :narvaro, :extrauppgift)'); $addStmt->bindValue (':date', $today); $addStmt->bindValue (':username', $user); $addStmt->bindValue (':kommentar', $kommentar); $addStmt->bindValue (':narvaro', $narvaro); $addStmt->bindValue (':uppgift', $uppgift); return $addStmt->execute(); } ?> -
Luguan revised this gist
May 27, 2015 . 1 changed file with 11 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,7 @@ if (isset($_POST['Field4'])) { $dbh = new PDO('mysql:host=julkalender3d.se.mysql;dbname=julkalender3d_s', 'julkalender3d_s', 'amax3Ds'); $frånvaro=htmlspecialchars($_POST['field106']); @@ -30,10 +29,6 @@ //För att kunna hantera svenska bokstäver mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $connection); $extra= $_POST['text']; @@ -52,7 +47,16 @@ echo "ERROR: Could not able to execute " .$query. " " . mysql_error($connection); } } function addItems($user, $today, $kommentar, $narvaro, $uppgift){ global $dbh; $addStmt =dbh->prepare('INSERT INTO Arbetsuppgift(Date, Namn, Kommentar, Narvaro, Extrauppgift) VALUES(:date, :username, :kommentar, :narvaro, :extrauppgift)'); $addStmt->bindValue (':date', $today); $addStmt->bindValue (':username', $user); $addStmt->bindValue (':kommentar', $kommentar); $addStmt->bindValue (':narvaro', $narvaro); $addStmt->bindValue (':uppgift', $uppgift); return addStmt->execute(); } ?> -
Luguan revised this gist
May 27, 2015 . 1 changed file with 14 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,10 @@ <?php session_start(); if (isset($_POST['Field4'])) { $frånvaro; $kommentar; $dbh = new PDO('mysql:host=julkalender3d.se.mysql;dbname=julkalender3d_s', 'julkalender3d_s', 'amax3Ds'); $frånvaro=htmlspecialchars($_POST['field106']); @@ -17,11 +16,17 @@ else if ($_POST['Field106']=="Forth Choice") $frånvaro="Frånvarande"; $uppgift; for ($i=0; $i<count($extra); $i++){ $extra[$i]= $extra[$i]; $uppgift=$uppgift." ".$extra[$i]; } addItems($_SESSION['username'], date("Ymd"), $_POST['Field4'], $frånvaro, $uppgift); echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>'; //För att kunna hantera svenska bokstäver mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $connection); @@ -30,23 +35,9 @@ $kommentar = stripslashes($kommentar); $frånvaro=stripslashes($frånvaro); $extra= $_POST['text']; $i = 0; $query = "INSERT INTO Arbetsuppgift (Date,Namn,Kommentar,Narvaro,Extrauppgift) VALUES ('$today','$user','$kommentar','$frånvaro','$uppgift')"; @@ -61,4 +52,7 @@ echo "ERROR: Could not able to execute " .$query. " " . mysql_error($connection); } } function addItems($user, $today, $kommentar, $frånvaro, $uppgift){ } ?> -
Luguan revised this gist
May 27, 2015 . 1 changed file with 16 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,80 +1,64 @@ <?php session_start(); $frånvaro; $kommentar; if (isset($_POST['Field4'])) { $dbh = new PDO('mysql:host=julkalender3d.se.mysql;dbname=julkalender3d_s', 'julkalender3d_s', 'amax3Ds'); $frånvaro=htmlspecialchars($_POST['field106']); if ($_POST['Field106']=="Second Choice") $frånvaro="Närvarande"; else if ($_POST['Field106']=="Third Choice") $frånvaro="Sen ankomst"; else if ($_POST['Field106']=="Forth Choice") $frånvaro="Frånvarande"; echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>'; $kommentar=$_POST['Field4']; //För att kunna hantera svenska bokstäver mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $connection); // To protect MySQL injection for Security purpose $kommentar = stripslashes($kommentar); $frånvaro=stripslashes($frånvaro); //Hämta dagens datum $today = date("Ymd"); $extra= $_POST['text']; // echo $extra; //Tilldela användarnamn från tidigare sidan till $user $user= $_SESSION['username']; $i = 0; $uppgift; for ($i=0; $i<count($extra); $i++){ $extra[$i]= $extra[$i]; $uppgift=$uppgift." ".$extra[$i]; } $query = "INSERT INTO Arbetsuppgift (Date,Namn,Kommentar,Narvaro,Extrauppgift) VALUES ('$today','$user','$kommentar','$frånvaro','$uppgift')"; mysql_query($query); if(mysql_query($query,$connection)){ echo "Records added successfully."; // echo count($extra); } else{ echo "ERROR: Could not able to execute " .$query. " " . mysql_error($connection); } } ?> -
Luguan created this gist
May 27, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ <?php session_start(); $frånvaro; $kommentar; if (isset($_POST['Field4'])) { $frånvaro=htmlspecialchars($_POST['field106']); if ($_POST['Field106']=="Second Choice") $frånvaro="Närvarande"; else if ($_POST['Field106']=="Third Choice") $frånvaro="Sen ankomst"; else if ($_POST['Field106']=="Forth Choice") $frånvaro="Frånvarande"; echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>'; $kommentar=$_POST['Field4']; $connection = mysql_connect("julkalender3d.se.mysql","julkalender3d_s","amax3Ds") or die("ERROR: Could not connect. " . mysqli_connect_error()); //För att kunna hantera svenska bokstäver mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $connection); // To protect MySQL injection for Security purpose $kommentar = stripslashes($kommentar); $frånvaro=stripslashes($frånvaro); //Hämta dagens datum $today = date("Ymd"); $extra= $_POST['text']; // echo $extra; // Selecting Database $databas=mysql_select_db("julkalender3d_s"); //Tilldela användarnamn från tidigare sidan till $user // $user= $_POST['username']; $user=$_SESSION['username']; $i = 0; $uppgift; /* for ($i=0; $i<count($extra); $i++){ $extra[$i]= $extra[$i]; $uppgift=$uppgift." ".$extra[$i]; }*/ $query = "INSERT INTO Arbetsuppgift (Date,Namn,Kommentar,Narvaro,Extrauppgift) VALUES ('$today','$user','$kommentar','$frånvaro','$uppgift')"; // mysql_query($query); $success= mysql_query($query,$connection); if($success==true){ echo "Records added successfully."; // echo count($extra); } else{ echo "ERROR: Could not able to execute " .$query. " " . mysql_error($connection); } mysql_close($connection); } ?>