2,113 Posted Topics
Re: Hi, I haven't tested this but I think you could use `mod_actions` with `X-Frame-Options SAMEORIGIN`, this header is used to define if an external website can include your pages through an iframe. It has three statements: * `SAMEORIGIN` * `DENY` * `ALLOW-FROM http://url.tld/` The third option would be perfect for … | |
Re: **@chandrama** At the moment you are not [escaping](http://php.net/manual/en/language.types.string.php) the third backslash in the sequence: `\\server\printer`. So, if the dll is correctly loaded as the pecl package, try: $handle = printer_open("\\\\server\\Brother MFC-J430W Printer"); Or with single quotes: $handle = printer_open('\\server\Brother MFC-J430W Printer'); Else, I'm not sure Microsoft Windows supports the IPP … | |
Re: Hi, have you considered `preg_replace()`? Basic example: <?php $s = 'google googler'; echo preg_replace('/\bgoogle\b/i', 'go*gle', $s); # outputs: go*gle googler With arrays it gets tricky because you have to write the pattern for each word to filter, but you can use an anonymous function to fix it, for example: <?php … | |
Re: Hi, when the query fails MySQLi will return FALSE, so add [mysqli_error()](http://php.net/manual/en/mysqli.error.php) to get some information about it. I think there is an ambiguous column error, which means the two tables have at least a column with the same name, for example `postdate`. | |
Re: Hi, did you considered the `fping` command? With the `-g` option you can define a range: fping -c 1 -g 192.168.129.1 192.168.129.20 fping -c 1 -g 192.168.129.0/24 And to get just the active IPs do: fping -c 1 -g 192.168.129.1 192.168.129.20 2> /dev/null | |
Re: > btw can they use in php ? Yes, if you set the `asp_tags` directive to TRUE, but this will be removed from PHP version 7.*, so it's better to not use it. More information here: * http://php.net/manual/en/ini.core.php#ini.asp-tags * http://php.net/manual/en/language.basic-syntax.phptags.php | |
Re: You could use `xpath()` to match only the selected questions: $xpath = $xml->xpath('//main[@select="selected"]'); So you can remove the IF statement: if($main['select'] == "selected") Then count to get the total and create a simple pagination system: $count = count($xpath); $page = isset($_GET['page']) && $_GET['page'] > 0 ? $_GET['page'] : 1; $numbr … | |
Re: Hi, you could [count](http://php.net/manual/en/simplexmlelement.count.php) the nodes, create a [range](http://php.net/range) array and then [shuffle](http://php.net/manual/en/function.shuffle.php) the range, finally you return the node, for example: <?php $xml = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <main> <articles> <article> <title>Title 001</title> <content>Content 001</content> </article> <article> <title>Title 002</title> <content>Content 002</content> </article> <article> <title>Title 003</title> <content>Content 003</content> </article> </articles> … | |
Re: Hi, you could use the **get_json.php** end point to get the data array. For example: $u = 'http://api.hostip.info/get_json.php'; $r = json_decode(file_get_contents($u)); echo $r->country_name; | |
Re: Same for me, I just received a notification sent 4 days ago. | |
Re: Hi, are you using MySQL on Windows? Is this a new installation? Which version? Could you paste the specific message and code error? | |
Re: Hi, there are two possible reasons: 1. the url helper is not loaded 2. missing trailing slash in *application/config/config.php* `$config['base_url']`: $config['base_url'] = 'http://domain.tld'; # <- missing final / | |
Re: Try if it works fine from the mysql client, because it returns this error to me: ERROR 1414 (42000): OUT or INOUT argument 2 for routine dbase.test_proc is not a variable or NEW pseudo-variable in BEFORE trigger You can try to bypass the error by setting a variable before calling … | |
Re: Hi, remove the `WHERE` condition and add `GROUP BY student_code` to the **select** statement and it should work fine, but consider that you could use a view, otherwise when you add something else to the `results` table you have to check and update the `totals` table. Examples: INSERT INTO `results`(`student_code`, … | |
Re: There are two problems here: $query = $query1." ".UNION." ".$query2; $resultID = mysql_query($query); First: UNION will be evaluated by PHP as a constant, not as a string part of a query, the correct syntax would be: $query = "$query1 UNION $query2"; Second: the last query will connect to the last … | |
Re: Hi, I would like to help, if you can, send me the link. | |
Re: It could be the link, the above would work only in the intranet. To connect to an external remote server, you must point the server to use the public IP. Anyway to get some extra information add: curl_setopt($curl_handle, CURLOPT_VERBOSE, true); That will print the requests and responses of both sides. | |
Re: Hi all! **@phoenix** I suppose you have a form with an input field like this: <input type="text" name="ITEM" id="ITEM"> From which you set the `$ITEM` variable, so try to send something different from the expected value, you expect an integer. Send this instead: 1 OR 1=1 It will probably return … | |
Re: The `date_diff()` function requires two arguments, also both must be resources of the *DateTimeInterface*, if you pass a string, as in your example, the function will fail. So, you must write: <?php $date_a = '2015-04-01'; $date_b = '2015-03-25'; $dt_a = new Datetime($date_a); $dt_b = new Datetime($date_b); $interval = date_diff($dt_a, $dt_b); … | |
Re: Hi, have you tried the solution offered in their forum? Here's the link: * http://forum.uniformserver.com/index.php?showtopic=2961&hl=%2Bcrash+%2Bevent | |
Re: Hi, read this: https://www.daniweb.com/community/syntax#quotes The syntax help is accessible by clicking on the `?` icon in the text editor. | |
Re: > Erorare reference : This email was looking for a about is sent without authentication It means that the SMTP server used to send the email requires the authentication for the email defined here: $emailFrom ="contact@yoursite.com"; i.e. it requires the password. With `mail()` you can do this only by editing … | |
Re: @Sophia hi, could you show us the **form** used to submit the POST values to your script? | |
Re: Ok, here there are two errors on this line: `newmessage`int(4) unsigned NOT NULL DEFAULT `0`, The space between the column name and the type is missing, and the default value is defined with backticks instead of quotes, so: `newmessage` int(4) unsigned NOT NULL DEFAULT '0', But there is also another … | |
Re: Hi! If using Ubuntu then open the terminal and type: locate java.desktop It should find few entries under `/usr/share/app-install/desktop/`, these are the files used to generate the desktop entries. If you don't get results try to update the mlocate database through the command **updatedb**. If you get some results the … | |
Re: Try to change the header to: curl_setopt($curl, CURLOPT_HTTPHEADER, array( "Authorization: Token token=$token" )); Then it should work fine. To debug the request add: curl_setopt($curl, CURLINFO_HEADER_OUT, true); And: $info = curl_getinfo($curl, CURLINFO_HEADER_OUT); Which prints: GET /api/v1/items/8568ccd0-c614-012f-1d74-58d385a7bc34.json HTTP/1.1 Host: api.repo.nypl.org Accept: */* Authorization: Token token=YOUR_TOKEN | |
Re: Hi, in this case you can use `header()`, you could setup actions.php like an hub and define specific redirect links: switch($_GET['action']): { case 'send': # run insert query $redirectTo = "http://website.tld/pageY.php"; break; case 'update': # run code here $redirectTo = "http://website.tld/pageX.php"; break; default: $redirectTo = "http://website.tld/pageA.php"; } header("Location: $redirectTo"); Also … | |
Re: Hi, check the data models in the Education section at: * http://www.databaseanswers.org/data_models/ If it does not help, write about your project, try to define the basic information you would need to create such application. This should help you to shed some light and then you can ask more specific help, … | |
Re: Hi, open the Developer Tools console in Google Chrome, then click on the smartphone icon, it allows to test some device resolutions, here's a screenshot: http://i.imgur.com/cs3ZeA7.png | |
Re: Hi, you're defining the variables after the binding, this will lead to an error, try: $nm = $_POST['nm']; $nm = $_POST['ln']; $gd = $_POST['gd']; $tl = $_POST['tl']; $ar = $_POST['ar']; $stmt->bind_param('ssss', $nm, $ln, $gd, $tl, $ar); | |
Re: In addition, if you're using Laravel, then you can use the `asset()` helper: $link = asset("/images/Work_Anniversary.png"); This will prepend the application url. | |
Re: In addition, you could use `mysqli_fetch_all()` to retrieve all the rows: $result = mysqli_fetch_all($query, MYSQLI_ASSOC); foreach($result as $key => $row) { echo $row['title'].'<br>'; } But it requires Mysqlnd (the native driver): * http://php.net/manual/en/mysqli-result.fetch-all.php * http://php.net/manual/en/book.mysqlnd.php | |
Re: Hi, I haven't tested this but try to set the subquery in the `select()` method: $this->db->distinct(); # select $this->db->select("*, (SELECT GROUP_CONCAT(cd1.name ORDER BY level SEPARATOR ' > ') FROM " . $this->db->dbprefix . "category_path cp LEFT JOIN " . $this->db->dbprefix . " category_description cd1 ON (cp.path_id = cd1.category_id AND cp.category_id != cp.path_id) … | |
Re: It happens because `$connect` is defined out of the scope of the function, to fix it do: <?php include 'config.php'; function findProducts($connect) { $query = mysqli_query($connect, "SELECT * FROM cart"); while($row = mysqli_fetch_assoc($query)){ echo $row['title'].'<br>'; } } echo findProducts($connect) | |
Re: In these cases you should hear some beeps from the motherboard, the sequence can help you to understand the issue, in the documentation you should find the meaning of each sequence. Anyway, make sure everything is well connected to the motherboard, including jumpers and connectors. If it does not solve … | |
Re: Hi, can you show the query? | |
Re: Once you get through the IF statement the new value, for the **$level** variable, will be valid for the remaining code: $level = 0; echo $level; # outputs: 0 # for the example, random choice $a = rand(1, 2); if($a == 1) $level = 1; else $level = 2; echo … | |
Re: Hi, this is an intended behaviour of the browser, a website cannot define the file to upload from a client system, otherwise it could be used to steal anything. In any case, the browser works in a sandbox, so you cannot access directly to local resources. | |
Hi all! I don't know if this occurs only to me but in the forum list view the **read** text icon wraps to a new line, like this:  Here's a larger screenshot: http://i.imgur.com/k9w09hn.jpg I noticed this few days ago. I don't have extensions on. I tested the zoom, but … | |
Re: Hi, it is possible, read these articles: * https://developers.google.com/maps/articles/phpsqlajax_v3 * https://developers.google.com/maps/articles/phpsqlsearch_v3 but your question is a bit vague. If you offer more details, maybe we can suggest you better. Bye! | |
Re: Hi! That's the format supported by the database, save it like this, then when your get the result set format as you prefer. You can do it directly at query level with the `format_date()` function: * https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format or in PHP with the `IntlDateFormatter` class: * http://php.net/manual/en/intldateformatter.format.php For this task I … | |
Re: The function `mysql_result()` returns one of the rows of the result set, so if you get a total of 10 rows, you can decide to get one of those: $query = mysql_query('SELECT * FROM tablename'); $row = mysql_result($query, 2); the count starts from `0`. To get a single row, instead, … | |
Re: Hi, if I'm not wrong, this script is creating database tables and procedures, I suppose for MS SQL, so all you need is to convert them to queries that you would run in a database client. For example with the PDO API you can do: try { # connect to … | |
Re: Hi, just a note: the `mcrypt_ecb()` function is deprecated since PHP 5.5, it means this is going to be removed. You should use `mcrypt_generic()`and `mdecrypt_generic()` as explained in the documentation: * http://php.net/manual/en/function.mcrypt-ecb.php * http://php.net/manual/en/migration55.deprecated.php For some information about the encryption modes check those available: * http://php.net/manual/en/mcrypt.constants.php I would use CBC … | |
Re: Hi, add a space after `LIMIT`, at the moment when executed it will print `LIMIT20, 3` instead of `LIMIT 20, 3`. But validate and sanitize the number. For example: $number = trim($_POST['number']); $number = filter_var($number, FILTER_VALIDATE_INT, $options); $sql = "SELECT ID, Title, Author, Content FROM Posts LIMIT $number, 3"; Otherwise … | |
Re: Use `base64_decode()`: http://php.net/manual/en/function.base64-decode.php For example, this: eval($OOO0000O0('JE8wMDBPME8wMD0kT09...hbCgkT08wME8wME8wKTs=')); equals to: eval($OOO0000O0( $O000O0O00 = $OOO000O00($OOO0O0O00,'rb'); $O0O00OO00($O000O0O00,0x4fa); $OO00O00O0 = $OOO0000O0($OOO00000O($O0O00OO00($O000O0O00, 0x368), '3C4hHR7yEoKBnvWimqfuSGt56bd2DkYzMjL+rVNZslFxgUIpX9aPT/cOewQJ081A=', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/')); eval($OO00O00O0); )); The string `3C4hHR7yEoKBnvWimqfuSGt56bd2DkYzMjL+rVNZslFxgUIpX9aPT/cOewQJ081A=` converts into binary data, it could be part of an image, music file or something else... the other string: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ is probably the key to … | |
Re: A problem is this: $sql ="UPDATE login SET firstname = '$newfirstname' WHERE ID=$dbid" or die ("cant update " . mysqli_error($con)); Do only: $sql = "UPDATE login SET firstname = '$newfirstname' WHERE ID=$dbid"; Otherwise `mysqli_query()` will return false. | |
Re: Hi, why don't you contact the developer? You can find his name and email address in the first bits of each file. | |
Re: It returns boolean (`FALSE` in this case) because the query will generate an error, due to a quote placed in the wrong place `s.type='c)'`, so change this: $sql = "SELECT s.*, u.avatar FROM status AS s LEFT JOIN users AS u ON u.username = s.author WHERE (s.account_name = '$u' AND … | |
Re: Hi all, @slowlearner2010 just for the log, it seems you don't need the `array_push()` neither the loop, use `trim()` to remove extra spaces and then use `implode()`, then you should be done: $a = array_map('trim', $_POST['a']); $b = implode(',', $a); At least, looking at your example, this seems to work … |
The End.