2,113 Posted Topics

Member Avatar for rsleventhal

Be aware with this solution: a client could overwrite any index of the `$_SESSION` array through the `$_POST` keys. For example, if you set the *user id* and the *status* in the session, like this: $_SESSION['user_id'] = 34; $_SESSION['is_logged'] = 1; then a user can submit a form to your …

Member Avatar for cereal
0
419
Member Avatar for jorwill.harion

If the are columns with the same name, for example `id`, when using the wildcard character the database will return error `1052`: * http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html#error_er_non_uniq_error Solution is to define each column: SELECT property.id, personal.id, spouse.id FROM property JOIN personal ON personal.id = property.id JOIN spouse ON spouse.id = property.id; As explained …

Member Avatar for jorwill.harion
0
318
Member Avatar for Ryujin

The problem here is that you are defining the array of options for curl without including the POST data: CURLOPT_POSTFIELDS => $curl_data, `$curl_data` is not defined anywhere, and you're including the input in the url so this becomes a post request with an empty body and the variables in the …

Member Avatar for cereal
0
981
Member Avatar for Prateek_2

Follow these instructions: http://dev.mysql.com/doc/refman/5.6/en/time-zone-support.html But you should always save as UTC and then convert the _datetime_ to the client local timezone.

Member Avatar for Prateek_2
0
2K
Member Avatar for tony75

Hi, what error do you get when you try the above commands? And have you tried to stop the service? For example: sudo service vsftpd stop sudo apt-get remove vsftpd

Member Avatar for matosha
0
2K
Member Avatar for stokie-rich

The problem is given by the closing bracket `}` of the very first `IF` statement: if(isset($_GET['question'])){ $question = preg_replace('/[^0-9]/', "", $_GET['question']); $next = $question + 1; $prev = $question - 1; } // <-- this is missing

Member Avatar for stokie-rich
0
3K
Member Avatar for virender_2

Have you tried open source solutions? Here's a list: * http://en.wikipedia.org/wiki/Comparison_of_Internet_forum_software

Member Avatar for cereal
0
89
Member Avatar for Sikander Nasar

On/off status for what? The website? Then you can use **artisan** from the command console: php artisan down The website will go in maintenance mode. With `up` it will go back online. If you wish something different then, please, explain it better.

Member Avatar for cereal
0
126
Member Avatar for connoisseur2010

It happens because you are defining these variables only when a POST request is submitted to the script, while on GET request (i.e. when you open the page) these variables are not defined. So, initizialize them on top of the script: <?php session_start(); $submitted = FALSE; $name = ''; $email …

Member Avatar for cereal
0
418
Member Avatar for Sockoiid

Follow this link http://windows.php.net/download/ You can choose the NTS (Non Thread Safe) version if IIS is serving PHP as fastcgi module, more information on http://php.iis.net/

Member Avatar for cereal
0
110
Member Avatar for davy_yg

This is defined by server configuration, if using Apache this can be declared also in the .htaccess context, for example: DirectoryIndex index.html index.php * http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex

Member Avatar for cereal
0
99
Member Avatar for logonchristy

**@Ine_1** Hello, in practice you have to escape the quotes of the html code. If you use double quotes then you can write: echo "<span class=\"smile\">hello</span>"; Notice how the class quotes are escaped by the backslash `\"`. This can be rewritten in many ways: echo "<span class='smile'>hello</span>"; echo '<span class="smile">hello</span>'; …

Member Avatar for gptArun
1
1K
Member Avatar for engrjd91

If you use prepared statements then it's not a problem, create the list of queries: <?php return array( "query_cities" => "SELECT * FROM cities WHERE name = ?", "query_address" => "SELECT * FROM addresses a JOIN cities c ON c.id = a.city_id WHERE street_name = ? AND zipcode = ?", …

Member Avatar for cereal
0
96
Member Avatar for Niall_2

