|
Mobilen Browser erkennen und entsprechend weiterleiten:
DOWNLOAD
<?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/(android|bb\d+|meego).+mobile|...|bada\/(0yas\-|zte\-/i',substr($useragent,0,4))) header('Location: MOBILE/MOBILE/'); ?>
Oder
<?php $useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))
echo('xy'); ?>
Mobilen Browser erkennen und entsprechendes CSS laden:
DOWNLOAD
<?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/(android|bb\d+|meego).+mobile|)...|op(ti|wv)|p-[2-t,0,4))) { include('head-mobile.php'); } else { include('head-desktop.php'); } ?>
CSS Dekstop:
DOWNLOAD
<head> <title>WEBALGO.CH Algorithmen für das Web</title> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> <!-- TradeDoubler site verification 3191237 --> <title><?php include 'titel.txt';?></title> <link rel="stylesheet" href="webalgo.css"> <script type='text/javascript' src='https://platform-api.sharethis.com/js/sharethis.js#property=5fa529a47efc200012ec7062&product=sop' async='async'></script> <script data-ad-client="ca-pub-3255978515549111" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <link rel="canonical" href="http://webalgo.ch/" /> <meta name="description" content="Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." /> <meta name="robots" content="index"> <meta name="audience" content="all"> <meta name="revisit-after" content="7 days"> <meta name="copyright" content="Markus Müller" /> <meta name="author" content="Markus Müller" /> <meta name="LANGUAGE" content="de" /> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <meta https-equiv="expires" content="0" /> <!--
* * * * * Design & Development: Markus Müller * * * * * www.webalgo.ch * * * * * © 2021
--> <script type='application/ld+json'> { "@context": "http://www.schema.org", "@type": "ProfessionalService", "name": "webalgo", "url": "https://webalgo.ch", "logo": "https://webalgo.ch/ginkoblatt-webalgo.jpg", "priceRange": "$$$$", "description": "WEBALGO Algorithmen für das Web", "address": { "@type": "PostalAddress", "streetAddress": "Seestrasse 270", "addressLocality": "Uerikon", "addressRegion": "ZH", "postalCode": "8713", "addressCountry": "Schweiz" }, "telephone": "+41787704710" } </script> <!-- https://jsonld.com/json-ld-generator/ --> </head> <!-- meta property: an Beispiel von TESLA.COM orientiert. 27.04.21 implementiert -->
CSS Mobile:
DOWNLOAD
<head> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> <title><?php include 'titel.txt';?></title> <link rel="stylesheet" href="webalgo-mobile.css"> <script type='text/javascript' src='https://platform-api.sharethis.com/js/sharethis.js#property=5fa529a47efc200012ec7062&product=sop' async='async'></script> <script data-ad-client="ca-pub-3255978515549111" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <meta name="description" content="WEBALGO.CH bietet Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript und anderen Sprachen an. Lernen eine Website mit HTML und CSS sowie PHP auf aufzubauen. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." /> <meta name="keywords" content="algorithmen, browserweiche, chatbot, chechbox, css, datenbank, html, htmltabelle, htmlgrundgerüst, mysqli, opportunitätskosten, php, platzhalter, sitemap, stylesheet, vorlagen, web, Webalgo, webalgorithmen, websitevorlage, wysiwig" /> <meta name="robots" content="all"/> <meta property="og:site_name" content="WEBALGO" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://www.webalgo.ch/" /> <meta property="og:title" content="WEBALGO.CH: Algorithmen für das WEB" /> <meta property="og:description" content="WEBALGO.CH bietet Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript und anderen Sprachen an. Lernen eine Website mit HTML und CSS sowie PHP auf aufzubauen. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." /> <meta property="og:site_name" content="WEBALGO" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://www.webalgo.ch/" /> <meta property="og:title" content="WEBALGO.CH: Algorithmen für das WEB" /> <meta property="og:description" content="WEBALGO.CH bietet Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript und anderen Sprachen an. Lernen eine Website mit HTML und CSS sowie PHP auf aufzubauen. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." /> <meta property="og:image" content=" https://www.webalgo.ch/ginkoblatt.jpeg"> <meta property="og:image:secure_url" content="https://www.webalgo.ch/ginkoblatt-webalgo.jpg"> <meta property="og:image:type" content="image/jpeg"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="627"> <meta property="og:image:alt" content="WEBALGO.CH Algorithmen für das Web"> <!--
* * * * * Design & Development: Markus Müller * * * * * www.webalgo.ch * * * * * © 2021
--> <script type='application/ld+json'> { "@context": "http://www.schema.org", "@type": "ProfessionalService", "name": "webalgo", "url": "https://webalgo.ch", "logo": "https://webalgo.ch/ginkoblatt-webalgo.jpg", "priceRange": "$$$$", "description": "WEBALGO Algorithmen für das Web", "address": { "@type": "PostalAddress", "streetAddress": "Seestrasse 270", "addressLocality": "Uerikon", "addressRegion": "ZH", "postalCode": "8713", "addressCountry": "Schweiz" }, "telephone": "+41787704710" } </script> <!-- https://jsonld.com/json-ld-generator/ --> </head> <!-- meta property: an Beispiel von TESLA.COM orientiert. 27.04.21 implementiert -->
|
|
Chatbot (Facebook: Seite mit Chatbot einrichten und anhand page-id verbinden) einbinden:
DOWNLOAD
<!-- Load Facebook SDK for JavaScript --> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ xfbml : true, version : 'v5.0' }); };
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = 'https://connect.facebook.net/de_DE/sdk/xfbml.customerchat.js'; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<!-- Your customer chat code --> <div class="fb-customerchat" attribution=setup_tool page_id="115900033588283" logged_in_greeting="Willkommen beim Chatbot von WEBALGO.CH!" logged_out_greeting="Willkommen beim Chatbot von WEBALGO.CH!"> </div>
Facebook-Seite: |

