2,113 Posted Topics

Member Avatar for RikTelner

The second xml file is not correct, here's the fixed version: <?xml version="1.0" ?> <sys> <major> <id>1</id> <point>Tower</point> </major> <major> <id>2</id> <point>Castle</point> </major> </sys> Now, you basically get an object array, so: echo $file->major[0]->id . ' ' . $file->major[0]->point; And if you loop it: foreach($file as $key => $value) { …

Member Avatar for RikTelner
0
112
Member Avatar for rahim_1

It's seems a permission error. If the folder already exists make sure the **read-only** flag is unchecked. This bug seems related to your case: * http://bugs.mysql.com/bug.php?id=28397 Can you try a newer version?

Member Avatar for cereal
0
304
Member Avatar for Dani

Also, you could try with `insert ... select ... on duplicate key`, an example query: insert into table1 (user, score) values(1,2); insert into table2 (user, total_score) select user, score from table1 where id = last_insert_id() on duplicate key update total_score = total_score + score; The conditions are: * you cannot …

Member Avatar for Dani
0
384
Member Avatar for Kniggles

IF you're using Windows, the `mail()` function will not parse emails in format `Name <email@domain.tld>`. Second use double quotes: $email = "{$_REQUEST['email']},{$_REQUEST['email2']}"; Otherwise you have to escape the array keys quotes. Third: avoid using `$_REQUEST` and filter the input, currently this makes your script attackable.

Member Avatar for Kniggles
0
195
Member Avatar for Kniggles

You're using an array, so you have to surround it with parentheses, otherwise you have to escape the single quotes: mysqli_query($con,"UPDATE goodship SET brick=brick+1 WHERE id = {$_COOKIE['id']}"); In addition, use prepared statements, otherwise a user can push in arbitrary code: * http://www.php.net/manual/en/mysqli.prepare.php

Member Avatar for cereal
0
176
Member Avatar for RikTelner

I don't know if there is anything in PHP, but there is a tool written in Python: * http://pythonhosted.org/querycsv/ Otherwise you can check the SQLite library, it's used with sqlite files: * http://php.net/sqlite But files and sqlite are, generally, good to save little data, if your application will be used …

Member Avatar for cereal
0
282
Member Avatar for kgizo

Use `mysql_affected_rows()` instead of `mysql_num_rows($num_rows)`. Also use MySQLi or PDO libraries, since the MySQL library is going to be removed. *Docs: http://php.net/mysql_affected_rows*

Member Avatar for kgizo
0
266
Member Avatar for iwavetostars

It means you got this virus from a website you visited with Google Chrome, in this case the PHP script is embedded in a JPEG file, if you open it with an hex editor you will see the code. In this case just empty the cache, this kind of "virus" …

Member Avatar for cereal
0
148
Member Avatar for devianleong

You can loop 3 times: foreach($_POST['attr'] as $k1 => $v1) { foreach($v1 as $k2 => $v2) { foreach($v2 as $k3 => $v3) { echo $v3['name']; echo $v3['price']; } } } An alternative is to use an iterator: $arr = array(); $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($_POST['attr'])); foreach($iterator as $key => $value) …

Member Avatar for diafol
0
198
Member Avatar for askfriends

You can use `file_get_contents()` to get the link contents, and **curl** to upload the file and receive the response. Here's a rough example: <?php $fast = json_decode(file_get_contents('http://www.multiup.org/api/get-fastest-server')); if($fast->error !== 'success') die('Error!'); $url = file_get_contents('http://upload.wikimedia.org/wikipedia/commons/a/ac/SubtractiveColorMixing.png'); $tmpfile = tempnam("/tmp", "FOO"); $filearray = array('files[]'=>'@'.$tmpfile); $handle = fopen($tmpfile, "w"); fwrite($handle, $url); fclose($handle); $file = …

Member Avatar for askfriends
0
861
Member Avatar for abhijit_2

