2,113 Posted Topics
Re: 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) { … | |
Re: 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? | |
Re: 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 … | |
Re: 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. | |
Re: 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 | |
Re: 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 … | |
Re: 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* | |
Re: 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" … | |
Re: 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) … ![]() | |
Re: 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 = … | |
Re: 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 … | |
Re: 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 | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 | |
Re: 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. | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 | | | … ![]() | |
Re: 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 … | |
Re: 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 … | |
Re: 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 | |
Re: 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. | |
Re: 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', … ![]() | |
Re: **@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 ![]() | |
Re: 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* | |
Re: Try **Typeahead.js** by Twitter: * examples: http://twitter.github.io/typeahead.js/ * docs: https://github.com/twitter/typeahead.js | |
Re: 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` … | |
Re: 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 => … | |
Re: 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 … | |
Re: 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, … | |
Re: Yes, on line `13` remove the last quote, so change this: echo "Error#: " 60" to: echo "Error#: " 60 | |
Re: @Laura if you want to be helped then open a new thread, explain the problem and attach the relevant code. Bye! | |
Re: 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 … | |
Re: And you need it in C++(?) or in PHP? What have you done so far? ![]() | |
Re: 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* | |
Re: 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 … | |
Re: 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, … | |
Re: 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 | |
Re: 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/ | |
Re: 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"; | |
Re: 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 … ![]() | |
Re: 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... … | |
Re: 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 … | |
Re: 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. | |
Re: Start from the database schema, when you've realized all the connections between the tables you can write the scripts. | |
Re: 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 … |
The End.