SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
PRACTICAL PHP
 BY EXAMPLE

 Jan Leth-Kjaer
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.
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.
Data management

•   MySQL – the database.
•   Retrieve some data.
•   Show the data.
•   Give user functionality to enter/update data.
•   Update the data in database.
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>
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....
File management

• File management on server.
<table border="0" width="50%" cellspacing="10" cellpadding="20">
<?php
$path = « foldername";
  // Open the folder
  $dir_handle = @opendir($path) or die("Unable to open $path");
  // Loop through the files
  while ($file = readdir($dir_handle)) {
  if($file == "." || $file == ".." || substr($file, 0, 10) != 'Nyhedsbrev') continue;
        $aar = substr($file, 11, 4);
        $month_number = substr($file, 16, 2);
        $month_name = date( 'F', mktime(0, 0, 0, $month_number) );
        echo "<tr><td width='32' align='left' valign='top'><font face='Verdana' size='2'>";
        echo "<font face='Verdana' size='2'>" . $aar . "</td><td><font face='Verdana' size='2'>" . $month_name . "</td><td>";
        echo "<font face='Verdana' size='2'><a href='/ foldername /$file'>$file</a></td></tr>";
  }
  // Close
  closedir($dir_handle);
?>
</table>
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);
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)
PayPal – standard call

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="FLFFSFSFSDFL">
<input type="hidden" name="on0" value="Faktura:

<table>
<tr><td nowrap="nowrap">
<font face="Verdana" size="2">Invoice number</font>
<font face="Verdana" size="1"> (Price 5000€.)</font></td></tr><tr><td><input type="text" name="os0" maxlength="200" value="
<?php
echo $workfaknr;
?>
" disabled></td></tr>
<tr><td>&nbsp;</td></tr>
</table>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way
       to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/da_DK/i/scr/pixel.gif" width="1" height="1">
</form>
PayPal – build up

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="PAYPAL ACCOUNT NAME">
<input type="hidden" name="item_name" value=« Invoice total">
<table>
<tr><td><input type="hidden" name="on0" value="Faktura"><font face="Verdana" size="2">Pick Invoice</font></td></tr><tr><td><select name="os0">
<?php
while ($row = mysql_fetch_array($result1))
{ ... Get invoices... }
<tr><td>&nbsp;</td></tr>
</table>
<?php
Echo "<option value='" . $worknr . "'>" . $worknr . ": " . money_format('%.2n', $Total) . "</option>";
$harray[$worki] = "<input type='hidden' name='option_select" . $worki . "' value='" . $worknr . "'><input type='hidden' name='option_amount" . $worki . "'
        value='" . sprintf("%01.2f", $Ptotal) . "'>";
$worki++;
}
?>
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way
        to pay online!">
  <img alt="" border="0" src="https://www.paypalobjects.com/da_DK/i/scr/pixel.gif" width="1" height="1"></p>
</form>
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.
SMS API

$smsnumber = $wmobil[$i];
$bruger = $_SESSION['navn'];
$nu = date("YmdHis");
$work = $i;

$smsid = $bruger . $nu . $work;

// Build Parameters (RETRY=TRUE som default)
$strParameters =
       "?username=USERNAME!!!!" .
    "&password=CODE!!!" .
    "&dialcode=45" .
    "&recipient=$smsnumber" .
    "&text=" . urlencode(utf8_encode("$sms-text")) .
       "&from=Common+CZ" .
       "&callback_url=" . urlencode("http://www.gs-gruppen.org/GS-SMSs.php?smsid=$smsid&password=RETURNPASSWORD");

//Echo $strParameters;

//Send sms and save output in $strOutput
$strOutput = file_get_contents("http://api.textreactor.com/legacy/sms.php" . $strParameters);
Thank you for your attention!
         Questions

Más contenido relacionado

La actualidad más candente

PHP an intro -1
PHP an intro -1PHP an intro -1
PHP an intro -1
Kanchilug
 
Who Needs Ruby When You've Got CodeIgniter
Who Needs Ruby When You've Got CodeIgniterWho Needs Ruby When You've Got CodeIgniter
Who Needs Ruby When You've Got CodeIgniter
ciconf
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
Anthony Montalbano
 
Posts ‹ teslaecoenergy — word press php
Posts ‹ teslaecoenergy — word press phpPosts ‹ teslaecoenergy — word press php
Posts ‹ teslaecoenergy — word press php
Miroslav Miskovic
 
Top 5 Magento Secure Coding Best Practices
Top 5 Magento Secure Coding Best PracticesTop 5 Magento Secure Coding Best Practices
Top 5 Magento Secure Coding Best Practices
Oleksandr Zarichnyi
 

La actualidad más candente (15)

PHP an intro -1
PHP an intro -1PHP an intro -1
PHP an intro -1
 
