[Solved] How to do a PHP curl post [closed]

// init curl $handle = curl_init(); // set options/parameters curl_setopt( $handle, CURLOPT_URL, ‘https://developer.lametric.c…’); curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, “POST”); curl_setopt( $handle, CURLOPT_POSTFIELDS, ‘the-json-encoded-data-here’ ); curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); // you want to get the response // set headers curl_setopt( $handle, CURLOPT_HTTPHEADER, array( ‘Accept: application/json’, ‘….’ ) ); // execute the request and get the response $response … Read more

[Solved] Script to resolve mathematical expressions step by step [closed]

In your link, check source. Near line 16 you can find <script type=”text/javascript” src=”http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full”></script>, this script is used to display mathematic formula. MathJax is a JavaScript library that allows page authors to include mathematics within their web pages. Near line 90 you can find <FORM action=”cgi-bin/minimath_cgi.exe” method=”GET” onsubmit=”submitCalculationF();”>. The submitCalculationF() function (near line 12 in … Read more

[Solved] Symfony 3, Guard & Handlers

The new Guard is aimed to ease the implementation of custom authentication patterns such as yours. It is likely to be enough for most of the case even complex ones. However, try to extract your custom processing, logging, etc. from your Guard and inject them to improve the maintainability of it. Take a close look … Read more

[Solved] Combine PHP array as something [duplicate]

If your first two arrays has the same length, you can use a loop to get the array you want: <?PHP $arr1= array(“A”,”B”,”C”); $arr2= array(“1″,”2″,”3″); $arr3=[]; for($i = 0; $i < count($arr1); $i++) array_push($arr3, $arr1[$i], $arr2[$i]); ?> It will return: $arr3= array(“A”,”1″,”B”,”2″,”C”,”3″); 1 solved Combine PHP array as something [duplicate]

[Solved] How can I secure my source code [closed]

As Royal Bg mentions in the comments, if they have the source code, there’s no way you can secure it against them making a separate copy. As you mention, any attempt at a licence key, or any other type of method, they’d be able to get around. solved How can I secure my source code … Read more

[Solved] what is better to represent news in html [closed]

Laying out websites with tables has been frowned upon for around 10 years. For tables, it’s fine, not but for layouts. I would markup some news articles like this: <article> <a href=”https://stackoverflow.com/link-to-article/” title=”article title”> <img src=”link-to-image” alt=”article title”> <h2>Article title</h2> <p>Short description</p> </a> </article> The rest of your question is pretty unclear so would need … Read more

[Solved] Why we should use the mysqli_real_escape_string() and the stripslashes() functions in a login and register php files

Using these functions makes your site less vulnerable to SQL injection attacks, where an attacker puts SQL syntax into a form field to compromise your site. mysqli_real_escape_string() “escapes” special characters so that MySQL interprets them as literal string characters rather than operators in the query. These functions only affect characters that are important to SQL … Read more

[Solved] syntax error unexpect something [closed]

Try this: <?php $i=0; foreach($model->authors as $key=>$author) { if(++$i<count($model->authors)) { echo ‘<a href=”http://192.168.171.46:9090/search/index?keyword=’.$author->name.'”>’.$author->name.’;</a>’; } else { echo ‘<a href=”http://192.168.171.46:9090/search/index?keyword=’.$author->name.'”>’.$author->name.’ </a>’; } } Or if you don’t mind a slight change use this because it is a little simpler: <?php $ret=””; foreach($model->authors as $key=>$author) $ret.=($ret?’; ‘:”).'<a href=”http://192.168.171.46:9090/search/index?keyword=’.$author->name.'”>’.$author->name.'</a>’; echo $ret; solved syntax error unexpect something [closed]

[Solved] Increase the speed of this code? Foreach

Might be slightly faster, I haven’t tested, but if [‘Data’][‘Show’] will be true or false then this is how I would do it: $pass = array_filter($var, function($v) { return $v[‘Data’][‘Show’]; }); If it could be other values that evaluate to false then: $pass = array_filter($var, function($v) { return $v[‘Data’][‘Show’] !== false; }); solved Increase the … Read more

[Solved] How to use mysql insted of mysqli in PHP

http://php.net/manual/en/intro.mysql.php The mysql_* functions have long been deprecated, and were finally removed in PHP 7. The mysqli_* functions are quite similar and it should be pretty easy to ‘upgrade’ a piece of code to use mysqli, even if you don’t use the extra features, like bind parameters. But for a course, even a small difference … Read more

[Solved] Is my SQL syntax really wrong? [closed]

Try adding white spaces between your query words and make sure you escape the input: $id = mysql_real_escape_string($id); $str = mysql_real_escape_string($str); $name = mysql_real_escape_string($name); $r=mysql_query(“INSERT INTO varta (id,data,name) VALUES (‘$id’,’$str’,’$name’);”); Or better yet – take a look at MySQLi or PDO and use prepared statements. solved Is my SQL syntax really wrong? [closed]

[Solved] Display Numbers and replace with letter [closed]

Instead of having a bunch of ifs, try making a map of numbers to letters. $map = array( 1 => ‘A’, 5 => ‘B’, 9 => ‘C’ ); for($i=1; $i <= 10; $i++){ // If the value is in the map, print the letter, // otherwise print the number echo array_key_exists($i, $map) ? $map[$i] : … Read more