2. Scope and subjects
• This is not a PHP upcode class.
• This is not a Zend class.
• This is not an Power specific class.
• This is not about installation of
Apache.
• This is not about work management
of Pase, PHP or related areas.
• This is not a PHP security class.
3. So what is it then?
• I presume you all know some type of
programming and SQL.
• I presume you know HTML at some level.
• I presume you can or know a bit of PHP or
likewise programming languages.
• We will running through a number of practial
PHP examples and see the frontend as well as
the backend = code.
4. Data management
• MySQL – the database.
• Retrieve some data.
• Show the data.
• Give user functionality to enter/update data.
• Update the data in database.
5. Data management – go get it
<?php
session_start();
require("access.php"); // Variabler til mysql hentes
$resultat = mysql_query("SELECT * FROM customer WHERE customernumber = '$number'");
while ($row = mysql_fetch_array($resultat)) {
$CompanyName = $row['CompanyName'];
$Name = $row['Name'];
$email = $row['email'];
$Address1 = $row['Address1'];
$Address2 = $row['Address2'];
....
?>
......
<form action='index.php?page1=CustomerValidate.php method='post' enctype='multipart/form-data'>
....
<tr>
<td width="193"><font face="Verdana" size="2"><b>Companyname:<font color="#FF0000">*</font></b></font></td>
<td colspan="2"><input type="text" name="T1" size="50" tabindex="1" value="<?php echo $CompanyName ; ?>" ></td>
</tr>
6. Data management – validate/update
$CompanyName = $_POST[‘CompanyName '];
.....
// Validate...
if(empty( $CompanyName ) ) {
$error1 = '<br> Companyname is empty ';
}
....
if (preg_match("/^([w|.|-|_]+)@([w||-|_]+).([w|.|-|_]+)$/i", $email-address)) {
} else {
$error4 = "<br> Email is not correctt!";
}
....
Echo $error1 . $error4;
.....
mysql_query("UPDATE Customer SET CompanyName = '$CompanyName '..... Where....
8. PDF creation
• PHP plugin.
<?php
require('fpdf.php');
http://www.fpdf.org
// Get some data – to use..
$resultat1 = mysql_query("SELECT * from meetings where active=‘NEXT'") or die(mysql_error());
while ($row = mysql_fetch_array($resultat1)) {
$firma[$p] = substr($row['CompanyName'], 0, 44);
$pdf->AddPage(P,A4);
// Create some frame – including some text
$pdf->SetFont('Arial','B', ‘$CompanyName’);
$pdf->SetTextColor(0,0,0);
$pdf->SetXY(10,10);
$pdf->SetDrawColor(240,240,240);
$pdf->Cell(90,54,"$pnavn[$a]",1,1,C);
9. PayPal
• Free to have - not free to use.
• You need an account.
Hidden API buildup.
https://cms.paypal.com/us/cgi-bin/?cmd=_render-
• content&content_ID=developer/howto_html_landing
• Create buttons – onsite/offsite.
• Mostly European creditcards.
• Transaction-information related to e.g. invoice
number.
• PayPal – developer site. (https://www.x.com/developers/paypal)
12. SMS API
• External function to call.
• You may see different setup.
• Parameter call – cross site
• API object creation.
• Call back – with delayed information.
• Other functions as API – e.g. Google.