There are few errors in the CSS, first at line `17` of the HTML page fix this: header h1 { font-size: 48px; } type="text/css"> By removing `type="text/css">`. Then inside the css file at line `79`: nav li:hover { background: blue; nav li:nth-child(even) a { color: red; } You are not …

Member Avatar for Niall_2
0
194
Member Avatar for blueguy777

I don't understand: you're talking about the data you want to save into the `custreg` table? If yes, where are the form, the insert query and the table definition?

Member Avatar for blueguy777
0
461
Member Avatar for davy_yg

Assign `height` and `width` to the **#banner-background**: #banner-background { width:100%; height:100px; background: url('/images/banner.jpg') no-repeat top left scroll; } Then, if you want, you can assign the background directly to the parent div of the inputs: <div id="banner-background"> <input type="text" class="form" name="email"> <input type="text" class="form" name="password"> </div>

Member Avatar for Albert Pinto
0
151
Member Avatar for soomro_moon

Maybe: $xor1 = gmp_init(md5('test'), 16); $xor2 = gmp_init(decbin(rand(0, 100)), 2); $xor3 = gmp_xor($xor1, $xor2); echo gmp_strval($xor3); ?

Member Avatar for cereal
0
555
Member Avatar for praba_web
Member Avatar for RikTelner

Yup, use the Geocoding API, you can use cURL or simply `file_get_contents()`, an example: <?php # geocoding $api = 'YOUR_SERVER_API_KEY'; $url = 'https://maps.googleapis.com/maps/api/geocode/'; $format = 'json'; $paramenters = array( 'address' => $_GET['address_line'], 'key' => $api ); $submit = $url . $format . '?' . http_build_query($paramenters); $response = json_decode(file_get_contents($submit), true); print_r($response); …

Member Avatar for cereal
0
439
Member Avatar for diafol

Hi! Define the namespace in **Spotify.php**: <?php namespace Foo\Bar\Baz; class Spotify { public function __construct() { echo "yes"; } } Then it should work fine.

Member Avatar for diafol
2
718
Member Avatar for zebnoon

The `real_escape_string` method is part of mysqli, so to use it append it to the database object: `$conn->real_escape_string($uname)`. But don't rely on this for security you have to validate the input, then sanitize and use prepared statements: $uname = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS); $pword = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_SPECIAL_CHARS); $query = $mysqli->prepare("SELECT …

Member Avatar for zebnoon
0
224
Member Avatar for kaye.santos.92

> Cannot find column [year] Does the column `year` exists it the queried tables? Have you tried to perform the same queries directly in a MySQL client?

Member Avatar for kaye.santos.92
0
370
Member Avatar for zebnoon

`login1` is the **database** name or the **table** name, or both? Instead of: if(!$conn){ echo "Connection not established"; } Do: if ($conn->connect_errno) { printf("Connect failed: %s\n", $conn->connect_error); exit(); } As suggested in the [documentation](http://php.net/manual/en/mysqli.connect-error.php). And return the error here.

Member Avatar for cereal
0
430
Member Avatar for michael.sullivan.1422

You could use the **DOMDocument** class: * http://php.net/manual/en/class.domdocument.php An example: <?php $file = "./test.html"; $imgs = glob('../images/*.jpg'); $dom = new DOMDocument(); $dom->loadHTMLFile($file); $container = $dom->getElementByID("container"); foreach($imgs as $img) { $basename = pathinfo($img, PATHINFO_BASENAME); $tag = $dom->createElement("img"); $tag->setAttribute('src', '/images/'.$basename); $container->appendChild($tag); $tag = null; } $dom->saveHTMLFile($file); By using the method `getElementByID()` you …

Member Avatar for cereal
0
273
Member Avatar for RonKevinT.Manuela

Can you post the exact error? Undefined index regarding which array: $_GET, $_POST, $row?

Member Avatar for diafol
0
750
Member Avatar for rjusman90

In order to perform multiple updates you have to submit the fields of the form as array groups, for example: <form action="" method="post"> <table> <thead> <tr> <th>ID</th> <th>Name</th> <th>Size</th> <th>Qty</th> <th>Price</th> </tr> <tbody> <tr> <!-- group 0 --> <td><input type="text" readonly name="product[0][id]" value="23" /></td> <td><input type="text" name="product[0][name]" /></td> <td><input type="text" …

Member Avatar for cereal
0
1K
Member Avatar for Dani

Hi Dani, this is used in Windows 8.1 with IE 11 to add tiles to the desktop: * [http://msdn.microsoft.com/en-us/library/ie/gg491731(v=vs.85).aspx](http://msdn.microsoft.com/en-us/library/ie/gg491731(v=vs.85).aspx)

Member Avatar for cereal
0
165
Member Avatar for peopletrendin
Re: php

From `require` documentation: > require is identical to include except upon failure it will also produce a fatal E_COMPILE_ERROR level error. In other words, it will halt the script whereas include only emits a warning (E_WARNING) which allows the script to continue. Links: * http://php.net/manual/en/function.require.php * http://php.net/manual/en/function.include.php Please, next time …

Member Avatar for peopletrendin
-1
183
Member Avatar for Michael_29

Try also: <?php $input = "ls -lh"; $command = escapeshellcmd($input); $command .= '^M'; shell_exec("screen -X stuff '$command'"); If the "stuff" screen is attached you should see the execution of the command. But keep in mind this is really unsafe action, depending on configuration it can run with webserver privileges. It …

Member Avatar for cereal
0
731
Member Avatar for nadiam

With `.reload()`, when possible, you can try to force the reload from the browser cache: > Reloads the resource from the current URL. Its optional unique parameter is a Boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or …

Member Avatar for minitauros
0
167
Member Avatar for Nurul_2

Add one of the table aliases to the column, so: WHERE br.patron_ID = '$patron_ID'"; The error happens because your using two tables with the same column name.

Member Avatar for cereal
0
134
Member Avatar for vizz

**@vizz** hi, you should pay the license and respect their copyright: http://www.menucool.com/ otherwise switch to the free version.

Member Avatar for vizz
0
282
Member Avatar for kasr12

Are you appending the query string to the form used to submit the new query? Can you show how you apply the pagination class in your **results** script?

Member Avatar for cereal
0
196
Member Avatar for subramaniyam.k

As suggested by the error message: check the error log for Apache. If you have doubts paste or attach a file with the contents here.

Member Avatar for cereal
0
38
Member Avatar for berserk

You could also try with Composer: create a private repository and use a php/batch script to run the install or update process for your application, the only requirement for the clients it to have the composer binary installed. Read: https://getcomposer.org/doc/05-repositories.md#hosting-your-own The same can be done with PEAR, but some of …

Member Avatar for berserk
0
348
Member Avatar for Beggersewen

> PHP-Nuke 8.3.2 fix some security issues and become compatible with PHP 5.3. By the way, this is not even completely true, most of their filters are based on the **ereg** functions, which are deprecated since 5.3 and vulnerable to the **null byte** attack. For example check their validate mail …

Member Avatar for veedeoo
0
564
Member Avatar for lloyd.farrell.7

Try with `preg_match()`: function validateScore($score) { $score = trim($score); $pattern = '/^\d{1,2}[\s]?-[\s]?\d{1,2}$/'; return preg_match($pattern, $score) == 1 ? true : false; } Valid inputs are: var_dump(validateScore('2-0')); var_dump(validateScore('2- 0')); var_dump(validateScore('2 -0')); var_dump(validateScore('2 - 0')); Spaces around the string are removed by `trim()`. To validate only those without spaces between the dash …

Member Avatar for lloyd.farrell.7
0
327
Member Avatar for massivefermion

Check the default index for XSP2, inside `/usr/share/asp.net-demos/` there is an `index.aspx` and two directories `1.1` and `2.0`. So, as test, you can try to call them directly: * `http://127.0.0.1:8080/index.aspx` * `http://127.0.0.1:8080/2.0/index.aspx`

Member Avatar for massivefermion
0
423
Member Avatar for abdallahbijle2

You can use PHP SDK from Facebook, check here: * https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed * https://developers.facebook.com/docs/reference/php/4.0.0

Member Avatar for gabrielcastillo
0
104
Member Avatar for Santanu.Das

You can use **mysqldump**: mysqldump -uUSER -pPASSWORD DATABASE > backup.sql Change `USER`, `PASSWORD` and `DATABASE` to match yours, you can add `--routines` to backup user defined functions and procedures. More information here: * http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

Member Avatar for cereal
0
121
Member Avatar for Keyra Lee

Add the brackets to extend the statement, otherwise the `IF` condition will apply only to `$IC2= $_SESSION['IC2'];` because it finds the `;` character, so: if ( isset($_POST['BMK81A']) && isset($_POST['BMK81']) && isset($_POST['DL3']) && isset($_POST['DL2']) && isset($_POST['DL1']) && isset($_POST['S1']) && isset($_POST['S2']) && isset($_POST['S3']) && isset($_POST['S4']) && isset($_POST['S5']) && isset($_POST['S6']) && isset($_POST['S7']) && …

Member Avatar for gabrielcastillo
0
2K
Member Avatar for mangel.murti
Re: Gmap

Check this link: - https://developers.google.com/maps/articles/phpsqlsearch_v3#findnearsql In practice you have to save the current position for each user and calculate the distance through a database query. **Note** MySQL supports spatial indexes only with MyISAM and InnoDB engines, the latter since `5.7.5`. But you may want to consider [PostGIS](http://postgis.net/) also.

Member Avatar for mangel.murti
0
136
Member Avatar for divyakrishnan

You have to set the validation rule in the `submitform()` method: $this->load->library('form_validation'); $this->form_validation->set_rules('frmDt', 'Date', 'callback__checkdate'); Then you have to add an argument to the `_checkdate()` method because `set_rules()` will submit the value of the field specified in his first argument: function _checkdate($date) { $format = 'Y-m-d H:i:s'; # Must match …

Member Avatar for cereal
0
156
Member Avatar for muhamadtaufiq.zaki

You have to initialize the variables: if `$submit` is not set then `$sql` is not initialized and the query will fail. Also for the query you can use the `column BETWEEN value AND value` condition. So change your code to: $submit = $_POST['submit']; # all code under this condition if($submit) …

Member Avatar for muhamadtaufiq.zaki
0
2K
Member Avatar for ankit1122

Can you show the table schema and an example of the query you want to perform? Have you tried the `column BETWEEN min AND max` statement? Are you saving the timezone differences for each user? Documentation: * http://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#operator_between

Member Avatar for cereal
0
130
Member Avatar for giovannelapay

It happens because the url opening the page does not set the **id** parameter: yourpage.php?id=123 To prevent this error you can add a check. `array_key_exists` will not consider if id is empty or not `?id=` vs `?id=21`, but only if the key exists: if( ! array_key_exists('id', $_GET)) { die('Error: missing …

Member Avatar for cereal
0
463
Member Avatar for Santanu Das

It happens because this is the data directory used by the server. If you want to change it then modify the `datadir` value in the **my.cnf** file, and then restart MySQL. **Note apart** I don't know how it works with Windows permissions, but in linux the new data directory **must** …

Member Avatar for Santanu Das
0
296
Member Avatar for markii.borabon_1

Chech the version of the remote PHP. DateTime::diff requires version 5.3.*+ * http://php.net/manual/en/datetime.diff.php

Member Avatar for kaleemullah360
0
446
Member Avatar for shammi.khan.73

You can use `DateTime::sub()`: <?php $dt = new DateTime('2014-08-31 23:06:00'); $dt->sub(new DateInterval('P30D')); echo $dt->format('Y-m-d G:i:s'); Docs: * http://php.net/manual/en/datetime.sub.php * http://php.net/manual/en/dateinterval.construct.php * http://en.wikipedia.org/wiki/ISO_8601#Durations

Member Avatar for kaleemullah360
1
4K
Member Avatar for shammi.khan.73

It happens because MySQL doesn't seem to really support ISO 8601, but the date is parsed and inserted if the server is not in strict mode, it will generate only a warning that looks like this: show warnings\G *************************** 1. row *************************** Level: Warning Code: 1292 Message: Truncated incorrect datetime …

Member Avatar for cereal
1
1K

The End.