|
 |

Chatbot auf MANYCHAT.COM:

|
|
|
Die MySQLi-Tabelle: (Ausführbar in der Datenbank)
DOWNLOAD
CREATE TABLE `kunden` (
`kunde_id_ins` int(10) NOT NULL,
`name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`adresse` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`telefon` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`geburtstag` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`text` varchar(5000) COLLATE utf8mb4_unicode_ci NOT NULL,
`code_kunde` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

|
|
|
 | |
Verbindung zur MySQLi-Datenbank (Datei dbconnect.php)
DOWNLOAD
<?php $link = mysqli_connect("host", "user", "passwort", "datenbankname"); if($link) { echo ''; }
if(!$link) { exit("Die Datenbankverbindung ist gescheitert! ".mysqli_connect_error()); } ?>
|
 | |
MySQLi-Datenbank Abfrage Datum limitiert: Bsp.: Dat. < 20201025
DOWNLOAD
curdate = date('Ymd');
$sql = "SELECT * FROM tabelle where ablaufdatum = '' OR ablaufdatum > $curdate order by schluesselwort";
|
 | |
Erfassen von Einträgen in die Datenbank
DOWNLOAD
<html> <head> <title>POST ERFASSEN</title> <link rel="stylesheet" type="text/css" href="style.css"> <script src="https://www.google.com/recaptcha/api.js" async defer></script> </head> <body> <script> function printDiv(divName) { var printContents = document.getElementById(divName).innerHTML; var originalContents = document.body.innerHTML; document.body.innerHTML = printContents; window.print(); document.body.innerHTML = originalContents; } </script> <font size="3" face="Arial"> <div id="main"> <div id="login"> <br> <form action="" method="post"> <div id="printableArea"> <table cellspacing="10 border="0"> <tr> <td> <label>Post:</label> </td> <td></td> <td><input type="text" name="post" id="post" required="required" placeholder="Fügen Sie den Code Ihres Postes hier ein"/> </td> </tr>
<tr> <td> <label>Code (notieren!):</label> </td> <td></td> <td> <input type="text" name="code_post" id="code_post" readonly="readonly" value="<?php function gen_random_string($length=6) { $chars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; $final_rand =''; for($i=0;$i<$length; $i++) { $final_rand .= $chars[ rand(0,strlen($chars)-1)]; } return $final_rand; } echo gen_random_string()."\n"; //generates a string ?>" /> </td> </tr> <tr> <td></td><td></td> </tr> <tr> <td></td><td><img src="ph.png" height="20" width="20"></td> </tr> <!-- <tr> <td><div class="g-recaptcha" data-sitekey="6LeKvtEUAAAAAGIYpPS6gOOONegG3AnkNGNP0Ee6"></div></td> </tr> --> <tr> <td><input type="submit" value=" Senden " name="submit"/><br /></td> </tr>
</table> </div>
</form>
</div> <!-- Right side div -->
<div id="delete"> <br> </div><br><br> <div id="formget"> <a href=https://www.formget.com/app><img src="formget.jpg" alt="Online Form Builder"/></a> </div>
</div> <?php if(isset($_POST["submit"])){ include 'dbconnect.php';
// Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
$sql = "INSERT INTO deinetabelle (beispiel,code_beispiel) VALUES ('".$_POST["beispiel"]."','".$_POST["code_beispiel"]."')";
if ($conn->query($sql) === TRUE) { echo "<script type= 'text/javascript'>alert('New record created successfully');</script>"; } else { echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
}
$conn->close(); } ?>
</font> </body> </html> <!-- https://www.formget.com/php-mysqli-insert/ -->
|
 | |
Auslesen von Datensätzen aus der Datenbank
DOWNLOAD
<font size="3" face="Arial">
<?php /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ include 'dbconnect.php'; // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt select query execution $sql = "SELECT * FROM deinetabelle order by xy ASC";
if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){ echo "<table>"; echo "<tr>"; echo "<td align=left><b></b></td>"; echo "<td align=left></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=9><hr></td>"; echo "</tr>"; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td align=left valign=top>" . $row['post'] . "</td>"; echo "<td align=left></td>";
echo "</tr>"; echo "<tr>"; echo "<td colspan=3><hr></td>"; echo "</tr>"; } echo "</table>"; // Free result set mysqli_free_result($result); } else{ echo "No records matching your query were found."; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?>
</font>
|
 | |
Auslesen von Datensätzen aus der Datenbank mit Bedingungen
DOWNLOAD
<font size="3" face="Arial">
<?php /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ include 'dbconnect.php'; // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt select query execution $sql = "SELECT * FROM deinetabelle where deindatenbaneintrag like '%#beispiel%' AND freigabe = 0 order by id_somposts ASC";
if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){ echo "<table>"; echo "<tr>"; echo "<td align=left><b></b></td>"; echo "<td align=left></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=9><hr></td>"; echo "</tr>"; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td align=left valign=top>" . $row['post'] . "</td>"; echo "<td align=left></td>";
echo "</tr>"; echo "<tr>"; echo "<td colspan=3><hr></td>"; echo "</tr>"; } echo "</table>"; // Free result set mysqli_free_result($result); } else{ echo "No records matching your query were found."; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?>
</font>
|
 | |
Suchen von Datensätzen in der Datenbank: Suchformular
DOWNLOAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Search</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <form action="suchformular-script.php" method="post"><p class=1><font size=+2>Durchsuchen Sie die Posts nach Suchbegriffen: <input type="text" id="suchbegriff" name="suchbegriff" /><img src="ph.png" height="1" width="20"> <input type="submit" value="Posts durchsuchen" /> </form> </p> </body> </html>
|
 | |
Suchen von Datensätzen in der Datenbank: Script zum Suchformular
DOWNLOAD
<html> <head> <title>SOMPOSTS.CH Ergebnisse nach Suchbegriff</title> <link rel="stylesheet" type="text/css" href="klins.css" media="screen" /> </head> <body> <div align="center">
<?php include 'top.php'; ?>
<font size="5" face="Arial"><a href="index.php">ZURÜCK</a><br> <font size="3" face="Arial"> <?php /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ include 'dbconnect.php'; // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt select query execution $suchbegriff = $_POST["suchbegriff"]; $sql = "SELECT * FROM deinetabelle where beispiel like '%$suchbegriff%' order by post ASC"; if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){ echo "<table>"; echo "<tr>"; echo "<td align=left><b></b></td>"; echo "</tr>"; echo "<tr>"; echo "<td><hr></td>"; echo "</tr>"; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td align=left valign=top>" . $row['beispiel'] . " " . $row['id_beispiel'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td><hr></td>"; echo "</tr>"; } echo "</table>"; // Free result set mysqli_free_result($result); } else{ echo "Es wurden keine Einträge passend zu Ihrer Suchanfrage gefunden!"; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?>
<!-- https://www.tutorialrepublic.com/php-tutorial/php-mysql-select-query.php --> <!-- https://www.w3schools.com/php/php_mysql_select.asp?fbclid=IwAR2FHZEj7UkKqSe6OhCTzcezzCaS9bkJtNi3Uytv447jcLj04rZ_-qHXaAc --> </font> </div> </body> </html>
|
 | |
Update von Datensätzen in der Datenbank: Formular
DOWNLOAD
<html> <head> <link rel="stylesheet" type="text/css" href="klins.css" media="screen" /> </head> <body><br> <img src="ph.png" height="30" width="1"> <br> <form method="POST" action="update__Ge&Tei3V.php"> <table border="0"> <tr> <td></td> <td colspan=3><font size=+2 color="000000" face="Arial,Helvetica"> <p class=1>UPDATE Datum Inserat</td> </tr> <tr> <td><img src="ph.png" height="1" width="30"></td> <td><p class=1>Datum Inserat:</td><td><img src="ph.png" height="1" width="30"></td> <td> <input type="text" size="17" id="insdat" name="insdat"> </td> </tr> <tr> <td></td> <td><p class=1>Code:</td> <td></td> <td> <input type="text" size="17" id="code" name="code"> </td> <td> </td> <td> </td> </tr> <tr> <td><img src="ph.png" height="30" width="1"></td> <td></td> </tr> <tr> <td></td> <td><input type="submit" value="UPDATE"></td> </table> </form> </p> </font> </body> </html>
|
 | |
Update von Datensätzen in der Datenbank: Script
DOWNLOAD
<?php if (isset($_POST) && isset($_POST['code'])){
// Create connection include 'dbconnect.php'; // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "UPDATE datenbank SET x='".$_POST['insdat']."' WHERE code_x='".$_POST['code']."'"; if ($conn->query($sql) === TRUE) { echo "Record updated successfully"; } else { echo "Error deleting record: " . $conn->error; } $conn->close(); } ?> <!-- https://stackoverflow.com/questions/21863089/update-query-using-post-values -->
|
 | |
Löschen von Datensätzen in der Datenbank: Formular
DOWNLOAD
<html> <head> <title>DELETE SOMPOSTS.CH</title> <body> <form method="POST" action="delete_delete_Ge&Tei3V.php"> <input type="text" size="17" id="code" name="code"> <input type="submit" value="OK"> </form> </body> </html>
|
 | |
Löschen von Datensätzen in der Datenbank: Script
DOWNLOAD
<?php if (isset($_POST) && isset($_POST['code'])){
include 'dbconnect.php'; $dbname = "datenbankname"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // sql to delete a record //$sql = "DELETE FROM datenbankname WHERE id_somposts='".$_POST['code']."'"; //würde auch gehen, aber folgende Zeile ist besser: $sql = "DELETE FROM datenbankname WHERE code_post='".$conn->real_escape_string($_POST['code'])."'"; if ($conn->query($sql) === TRUE) { echo "Record deleted successfully"; } else { echo "Error deleting record: " . $conn->error; } $conn->close(); } ?>
|
|
|