Jump to content

Search the Community

Showing results for tags 'linux'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 32 results

  1. Hello, I've got a question about ddos attack. As happen before our site has been attack, i think it was a ddos attack which crash our server. Back then our web app and database are on the same server. As now web app and database are separate. site is on windows server and its connected to database from other server also (Linux). If an attack like that happen again, is the database server can be prevent from crashing as it is now separate? Thanks. I have a site running on windows server and its connected to database from other server also (Linux).
  2. The following is a little OSM Overpass API example with PHP SimpleXML I've compiled because we do not have it here for PHP and I love OSM, so let's show some useful examples. The first part shows how tro query an Overpass Endpoint with standard PHP. For you the second part is more interesting. That is querying the XML data; This is most easily done with xpath, the used PHP XML library is based on libxml which supports XPath 1.0 which covers the various querying needs very well. see the code: ... and Goal: The output has to be stored into a mysql-db: <?php /** * OSM Overpass API with PHP SimpleXML / XPath * * PHP Version: 5.4 - Can be back-ported to 5.3 by using 5.3 Array-Syntax (not PHP 5.4's square brackets) */ // // 1.) Query an OSM Overpass API Endpoint // $query = 'node ["amenity"~".*"] (-54.5247541978, 2.05338918702, 9.56001631027, 51.1485061713); out;'; $context = stream_context_create(['http' => [ 'method' => 'POST', 'header' => ['Content-Type: application/x-www-form-urlencoded'], 'content' => 'data=' . urlencode($query), ]]); # please do not stress this service, this example is for demonstration purposes only. $endpoint = 'http://overpass-api.de/api/interpreter'; libxml_set_streams_context($context); $start = microtime(true); $result = simplexml_load_file($endpoint); printf("Query returned %2\$d node(s) and took %1\$.5f seconds.\n\n", microtime(true) - $start, count($result->node)); // // 2.) Work with the XML Result // # get all school nodes with xpath $xpath = '//node[tag[@k = "amenity" and @v = "school"]]'; $schools = $result->xpath($xpath); printf("%d School(s) found:\n", count($schools)); foreach ($schools as $index => $school) { # Get the name of the school (if any), again with xpath list($name) = $school->xpath('tag[@k = "name"]/@v') + ['(unnamed)']; list($website) = $school->xpath('tag[@k = "website"]/@v') + ['(no website)']; list($email) = $school->xpath('tag[@k = "contact:email"]/@v') + ['(no email)']; printf("#%02d: ID:%' -10s [%s,%s] %s %s %s\n", $index, $school['id'], $school['lat'], $school['lon'], $name, $website, $email); } //node[tag[@k = "amenity" and @v = "school"]] //tag[@k = "name"]/@v' $query = 'node ["addr:postcode"~"RM12"] (51.5557914,0.2118915,51.5673083,0.2369398); node (around:1000) ["amenity"~"fast_food"]; out;'; $context = stream_context_create(['http' => [ 'method' => 'POST', 'header' => ['Content-Type: application/x-www-form-urlencoded'], 'content' => 'data=' . urlencode($query), ]]); $endpoint = 'http://overpass-api.de/api/interpreter'; libxml_set_streams_context($context); $result = simplexml_load_file($endpoint); printf("Query returned %2\$d node(s) and took %1\$.5f seconds.\n\n", microtime(true) - $start, count($result->node)); so far so good: see the results: #37158: ID:5243708521 [-3.6852719,33.4154523] Buhangija primary school (no website) (no email) #37159: ID:5243805321 [-1.5071460,31.1599459] Kakiro Primary School (no website) (no email) #37160: ID:5243883144 [-10.4578962,39.0935938] Nangoo primary school (no website) (no email) #37161: ID:5244163476 [-6.8637976,39.2586565] PK Academic School (no website) (no email) #37162: ID:5244163478 [-6.8603893,39.2564774] Good Shepherd School (no website) (no email) #37168: ID:5247155223 [-1.6856759,29.0159534] Institut Miteetso (no website) (no email) #37169: ID:5247165222 [-1.7063811,29.0168647] Institut Lwanga-Bobandana (no website) (no email) #37170: ID:5247312700 [9.0129509,38.7290080] EiABC (Ethiopian Institute of Architecture Building Construction & City Devlopment) www.eiabc.edu.et (no email) #37171: ID:5248364671 [-4.3973951,29.1373596] École primaire Makama (no website) (no email) #37172: ID:5248372022 [-1.7101942,29.0233846] Institut Minova (no website) (no email) #37173: ID:5248439027 [-4.2744570,35.7445025] F . t . sumaye secondary school (no website) (no email) #37177: ID:5248974492 [-4.5490651,29.1559410] École primaire Kilicha (no website) (no email) #37178: ID:5248974495 [-4.5476651,29.1508141] École primaire Kazimia 2 (no website) (no email) #37179: ID:5248974504 [-4.5543585,29.1479282] École primaire Lwata (no website) (no email) so - and now i need to store all that stuff into a mysql-db i have to think "JSON". we need to have a closer look at http://php.net/json_decode So a idea for writing to a db table CREATE TABLE `node` ( `id` bigint(20) NOT NULL, `amenity` varchar(30) DEFAULT NULL, `name` varchar(100) DEFAULT NULL, `housenumber` varchar(5) DEFAULT NULL, `housename` varchar(50) DEFAULT NULL, `street` varchar(50) DEFAULT NULL, `city` varchar(50) DEFAULT NULL, `postcode` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; this code will do it $jsn = 'INSERT YOUR DATA HERE'; $jsn = str_replace('addr:','',$jsn); // legalise db column names $data = json_decode($jsn,1); // create array from json data $template = array ( // template array for db inserts 'id' => '', 'amenity' => '', 'name' => '', 'housenumber' => '', 'housename' => '', 'street' => '', 'city' => '', 'postcode' => '' ); $db = new mysqli(HOST,USERNAME,PASSWORD,DATABASE); // prepare the sql statement $sql = "INSERT INTO node (id, amenity, name, housenumber, housename, street, city, postcode) VALUES (?,?,?,?,?,?,?,?)"; $stmt = $db->prepare($sql); $stmt->bind_param('isssssss',$id, $amenity, $name, $housenumber, $housename, $street, $city, $postcode); // process the data foreach ($data['elements'] as $elem) { $tags = array_intersect_key($elem['tags'],$template); // get the tags we need $nodedata = array_merge($template,$tags); // add tag data to template array $nodedata['id'] = $elem['id']; // add id to template array extract($nodedata); $stmt->execute(); // insert in db table "node" }
  3. hello dear php-experts, i want to run and show facebook-actiity feeds (in other words "streams of two different facebook sites) that said i cannot do this with one plugin - can i? well some guys taled bout a solution of copying and cloing a wordpress plugin I want to have multiple instances of the plugin running so i can have different related content on a single page. that said i heard that some guys just do one thing; they coly the copy the plugin. https://wordpress.org/support/topic/installing-2-copies-of-the-same-plugin?replies=8 but thie does not work - so i have to do one facebook-feed with a version like so question - how to include the code: https://developers.facebook.com/docs/plugins/activity Initialize the JavaScript SDK using this app: booksocial123 Include the JavaScript SDK on your page once, ideally right after the opening <body> tag. <div id="fb-root"></div> <script>(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 = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=473241986032774&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Place the code for your plugin wherever you want the plugin to appear on your page. <div class="fb-activity" data-site="facebook.com/literaturen" data-action="likes, recommends" data-width="350px" data-height="350px" data-colorscheme="light" data-header="true"></div> how to include that into a wordpress
  4. I'm getting the following errors when I run `cat /var/log/apache/error.log` -> PHP Notice: Undefined variable: db_connection in /var/www/html/popreport/includes/inmate.php on line 18 -> PHP Fatal error: Call to a member function query() on a non-object in /var/www/html/popreport/includes/inmate.php on line 18 When I try this in my browser I start with test.php test.php <?php require_once("./database.php"); require_once("./inmate.php"); // foreach($query as $row) // { // print_r($row) . "<br />"; // } $inmate = array(); $inmate = new Inmate($inmate); foreach($inmate as $row) { print $row->firstl_name . "<br />"; } ?> database.php <?php include("./constants.php"); try { $db_connection = new PDO("mysql:host=$host;dbname=$db_name", $db_user, $password); $db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br />"; die(); } ?> inmate.php <?php require_once("./database.php"); class Inmate { private $first_name = ''; private $last_name = ''; private $full_name = ''; private $race = ''; private $number = 0; private $facility = ''; private $type_of_transit = ''; public function __construct($inmate) { $sql = "SELECT * FROM inmate_board"; $query = $db_connection->query($sql); $result = $query->fetch(PDO::FETCH_ASSOC); foreach($result as $row) { $this->$first_name = $result['first_name']; } } public function get_property($property) { return $this->$property; } } ?> In inmate.php I also tried to change the line `$query = $db_connection->query($sql);` to `$query = global $db_connection->query($sql);` but I didn't have any luck here either. Any ideas?
  5. hello dear community, hung up of Libreoffice - i cannot start it in terminal. How to fix this issue!? dilbert ;-)
  6. hello dear php-community, today i have an special-question: the notebook samsung q 210 has got no brightness. in other words i cannot controll it. it is too dark see the data: Samsunng q 210, 12,1" OpenSuse 13.1: Intel® Core™ 2 Duo Proz. P8400 2,26 GHz 1066 MHz FSB 3 MB PC2-6400 (800 MHz), DDR2 SODIMM ; NVIDIA GeForce® 9200M GS any idea to change that?! love to hear from you greetings
  7. [Linux] PHP Notice: Undefined variable: connection in /var/www/html/popreport/functions.php on line 23 PHP Fatal error: Call to a member function query() on a non-object in /var/www/html/popreport/functions.php on line 23 The fuction output in the following program is called from another file called records records-board.php If you look at the program below you'll see that I did define $connection above line 23 in the file functions.php And for the second error I'm really not getting it because that same foreach loop was working fine with the exact same argument list when it was in the file records-board.php, but now that I've copied most of the code from records-board.php and placed it in functions.php all the sudden my program can't see the variable $connection and has a problem with my foreach loop on line 23. Again, both of those lines worked fine when they were in another file. functions.php <?php //session_start(); // open a DB connectiong $dbn = 'mysql:dbname=popcount;host='; $user = 'user'; $password = 'password'; try { $connection = new PDO($dbn, $user, $password); } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } $sql = "SELECT full_name, tdoc_number, race, facility FROM inmate_board WHERE type = 'COURT'"; function output() { foreach($connection->query($sql) as $row) { echo "<tr><td>$row[full_name]</td></tr>"; } } ?> records-board.php <? include 'functions.php'; php output(); ?> Any ideas?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.