Use select: <select name="action"> <option>update</option> <option>delete</option> </select> Then: if($_POST['action'] == 'update') { # run update query } elseif($_POST['action'] == 'delete') { # run delete query } else { # return error: no allowed action was selected } If, instead, you want to update and delete within the same request then …

Member Avatar for abhijit_2
0
208
Member Avatar for hallianonline

Try with `$row[0]` and `$row[1]`, the fetch row method returns a numeric array, use `fetch_assoc()` if you want to use the column names: * http://www.php.net/manual/en/mysqli-result.fetch-assoc.php

Member Avatar for cereal
1
96
Member Avatar for vaultdweller123

So, in your pages you have: /images/image.png But you need to change everything to: /public/images/* And the same goes for css and js, correct? In this case you don't need **mod_rewrite** because this won't redirect the request to the correct path, you need `mod_alias`. There are different directives that you …

Member Avatar for cereal
0
350
Member Avatar for fheppell

Set the handler to `curl_init()` function, I did a test and by serving the file like this, the first part of the script worked fine: $url = "file://{$_SERVER['DOCUMENT_ROOT']}/{$filename}"; Now it depends on the contents of `$row['loc']`, if you're already including the full path, then just add `file://` or `http://` if …

Member Avatar for fheppell
0
2K
Member Avatar for mutago

I think, most of the times, it is better to save the files to directories or to an external CDN (Content Delivery Network) because it is static data and the request can be executed without involving the PHP engine and MySQL server. If you're not using a CDN service, you …

Member Avatar for cereal
0
249
Member Avatar for chrisschristou

Standing at their Help Center, PHPMyAdmin is already available from your control panel: * http://help.1and1.com/hosting-c37630/linux-c85098/mysql-database-c37730/access-phpmyadmin-a627818.html

Member Avatar for chrisschristou
0
455
Member Avatar for Dr_Freeman

I think this is what you're searching for: * https://developers.facebook.com/docs/public_feed/ But at this time it requires an approval by the FB team, it cannot be used by everyone.

Member Avatar for cereal
0
152
Member Avatar for ImZick

Not sure if this is what you're searching for: * http://dbperf.wordpress.com/2010/07/22/link-mysql-to-ms-sql-server2008/ According to the article, you run the query from MSSQL, but I don't have experience on this, I don't know if you can do the reverse action, i.e. query MSSQL from MySQL.

Member Avatar for urtrivedi
0
470
Member Avatar for azapovjednik

I would go reverse: a table for students, another for professors, a single language table and then a language_skills table for students and another for professors. For example: create table students( id int unsigned not null auto_increment primary key, fname varchar(100), ... ) create table student_language_skills( student_id int unsigned not …

Member Avatar for azapovjednik
0
418
Member Avatar for tony75

In both cases it means that the application does not filter the data received from the clients, and so an attacher can enter additional statements to the query, for example, you receive a GET request on this link: * http://localhost/article.php?id=17&action=delete and the script does not filter: $id = $_GET['id']; $query …

Member Avatar for tony75
0
711
Member Avatar for randhymuthola

I think one of the problems is given by: MID(tgl_periksa,6,2)='$dataBulan' Because $dataBulan is set like this: $dataBulan = isset($_POST['cmbBulan']) ? $_POST['cmbBulan'] : date('m'); And the select tag `cmbBulan` sets a number as value, not a string: echo "<option value='$bulanke' $cek>$bulannm</option>"; And so $dataBulan will always be a number, not a …

Member Avatar for cereal
0
141
Member Avatar for jacob21

Check the **information_schema.tables**: > explain information_schema.tables; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ | TABLE_CATALOG | varchar(512) | NO | | | | | TABLE_SCHEMA | varchar(64) | NO | | | | | TABLE_NAME | varchar(64) | NO | | | …

Member Avatar for diafol
0
2K
Member Avatar for aamna@daniewb

For the table use: default charset = utf8 collate utf8_general_ci then change the charset of the form sending the data: <form accept-charset="utf8" action="" method="post"> and it should work fine. If this is not enough then change the configuration of Apache by adding: AddDefaultCharset UTF-8 More information: http://httpd.apache.org/docs/2.2/mod/core.html#adddefaultcharset **EDIT** Wondering: the …

Member Avatar for cereal
0
132
Member Avatar for vipula

The search form should use the GET method, because it's a reading instance, the update form a POST method because it writes to the database. So you can do: # read if($_SERVER['REQUEST_METHOD'] == 'GET') { # execute search if(isset($_GET['search'])) { # code and populated form } else { # blank …

Member Avatar for vipula
0
228
Member Avatar for shivakr

Hi, I think you could serve PHP as CGI script, for more information check this link: * http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html

Member Avatar for cereal
0
80
Member Avatar for jacob21

Check AddThis: https://www.addthis.com/get/sharing Once selected the style, you include a javascript in your code and a div as container of the share buttons.

Member Avatar for cereal
0
91
Member Avatar for luckyuser

I see two problems here: 1. the function `session_start()` is missing and so the session cookie will not be created; 2. the `set_cookie()` for **city** is lacking of the domain attribute, so, if you want to make it available only for the current subdomain, it should be: set_cookie('city', 'value', 'ttl', …

Member Avatar for diafol
0
2K
Member Avatar for cancer10

**@Gurumoorthi** you can use the GeoIP library, check this thread for more information: * http://www.daniweb.com/web-development/php/threads/446658/redirect-user-from-their-ip

Member Avatar for diafol
0
2K
Member Avatar for Raadha

After: if(isset($_POST['submit'])) { Insert: $_POST = array_map('trim', $_POST); If, instead, you want to apply it only to one variable then write only this: $billno = trim($_POST['billno']); *Ref: http://www.php.net/trim*

Member Avatar for cereal
1
218
Member Avatar for jagdish1

Try **Typeahead.js** by Twitter: * examples: http://twitter.github.io/typeahead.js/ * docs: https://github.com/twitter/typeahead.js

Member Avatar for cereal
0
71
Member Avatar for Unixlearner

Hi, have you tried to enable the module? You can try with `a2enmod`: sudo a2enmod cgi If you remove the last argument then you get a list of the available modules. Then reload the server: sudo service apache2 reload Regarding the warning check with: apache2 -V or with `httpd -V` …

Member Avatar for Unixlearner
0
2K
Member Avatar for Stefce

You can create an array of prices, for example: $prices = array( 'sol' => 60, 'prasok' => 200, 'vegeta' => 100 ); And then, use a loop to check if the keys of this array matches with the $_GET/$_POST array: $sum = array(); $getkeys = array_keys($_GET); foreach($prices as $key => …

Member Avatar for Stefce
0
8K
Member Avatar for Giedrius_1

Hi, you can use `sprintf` for this task: echo sprintf($eng['profile_permission'], $group, $permission); However before doing this you need to change the variables in the array with the value types, in your case: $eng['profile_permission'] = 'You belong to %s with a permission of %s'; Where `%s` stands for string, here the …

Member Avatar for broj1
0
217
Member Avatar for Gaetane

You can use `insteadof` to declare the first trait, then go with `as`, example: trait TheErrorOfYourWays{ public function booboo(){ echo 'You had a booboo :('; } } trait SpectacularStuff1 { use TheErrorOfYourWays; } trait SpectacularStuff2 { use TheErrorOfYourWays; } trait SpectacularStuff3 { use TheErrorOfYourWays; } class DoSomethingSpectacular { use SpectacularStuff1, …

Member Avatar for Gaetane
2
2K
Member Avatar for theashman88

Yes, on line `13` remove the last quote, so change this: echo "Error#: " 60" to: echo "Error#: " 60

Member Avatar for theashman88
0
279
Member Avatar for puvi

@Laura if you want to be helped then open a new thread, explain the problem and attach the relevant code. Bye!

Member Avatar for Laura_5
0
4K
Member Avatar for mwenyenia07

Point the redirect to a controller not to a view. So change 'dashboard' to '/dashboard' or '/your_controller/dashboard'. You can also remove 'refresh' it will speed up the redirect. Add an ELSE statement: [code]if($result){ redirect('/dashboards'); } else { echo 'error'; }[/code] And remember to load the url helper before the redirect …

Member Avatar for vjadeja
0
3K
Member Avatar for Ayency
Member Avatar for diafol
0
107
Member Avatar for Priti_P

Hi, here you can find all the versions: * https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/ You can use multiple versions in the same box, just run the executable that you want to use. However you may want to setup different profiles for each Firefox instance. *Refer to: https://support.mozilla.org/it/questions/974208*

Member Avatar for sebastianedu
0
274
Member Avatar for mmcdonald

Place this `die(print_r($_POST));` before the `IF` statement and check what you get, you can do the same with `$_SESSION`. Otherwise just try to echo something before and after the conditional statement, if everything works fine, then it's something else. I don't think it's related to `$_POST` because the redirect seems …

Member Avatar for mmcdonald
0
284
Member Avatar for tomcromp

With some CSS you could place a link over that area. If the container has relative position, then you can use `position:absolute`, for example: a.logo { position:absolute; top:10px; left:10px; display:block; width:100px; height:100px; text-decoration:none; text-indent:-9999px; z-index:100; margin:0; padding:0; border:1px solid red; color:red; } <div id="header"> <a href="/" class="logo">Company Name</a> </div> then, …

Member Avatar for cereal
0
151
Member Avatar for Iikeloa

The attribute of the form is `enctype` not `encrypt`, that should help to get the correct data, then you have to refer to the `$_FILES` array, check the documentation: * http://www.php.net/manual/en/features.file-upload.post-method.php

Member Avatar for Iikeloa
0
227
Member Avatar for cmps

Yes, there are different caches, check the documentation for more information: * http://dev.mysql.com/doc/refman/5.5/en/query-cache.html * http://dev.mysql.com/doc/refman/5.5/en/query-cache-status-and-maintenance.html * http://dev.mysql.com/doc/refman/5.5/en/buffering-caching.html And there are some limitations, as the subqueries cannot be cached: * http://dev.mysql.com/doc/refman/5.5/en/query-cache-operation.html But if you use MariaDB, which is a fork of MySQL, you can cache even those queries: * https://mariadb.com/kb/en/subquery-cache/

Member Avatar for cereal
0
230
Member Avatar for Iikeloa

You missed a dot near $url: '".$url"' change it to: '".$url."' But you can rewrite it in a cleaner way: $sql = "UPDATE serv SET title = '$title', description = '$description', url = '$url' WHERE id = $id";

Member Avatar for Iikeloa
0
127
Member Avatar for rahia307

When you use `LAST_INSERT_ID()` you cannot select the table. Also the id must be an auto increment column, if for example you're using `uuid_short()` you will get an empty result. And the value is related to the session of the client, if the insert is done by client A, client …

Member Avatar for diafol
0
121
Member Avatar for divyakrishnan

Yes if this exe can be executed from command line and if the server platform is Windows, otherwise, if for example is Linux, you need to add Wine or VMWare to your server installation. In a Windows platform, you can also use COM to deal with programs like Outlook, Word... …

Member Avatar for hriti
0
146
Member Avatar for 4fridi

I'm not sure this is the best method and if can be useful, but I'm playing a bit with `RewriteMap`, once defined the map inside the vhost config file: RewriteMap id2album txt:/tmp/idmap.txt The contents of the file are: 123 jazz 301 summer And the rules are: <IfModule mod_rewrite.c> RewriteEngine On …

Member Avatar for cereal
0
198
Member Avatar for lewashby

Here you find the documentation: http://httpd.apache.org/docs/2.4/logs.html You shouldn't change permissions or the user/group that writes the logs, because from that user an attacker will be able to compromise the server. If you want to be able to read the logs then add the user to the `adm` group.

Member Avatar for lewashby
0
221
Member Avatar for Ann Krizette

Start from the database schema, when you've realized all the connections between the tables you can write the scripts.

Member Avatar for pritaeas
0
112
Member Avatar for davy_yg

I tried the tutorial, works fine for me. Regarding your code: <?php echo form_open('verifylogin'); ?> Should be: <?php echo form_open('admin/verifylogin'); ?> Then into `controllers/admin/verifylogin.php` you have to change the redirect from `home` to `/admin/home`, so at line `27`: redirect('/admin/home', 'refresh'); the same applies to the other controllers redirects as example …

Member Avatar for cereal
0
515

The End.