Browsing Category
PHP
Download Images From Web Page
download images directly to your local computer, without the need for any authentication, permission, etc. <?php $url=’https://www.example.com/index.php’; $urlsrc=’https://www.example.com/’; $doc=new DOMDocument(); $html=file_get_contents($url); @$doc->loadHTML($html); $xml=simplexml_import_dom($doc); // just to make xpath more simple $images=$xml->xpath(‘//img’); $filenum=1; $Successful=0; $Failed=0; foreach ($images as $img) { $url_components = parse_url($img[‘src’]); // First parse the URL $url_path = $url_components[‘path’]; // Then get the path component $ext = pathinfo($url_path, PATHINFO_EXTENSION); // Then use pathinfo() if($img[‘title’]!=null) { $imgtitle=$img[‘title’]; } else { $imgtitle=pathinfo($url_path, PATHINFO_FILENAME); } if (strpos($img[‘src’],’http’) !== false) { $chkcopy=@copy($img[‘src’], ‘images_extract/data/’.$imgtitle.’.’.$ext); if($chkcopy) { echo $filenum.’) ‘.$img[‘src’].'<br>’; $Successful++; } else { echo $filenum.’) ‘.$img[‘src’].'<br>’; $Failed++; } } else { $chkcopy=@copy($urlsrc.$img[‘src’], ‘images_extract/data/’.$imgtitle.’.’.$ext); if($chkcopy) …
MYSQL Scroll LIST IN PHP
The programming code will list 12 records at a time from a data table contained within a MySQL database. It can scroll forwards and backwards by the same number of rows by clicking the labeled buttons above the list, “Next” and “Previous”. This is a simple to use utility and it works in a clean and seamless manner. In this patch of code, you can see how the data table row counter is advanced forward by 12 rows in the code enclosed in the if–then data structure beginning with “if ($HTTP_POST_VARS[‘submit_page_forward’]) “. And it will go backwards by the same …
Simple file uploader written in PHP
Simple file uploader written in PHP, can be used in different modules and it can be designed according to your needs. <? $file = $_FILES[‘file’]; $name = $_POST[‘name’]; $path = $_POST[‘path’]; $upload = $_POST[‘upload’]; if(isset($upload)){ if($file[‘name’]){ if($name){ if(strlen($path) > 5){ move_uploaded_file($file[‘tmp_name’], $path.$name); echo “<font color=green>File successfully uploaded!</font>”; } else echo “<li> Please enter the path!”; } else echo “<li> Please put the file name!”; } else echo “<li> No file to upload”; echo “<br /><hr />”; } ?>
How to create Ajax based PHP application
JavaScript is a client side scripting language. It is executed on the client side by the web browsers that support JavaScript. JavaScript code only works in browsers that have JavaScript enabled. It supports the following programming patterns; Object oriented Imperative Functional JavaScript enhances the functionality of websites and web applications. It is used to perform activities like. Display a message box Animate text or images on a web page Open a pop up window Update only a single part of a webpage Perform validations on the client side The syntax for JavaScript was inspired by the C Language syntax. The …
Traffic generator via tor (educational)
Set up several onions and just leave them open while you’re browsing through Tor. It’s best if it’s more than one in case anyone analyzing your traffic figures out what it is (they shouldn’t be able to see what address you connect to). <?php if(empty(session_id())) {session_start();} ?><!DOCTYPE html> <html> <head> <title>Traffic generator</title> <?php if(!isset($_SESSION[‘traffic_settings’])) {$_SESSION[‘traffic_settings’]=[ ‘Minimum_refresh_rate’=>3, ‘Maximum_refresh_rate’=>300, ‘Minimum_content’=>0, ‘Maximum_content’=>100000 ];} if(count($_POST)>0) {foreach($_SESSION[‘traffic_settings’] as $k=>$v) {if(isset($_POST[$k]) && !empty($_POST[$k])) {$_SESSION[‘traffic_settings’][$k]=intval($_POST[$k]);}}} $set=$_SESSION[‘traffic_settings’]; $refresh=rand($set[‘Minimum_refresh_rate’], $set[‘Maximum_refresh_rate’]); ?><meta http-equiv=”refresh” content=”<?php echo $refresh; ?>”> </head> <body> <?php echo “Next refresh in $refresh seconds.nn”; ?><form method=”POST”><?php foreach($set as $k=>$v) {echo “<div>$k: <input name=”$k” placeholder=”$v”></div>”;} ?><button type=”submit”>Submit</button></form> <div style=”display:none”><?php …
PHP to feed a video list from a particular channel without Oauth
Youtube API for PHP to feed a video list from a particular channel without Oauth, this API only needs a Channel ID and Channel name. Youtube API is to demonstrate how to show video in our website without 0auth and API Key. This API is created for only a website to display a video list from their channel without 0auth & API key! Basic PHP codes are used to feed a video list. //Enter Your Channel Name $channel_name=”xyz123″; //Enter Your ID $channel=”Uhjfhdkjhfdf454dfde”; // Google Gdata feed url is used to fetch videos from channel. // //->results=[2] this is used to …
Continue reading PHP to feed a video list from a particular channel without Oauth
PHP Useful Extensions, Utilities and Classes
SimplePie SimplePie is a PHP class that helps you work with RSS feeds. Check out the online RSS and Atom feed reader, which demonstrates a simple Web application that uses SimplePie. HTML Purifier HTML Purifier is a standards-compliant HTML filter library written in PHP. HTML Purifier not only removes all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive white list, it also makes sure your documents are standards-compliant. Open source and highly customizable. TCPDF TCPDF is an open-source PHP class for generating PDF documents. htmlSQL htmlSQL is a unique tool. It is a PHP class for …
Continue reading PHP Useful Extensions, Utilities and Classes
PHP Image Manipulation and Graphs
PHP/SWF Charts PHP/SWF Charts is a powerful PHP tool that enables you to create attractive Web charts and graphs from dynamic data. You can use PHP scripts to generate and gather data from databases, then pass it to this tool to generate Flash (SWF) charts and graphs. pChart – a chart-drawing PHP library pChart is a PHP class-oriented framework designed to create aliased charts. Most of today’s chart libraries have a cost; this one is free. Data can be retrieved from SQL queries or CSV files or can be manually provided. WideImage WideImage is a PHP library for dynamic image …
PHP Security Tools
Security Tools Securimage Securimage is a free, open-source PHP CAPTCHA script for generating complex images and CAPTCHA codes to protect forms from spam and abuse. Scavenger Scavenger is an open-source, real-time vulnerability management tool. It helps system administrators respond to vulnerability findings, track vulnerability findings and review accepted and false-positive answered vulnerabilities, without “nagging” them with old vulnerabilities. PHP-IDS PHP-IDS (PHP-Intrusion Detection System) is a simple-to-use, well-structured, fast and state-of-the-art security layer for your PHP-based Web application. Pixy: PHP Security Scanner Pixy is a Java program that performs automatic scans of PHP 4 source code, aimed to detect XSS and …
PHP Testing and Optimization Tools
PHPUnit PHPUnit is a complete port of the popular JUnit unit testing suite to PHP 5. It’s a tool that helps you test your Web application’s stability and scalability. Writing test cases within the PHPUnit framework is easy; here’s how to do it. SimpleTest SimpleTest is a straightforward unit-testing platform for PHP applications. To get up and running with SimpleTest quickly, read through this pragmatic tutorial that shows you how to create a new test case. Selenium Selenium Remote Control (RC) is a test tool that allows you to write automated Web application UI tests in any programming language against any HTTP website using any …
PHP Debugging Tools
Webgrind Webgrind is an Xdebug profiling Web front end in PHP 5. It implements a subset of the features of kcachegrind, installs in seconds and works on all platforms. For quick ‘n’ dirty optimizations, it does the job. Xdebug Xdebug is one of the most popular debugging PHP extensions. It provides a ton of useful data to help you quickly find bugs in your source code. Xdebug plugs right into many of the most popular PHP applications, such as PHPEclipse and phpDesigner. Gubed PHP Debugger As the name implies, Gubed PHP Debugger is a PHP debugging tool for hunting down logic errors. DBG …
CLOUDFARE BYPASSER
Hey, use it at your own risk! YOUTUBE: https://www.youtube.com/channel/UC5DPee5R7vtFytLZAGRNg4A PAGE: https://www.facebook.com/Middle.East.Cyber.Army TWITTER: https://twitter.com/MiddleEastCyber GROUP: https://www.facebook.com/groups/Middle.East.Cyber.Army/ ================================================================== <?php ${“x47x4cx4fBAx4cS”}[“x64x7ahrx6cx67mx77x78“]=“six74x65“;${“x47x4cx4fBx41x4cx53“}[“x73gx6apx63xnlx6a“]=“x78“;${“x47x4cx4fx42Ax4cx53“}[“x71x76x61x7ax73x68lx61x63x6bx71x6d“]=“ux72x6c“;${“x47x4cx4fBx41x4cx53“}[“x63x69wx76ex65x64x73x67x74l”]=“x6dx61x74x63x68x65s”;${“x47x4cOBALx53“}[“x62x6cjx77x67hx71x71x6ex6c“]=“cox75nx74“;$ciarvjpxqojr=“x75x72x6c“;${“x47x4cOx42x41x4cx53“}[“x7ax71x73x6bbx74x68x68x78“]=“x73dox6d“;${“x47Lx4fx42x41Lx53“}[“cx69x64tzmb”]=“sx65x72x76x65x72“;${“x47x4cx4fx42x41x4cx53“}[“x73btx63x6cx70z”]=“x68ex61dx65x72x73“;$ccmkdtr=“ux72x6c“;${“x47x4cx4fBALx53“}[“x78fx6cux6crk”]=“mx65“;${“x47x4cx4fBALS”}[“x6ex71x70x71x79x69x64x65x6c“]=“x73x64om”;${“Gx4cx4fBx41Lx53“}[“ox69x79mx63jx70nofj”]=“ix70“;$ccklsifydxd=“x75x72x6c“;echo“#x20x43LOx55DFAREx20x42Yx50ASSEx52 Bx59x20x54x48x45 Gx52x45Ax54x45Sx54.n“;echo“x23x20x43ODx45D x42x59 : THE x47REx41TEx53T (x20hx74tpx73://wwwx2efx61cx65x62x6fox6b.cox6d/x61x6cx6fux73hx69x31994 ).n“;echo“#x20x43x4fDED Ix4ex20:x20x4diddx6ce Ex61x73t x43x79bex72 Armyx20x4cabx73.n“;$vmkhoyhfc=“x”;echo“x23x20x50AGE:x20https://wwx77.fx61cex62oox6b.x63x6fx6d/Mx69x64dx6cx65x2ex45x61x73tx2eCx79x62x65x72.Ax72mx79.n“;${“x47x4cx4fx42x41Lx53“}[“cx66x67x7ax6ax79ux70x73x69x76m”]=“x75x72x6c“;echo“x23x20GRx4fx55P : hx74x74ps://www.fax63ebx6fox6bx2ex63x6fm/grx6fx75ps/Mx69x64dlx65x2ex45x61x73x74.Cx79bex72x2ex41rx6dx79.n“;${“x47LOBx41x4cx53“}[“x6ahx66gx79x66x73xi”]=“urx6c“;echo“x23 Tx57x49TTx45x52: x68tx74px73://twx69ttex72.cx6fx6d/x4dx69x64dx6cx65x45astCyx62ex72.n“;${“x47Lx4fx42x41Lx53“}[“x6cx67x77x66fx75x68x73“]=“x68x65x61x64x65x72s”;${“x47x4cx4fx42Ax4cx53“}[“bx75x63tqgx77x70xx76x6e“]=“x75rx6c“;function is_ipv4($ip){return filter_var(${${“x47x4cx4fx42x41Lx53“}[“x6fx69x79mcjx70x6eox66x6a“]},FILTER_VALIDATE_IP,FILTER_FLAG_IPV4)?${${“x47x4cx4fx42x41x4cx53“}[“x6fiymx63x6ax70x6eox66j”]}:“(Nx75x6cl)”;}${${“Gx4cx4fx42ALS”}[“xfx6culx72k”]}=$argv[0];${${“Gx4cx4fBx41Lx53“}[“cx66x67x7ax6ax79x75x70x73ix76x6d“]}=@$argv[1];if(!isset(${$ccmkdtr}))die(“n[+]x20x55sax67e: phpx20{$me}x20x3curx6c>n[+] x45xample: x70hx70 {$me}x20hx74tp://x77x77x77.x77ebsitx65x2ex63omn“);${“x47LOx42x41Lx53“}[“x68x74x77x6ax63x70x6a“]=“x73x65x72x76x65r”;if(!preg_match(“/^(hx74tx70s?):x5c//(x77{3}|x773)x2e/i”,${$ccklsifydxd}))die(“nURLx20x69x73 x69x6evax6cix64x2enx55RLx20mux73tx20x62x65x20fox72x6dattx65x64x20as:x20http(x73)://x77x77x77.”.preg_replace(“/^(x68ttx70x73?):/x5c//”,“”,${${“GLx4fx42x41Lx53“}[“bux63x74x71x67wx70x78x76x6e“]}).“n(fx6fx72 cx6fx6dpatix62x69lityx20rx65ax73ox6ex73)n“);${${“x47Lx4fx42x41x4cx53“}[“x73bx74clx70z”]}=get_headers(${${“Gx4cOx42x41x4cS”}[“x6ahfgx79x66sx78x69“]},1);${${“x47x4cx4fx42x41x4cx53“}[“x63ix64x74zx6dx62“]}=${${“GLOx42ALx53“}[“lx67x77x66x66x75hx73“]}[“x53ex72ver”];${“x47x4cx4fx42x41x4cx53“}[“x71x71x78vx6ex72ux6f“]=“urx6c“;${${“x47x4cOx42x41x4cS”}[“x7aqx73x6bx62x74hhx”]}=array(“x63px61nex6c.”,“x66x74px2e“,“x6dx61x69l.”,“x77x65bx6daix6c.”,“x64ix72ex63t.”,“x64ix72x65x63x74-connx65ct.”,“x72ex63ox72dx2e“,“x73sl.”,“x64x6ex73.”,“hex6cx70.”,“bx6cogx2e“,“fx6fx72um.”);${${“GLx4fx42x41x4cx53“}[“blx6ax77gx68x71qnx6c“]}=count(${${“GLx4fx42x41x4cx53“}[“x6eqx70x71x79x69x64x65x6c“]});if(preg_match(“/^(hx74tx70s?):x5c/x5c/(w{x33}|wx33)x2e/i”,${$ciarvjpxqojr},${${“x47x4cx4fBx41x4cS”}[“x63x69wx76ex65x64x73x67x74l”]})){if(${${“x47x4cx4fx42Ax4cx53“}[“x63x69wx76x65x65x64x73gtx6c“]}[2]!=“wx77x77“){${${“x47LOx42x41LS”}[“qx76ax7ax73x68x6cackx71x6d“]}=preg_replace(“/^(x68x74tpx73?):x5c/x5c//”,“”,${${“x47x4cOx42x41Lx53“}[“qvax7ax73x68x6cx61x63kqm”]});}else{${“x47x4cx4fx42x41Lx53“}[“x75x7asx76x74hux6ax72x6f“]=“max74x63x68es”;$floxlvt=“x75x72x6c“;${${“x47x4cOBx41x4cx53“}[“qx76azsx68x6cx61x63x6bx71x6d“]}=explode(${${“x47x4cx4fBx41x4cS”}[“x75x7ax73x76x74x68x75x6arx6f“]}[0],${${“x47LOBALS”}[“x71x76ax7asx68lacx6bx71m”]});${$floxlvt}=${${“Gx4cx4fBx41Lx53“}[“x71vax7ax73x68x6cx61x63kx71x6d“]}[1];}}if(is_array(${${“x47Lx4fx42x41Lx53“}[“x68x74x77x6ax63px6a“]}))${${“GLx4fx42x41x4cx53“}[“x63x69dtx7ax6db”]}=${${“x47x4cOx42x41x4cx53“}[“x63x69x64tx7ax6db”]}[0];$tesyfrhqyv=“x63x6fx75x6ex74“;if(preg_match(“/x63x6cox75x64fx6carx65/x69“,${${“GLx4fBAx4cS”}[“x63idtzx6db”]}))echo“n[+] x43x6cox75dFlax72ex20dex74x65x63tx65x64:x20{$server}n“;else echo“n[+]x20NOTx20Px52x4fTx45x43Tx45Dx20x42x59 x43Lx4fUx44x46x41Rx45 !!!,x20x50ROCx45Ex44INx47 Ax4ex59x57Ax59 !!x21.n“;echo“[+] x49P: “.is_ipv4(gethostbyname(${${“x47x4cx4fx42x41x4cx53“}[“x71x71x78x76x6erx75x6f“]})).“nn“;${“x47x4cOx42x41x4cx53“}[“x71x76x70dx66x72zx67“]=“x78“;echo“[+]x20Sex61x72cx68inx67 fox72 morx65x20IP addx72esx73ex73.nn“;for(${$vmkhoyhfc}=0;${${“x47x4cx4fx42ALx53“}[“x71x76x70x64x66rx7ag”]}<${$tesyfrhqyv};${${“x47x4cx4fx42ALx53“}[“sx67x6ax70x63xx6elx6a“]}++){$kkwryamm=“x”;$fwudonliq=“x73x64x6fx6d“;${“x47x4cx4fx42Ax4cx53“}[“x72dx72x78jx68x67dx78x75x61x75“]=“sx69te”;${${“x47Lx4fx42ALx53“}[“x72x64rx78jx68gx64xx75ax75“]}=${$fwudonliq}[${$kkwryamm}].${${“Gx4cOBx41x4cx53“}[“qvx61x7ax73hx6cx61cx6bx71x6d“]};$eotbnymob=“x69x70“;${$eotbnymob}=is_ipv4(gethostbyname(${${“x47x4cx4fx42x41x4cx53“}[“x64x7ax68rx6cx67mx77x”]}));echo“x54x72x79ix6ex67 {$site}:x20{$ip}n“;}echo“n[+]x20Finix73hx65x64x2en“; ?>
holding image data on mysql
two things are needful fot holding image data on mysql 1/. A BLOB field so that the data is held truly 8 bit clean 2/. A way to inject it without trying to use tools designed for text. I’ve used two methods. Both work. (a) use the ‘load file’ command t tp transfer an image on disk to Msql. It does however need special mysql privileges that are not always available or safe.. 2/. From PHP environment, I turn the image data into an enormous hexadecimal number. MySQL seems able to understand that as niray data OK. ie in PHP …
PHP “Post ” in forms example
<!DOCTYPE html><html><body><form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’];?>“>Name: <input type=”text” name=”fname”><input type=”submit”></form><?php $name = $_POST[‘fname’]; echo $name; ?></body></html>
Suggestion box in PHP
Suggestion box in PHP Basically you type something and the software will propose suggestions Two parts code. The first part it’s the HTML page <html><head><script>function showHint(str) { if (str.length==0) { document.getElementById(“txtHint”).innerHTML=””; return; } var xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText; } } xmlhttp.open(“GET”,”gethint.php?q=”+str,true); xmlhttp.send();}</script></head><body><p><b>Start typing a name in the input field below:</b></p><form> First name: <input type=”text” onkeyup=”showHint(this.value)”></form><p>Suggestions: <span id=”txtHint”></span></p></body></html> Now the PHP code to be save as gethint.php <?php// Fill up array with names$a[]=”Anna”;$a[]=”Brittany”;$a[]=”Cinderella”;$a[]=”Diana”;$a[]=”Eva”;$a[]=”Fiona”;$a[]=”Gunda”;$a[]=”Hege”;$a[]=”Inga”;$a[]=”Johanna”;$a[]=”Kitty”;$a[]=”Linda”;$a[]=”Nina”;$a[]=”Ophelia”;$a[]=”Petunia”;$a[]=”Amanda”;$a[]=”Raquel”;$a[]=”Cindy”;$a[]=”Doris”;$a[]=”Eve”;$a[]=”Evita”;$a[]=”Sunniva”;$a[]=”Tove”;$a[]=”Unni”;$a[]=”Violet”;$a[]=”Liza”;$a[]=”Elizabeth”;$a[]=”Ellen”;$a[]=”Wenche”;$a[]=”Vicky”;// get the q parameter from URL$q=$_REQUEST[“q”]; $hint=””;// lookup all hints from array if $q is different from “” if …
Image Verification for Form Submission
<?PHP ///////////////////////////////////////////// // send_imagever.php // ///////////////////////////////////////////// session_start(); // set up some default values // ~~~~~~~~~~~~~~~~~~~~~~~~~~ $sessionvar = ‘imageVerHash’; $imgWidth = 96; $imgHeight = 36; $borderThick = 1; $numChars = 5; // set up blank image pallet with borders // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $image = imagecreate($imgWidth, $imgHeight); $bgColor = imagecolorallocate ($image, 255, 255, 255); $textColor = imagecolorallocate ($image, 0, 0, 0); // Initialize some values // ~~~~~~~~~~~~~~~~~~~~~~ $numString = ”; // init string of numbers $minX = $borderThick +2; // first x position for chars $minY = $borderThick +2; // lowest y position for chars srand(make_seed()); // seed the random generator // Loop …
php simple excel table
<?php // class SimpleExcelCellsTypes { const None =0; const Numeric =1; const Date =2; const Text =3; } class SimpleExcelSheets { public $named =null; public $fullfile =null; public $has_header =null; public $has_data =null; public $max_row =1; } class SimpleExcel { // private $ColumnText =array(‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’U’,’V’,’W’,’X’,’Y’,’Z’,’AA’,’AB’,’AC’,’AD’,’AE’,’AF’,’AG’,’AH’,’AI’,’AJ’,’AK’,’AL’,’AM’,’AN’,’AO’,’AP’,’AQ’,’AR’,’AS’,’AT’,’AU’,’AV’,’AW’,’AX’,’AY’,’AZ’,’BA’,’BB’,’BC’,’BD’,’BE’,’BF’,’BG’,’BH’,’BI’,’BJ’,’BK’,’BL’,’BM’,’BN’,’BO’,’BP’,’BQ’,’BR’,’BS’,’BT’,’BU’,’BV’,’BW’,’BX’,’BY’,’BZ’,’CA’,’CB’,’CC’,’CD’,’CE’,’CF’,’CG’,’CH’,’CI’,’CJ’,’CK’,’CL’,’CM’,’CN’,’CO’,’CP’,’CQ’,’CR’,’CS’,’CT’,’CU’,’CV’,’CW’,’CX’,’CY’,’CZ’,’DA’,’DB’,’DC’,’DD’,’DE’,’DF’,’DG’,’DH’,’DI’,’DJ’,’DK’,’DL’,’DM’,’DN’,’DO’,’DP’,’DQ’,’DR’,’DS’,’DT’,’DU’,’DV’,’DW’,’DX’,’DY’,’DZ’,’EA’,’EB’,’EC’,’ED’,’EE’,’EF’,’EG’,’EH’,’EI’,’EJ’,’EK’,’EL’,’EM’,’EN’,’EO’,’EP’,’EQ’,’ER’,’ES’,’ET’,’EU’,’EV’,’EW’,’EX’,’EY’,’EZ’,’FA’,’FB’,’FC’,’FD’,’FE’,’FF’,’FG’,’FH’,’FI’,’FJ’,’FK’,’FL’,’FM’,’FN’,’FO’,’FP’,’FQ’,’FR’,’FS’,’FT’,’FU’,’FV’,’FW’,’FX’,’FY’,’FZ’,’GA’,’GB’,’GC’,’GD’,’GE’,’GF’,’GG’,’GH’,’GI’,’GJ’,’GK’,’GL’,’GM’,’GN’,’GO’,’GP’,’GQ’,’GR’,’GS’,’GT’,’GU’,’GV’,’GW’,’GX’,’GY’,’GZ’,’HA’,’HB’,’HC’,’HD’,’HE’,’HF’,’HG’,’HH’,’HI’,’HJ’,’HK’,’HL’,’HM’,’HN’,’HO’,’HP’,’HQ’,’HR’,’HS’,’HT’,’HU’,’HV’,’HW’,’HX’,’HY’,’HZ’,’IA’,’IB’,’IC’,’ID’,’IE’,’IF’,’IG’,’IH’,’II’,’IJ’,’IK’,’IL’,’IM’,’IN’,’IO’,’IP’,’IQ’,’IR’,’IS’,’IT’,’IU’,’IV’); // private $Strings =array(); private $Header =array(); // private $worksheets =array(); // private $DataFile =””; // private $db =null; // public $CreatedBy =””; public $Company =””; // private $workbook =””; private $styles =””; private $sharedStrings =””; private $content_types =””; private $rels =””; private $app =””; private $core =””; private $xl_rels =””; private $theme1 =””; private $sheet1_rels …
Create Random Password
<?php /** * The letter l (lowercase L) and the number 1 * have been removed, as they can be mistaken * for each other. * Tito code :eyeswideshut25@hotmail.com */ function createRandomPassword() { $chars = “abcdefghijkmnopqrstuvwxyz023456789″; srand((double)microtime()*1000000); $i = 0; $pass = ” ; while ($i <= 7) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } // Usage //$password = createRandomPassword(); //echo “Your random password is: $password”; ?>
PHP SQL Injection
SQL Injection Many web developers are unaware of how SQL queries can be tampered with, and assume that an SQL query is a trusted command. It means that SQL queries are able to circumvent access controls, thereby bypassing standard authentication and authorization checks, and sometimes SQL queries even may allow access to host operating system level commands. Direct SQL Command Injection is a technique where an attacker creates or alters existing SQL commands to expose hidden data, or to override valuable ones, or even to execute dangerous system level commands on the database host. This is accomplished by the application …
3 lightweight php frameworks you should try
You want to send an attachment along with your mail message.
Technique Use a boundary to separate the body of your message with the attachment: <?php $boundary = “b” . md5(uniqid(time())); $mime = “Content-type: multipart/mixed; “; $mime .= “boundary = $boundaryrnrn”; $mime .= “This is a MIME encoded message.rnrn”; // First the regular message $mime_message .= “–$boundaryrn”; $mime .= “Content-type: text/plainrn”; $mime .= “Content-Transfer-Encoding: base64”; $mime .= “rnrn” . chunk_split(base64_encode($message)) . “rn”; // Now the attachment $filename = “data.txt”; $attach = chunk_split(base64_encode(implode(“”, file($filename)))); $mime .= “–$boundaryrn”; $mime .= “Content-type: text/plainrn”; $mime .= “Content-Transfer-Encoding: base64”; $mime .= “rnrn$attachment_datarn”; mail($to, $subject, “”, $mime); ?> Comments When sending messages with more than one part, …
Continue reading You want to send an attachment along with your mail message.
You want to send an e-mail from your PHP script
Technique Use PHP’s built-in mail() function: <?php /* submitted data is $email, $name,$subject, $message and $to */ mail($to, $subject, $message, “From: $emailrnReply-to: $emailrn”); ?> Comments The mail() function takes three required arguments: the e-mail address to which you want to send the e-mail, the subject of the e-mail, and the body of the message. The fourth argument is optional, but it enables you to give any extra headers, which should be separated by the standard <CRLF> (“rn”). The preceding script sends an e-mail based on the user’s input. A form that might trigger this script would be something like …
Continue reading You want to send an e-mail from your PHP script
example of connecting to a database and fetching a row by using the function-oriented API
<?php include_once(“DB/mysql.php”); $dbh = db_connect(array($host,$user,$pass)); if (!$dbh){ die(“Cannot connect to database”); } db_select_db(array(“sampleDB”)); $sth = db_query(“SELECT * FROM sampleTable”, $dbh); if (!$sth) { die(“Cannot execute query”); } while ($row = db_fetch_row(array($sth))) { echo $row[“firstname”]; echo $row[“lastname”]; } db_free_result(array($sth)); db_close(array($dbh)); ?>