Who Needs Ruby When You've Got CodeIgniter
Who Needs Ruby When You've Got CodeIgniterWho Needs Ruby When You've Got CodeIgniter
Who Needs Ruby When You've Got CodeIgniter
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
Apostrophe
ApostropheApostrophe
Apostrophe
 
Payments On Rails
Payments On RailsPayments On Rails
Payments On Rails
 
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learnedMoving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Posts ‹ teslaecoenergy — word press php
Posts ‹ teslaecoenergy — word press phpPosts ‹ teslaecoenergy — word press php
Posts ‹ teslaecoenergy — word press php
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10min
 
Top 5 Magento Secure Coding Best Practices
Top 5 Magento Secure Coding Best PracticesTop 5 Magento Secure Coding Best Practices
Top 5 Magento Secure Coding Best Practices
 
Database Management - Lecture 4 - PHP and Mysql
Database Management - Lecture 4 - PHP and MysqlDatabase Management - Lecture 4 - PHP and Mysql
Database Management - Lecture 4 - PHP and Mysql
 
Xmpp prebind
Xmpp prebindXmpp prebind
Xmpp prebind
 
Php (1)
Php (1)Php (1)
Php (1)
 

Similar a Practical PHP by example Jan Leth-Kjaer

Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
Azharul Haque Shohan
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivity
Mouli Chandira
 
Ruby on Rails For Java Programmers
Ruby on Rails For Java ProgrammersRuby on Rails For Java Programmers
Ruby on Rails For Java Programmers
elliando dias
 

Similar a Practical PHP by example Jan Leth-Kjaer (20)

PHP-04-Forms.ppt
PHP-04-Forms.pptPHP-04-Forms.ppt
PHP-04-Forms.ppt
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
Login and Registration form using oop in php
Login and Registration form using oop in phpLogin and Registration form using oop in php
Login and Registration form using oop in php
 
Form demoinplaywithmysql
Form demoinplaywithmysqlForm demoinplaywithmysql
Form demoinplaywithmysql
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Framework
FrameworkFramework
Framework
 
Ip lab
Ip labIp lab
Ip lab
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivityEx[1].3 php db connectivity
Ex[1].3 php db connectivity
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Date difference[1]
Date difference[1]Date difference[1]
Date difference[1]
 
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018Let's write secure Drupal code! - DrupalCamp Oslo, 2018
Let's write secure Drupal code! - DrupalCamp Oslo, 2018
 
Ubi comp27nov04
Ubi comp27nov04Ubi comp27nov04
Ubi comp27nov04
 
Php summary
Php summaryPhp summary
Php summary
 
Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) Theming
 
Ruby on Rails For Java Programmers
Ruby on Rails For Java ProgrammersRuby on Rails For Java Programmers
Ruby on Rails For Java Programmers
 
Rails <form> Chronicle
Rails <form> ChronicleRails <form> Chronicle
Rails <form> Chronicle
 
Tutorial_4_PHP
Tutorial_4_PHPTutorial_4_PHP
Tutorial_4_PHP
 
Tutorial_4_PHP
Tutorial_4_PHPTutorial_4_PHP
Tutorial_4_PHP
 

Más de COMMON Europe

Compiling the Compiler
Compiling the CompilerCompiling the Compiler
Compiling the Compiler
COMMON Europe
 

Más de COMMON Europe (20)

What's New in WebSphere Application Server
What's New in WebSphere Application ServerWhat's New in WebSphere Application Server
What's New in WebSphere Application Server
 
Compiling the Compiler
Compiling the CompilerCompiling the Compiler
Compiling the Compiler
 
Workload Groups overview updates
Workload Groups overview updatesWorkload Groups overview updates
Workload Groups overview updates
 
Why i - Common Europe 2012
Why i - Common Europe 2012Why i - Common Europe 2012
Why i - Common Europe 2012
 
The Ruby OpenSSL extension
The Ruby OpenSSL extensionThe Ruby OpenSSL extension
The Ruby OpenSSL extension
 
Using Ruby on IBM i (i5/OS)
Using Ruby on IBM i (i5/OS)Using Ruby on IBM i (i5/OS)
Using Ruby on IBM i (i5/OS)
 
IBM Systems Director Navigator for i
IBM Systems Director Navigator for iIBM Systems Director Navigator for i
IBM Systems Director Navigator for i
 
IBM i Trends & Directions Common Europe 2012
IBM i Trends & Directions Common Europe 2012IBM i Trends & Directions Common Europe 2012
IBM i Trends & Directions Common Europe 2012
 
IBM i Technology Refreshes Overview 2012 06-04
IBM i Technology Refreshes Overview 2012 06-04IBM i Technology Refreshes Overview 2012 06-04
IBM i Technology Refreshes Overview 2012 06-04
 
IBM i 7.1 & TRs CEC 2012
IBM i 7.1 & TRs CEC 2012IBM i 7.1 & TRs CEC 2012
IBM i 7.1 & TRs CEC 2012
 
DB2 Web Query whats new
DB2 Web Query whats newDB2 Web Query whats new
DB2 Web Query whats new
 
Access client solutions overview
Access client solutions overviewAccess client solutions overview
Access client solutions overview
 
What's new with Zend server
What's new with Zend serverWhat's new with Zend server
What's new with Zend server
 
RPG investment
RPG investmentRPG investment
RPG investment
 
Php arrays for RPG programmers
Php arrays for RPG programmersPhp arrays for RPG programmers
Php arrays for RPG programmers
 
Open source report writing tools for IBM i Vienna 2012
Open source report writing tools for IBM i  Vienna 2012Open source report writing tools for IBM i  Vienna 2012
Open source report writing tools for IBM i Vienna 2012
 
Moving 5.4 to 7.1 AB
Moving 5.4 to 7.1 ABMoving 5.4 to 7.1 AB
Moving 5.4 to 7.1 AB
 
Introduction to My SQL
Introduction to My SQLIntroduction to My SQL
Introduction to My SQL
 
IBM CEC 2012 Storage june 11, 2012
IBM CEC 2012 Storage june 11, 2012IBM CEC 2012 Storage june 11, 2012
IBM CEC 2012 Storage june 11, 2012
 
Getting started with PHP on IBM i
Getting started with PHP on IBM iGetting started with PHP on IBM i
Getting started with PHP on IBM i
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Practical PHP by example Jan Leth-Kjaer

  • 1. PRACTICAL PHP BY EXAMPLE Jan Leth-Kjaer
  • 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....
  • 7. File management • File management on server. <table border="0" width="50%" cellspacing="10" cellpadding="20"> <?php $path = « foldername"; // Open the folder $dir_handle = @opendir($path) or die("Unable to open $path"); // Loop through the files while ($file = readdir($dir_handle)) { if($file == "." || $file == ".." || substr($file, 0, 10) != 'Nyhedsbrev') continue; $aar = substr($file, 11, 4); $month_number = substr($file, 16, 2); $month_name = date( 'F', mktime(0, 0, 0, $month_number) ); echo "<tr><td width='32' align='left' valign='top'><font face='Verdana' size='2'>"; echo "<font face='Verdana' size='2'>" . $aar . "</td><td><font face='Verdana' size='2'>" . $month_name . "</td><td>"; echo "<font face='Verdana' size='2'><a href='/ foldername /$file'>$file</a></td></tr>"; } // Close closedir($dir_handle); ?> </table>
  • 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)
  • 10. PayPal – standard call <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="FLFFSFSFSDFL"> <input type="hidden" name="on0" value="Faktura: <table> <tr><td nowrap="nowrap"> <font face="Verdana" size="2">Invoice number</font> <font face="Verdana" size="1"> (Price 5000€.)</font></td></tr><tr><td><input type="text" name="os0" maxlength="200" value=" <?php echo $workfaknr; ?> " disabled></td></tr> <tr><td>&nbsp;</td></tr> </table> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/da_DK/i/scr/pixel.gif" width="1" height="1"> </form>
  • 11. PayPal – build up <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="PAYPAL ACCOUNT NAME"> <input type="hidden" name="item_name" value=« Invoice total"> <table> <tr><td><input type="hidden" name="on0" value="Faktura"><font face="Verdana" size="2">Pick Invoice</font></td></tr><tr><td><select name="os0"> <?php while ($row = mysql_fetch_array($result1)) { ... Get invoices... } <tr><td>&nbsp;</td></tr> </table> <?php Echo "<option value='" . $worknr . "'>" . $worknr . ": " . money_format('%.2n', $Total) . "</option>"; $harray[$worki] = "<input type='hidden' name='option_select" . $worki . "' value='" . $worknr . "'><input type='hidden' name='option_amount" . $worki . "' value='" . sprintf("%01.2f", $Ptotal) . "'>"; $worki++; } ?> <input type="hidden" name="option_index" value="0"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/da_DK/i/scr/pixel.gif" width="1" height="1"></p> </form>
  • 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.
  • 13. SMS API $smsnumber = $wmobil[$i]; $bruger = $_SESSION['navn']; $nu = date("YmdHis"); $work = $i; $smsid = $bruger . $nu . $work; // Build Parameters (RETRY=TRUE som default) $strParameters = "?username=USERNAME!!!!" . "&password=CODE!!!" . "&dialcode=45" . "&recipient=$smsnumber" . "&text=" . urlencode(utf8_encode("$sms-text")) . "&from=Common+CZ" . "&callback_url=" . urlencode("http://www.gs-gruppen.org/GS-SMSs.php?smsid=$smsid&password=RETURNPASSWORD"); //Echo $strParameters; //Send sms and save output in $strOutput $strOutput = file_get_contents("http://api.textreactor.com/legacy/sms.php" . $strParameters);
  • 14. Thank you for your attention! Questions