[Solved] convert C to PHP [closed]

Here is a simple conversion. <?php define(‘LENGTH’, 3); function print_binary($n) { $bit = 1<<LENGTH – 1; while($bit) { echo $n & $bit ? 1 : 0; $bit >>= 1; } echo “\n”; } $n = 1<<LENGTH; for($i = 0; $i < $n; $i++) print_binary($i); ?> 3 solved convert C to PHP [closed]

[Solved] Decode or identify this code [closed]

It looks like you have to reverse the string and then decode as Base64: This part: NjcwODI4MjEjODE2NjY4NTcxMjI4ODcxMTE2NTcxMTgxMDk3OTY1NzYxMDQ1MzEw NjExNjk5MTE5NTYxMDM1Nzc1NTI3ODQ5ODgxMTYxMDI5OTExNDc1MTE2MTAwNTA1 NzUxMTAwODg1Mzk5NzU3OTg2 Translates to: 67082821#816668571228871116571181097965761045310611699119561035775527849881161029911475116100505751100885399757986 Since it returns all digits, except for one hash, it is highly probable that this is how it should be decoded. The last part has some problems, first because it does not have … Read more

[Solved] how to make multiple ajax calls from a same function? [closed]

var pages = [“page1.php”,”page2.php”,”folder/page3.php”] var requests = []; function multipleAjax(string) { /*where string is “?value=somevalue&bool=true” or something*/ for (i=0; i<pages.length;i++) { requests[i] = getXMLHttpRequest(); if (requests[i] != null) { requests[i].open(“Post”, “https://stackoverflow.com/” + pages[i] + string); requests[i].onreadystatechange = function () { if (requests[i].readyState == 4) { /*code to handle responseText returned*/ }; }; }; requests[i].send(); }; … Read more

[Solved] I can’t find my PHP issue [closed]

This could be a browser problem. It could be a code problem. It could be a server problem. Have you tried using something like Firebug to watch what happens when you yourself take the test? Have you also tried using Firebug Lite – Firebug plugins available for other browsers, which include some-but-not-all Firebug functionality? In … Read more

[Solved] Securely send form data instead of using post [closed]

This is not really a good question, but you still might look at the following links: http://php.net/manual/en/tutorial.forms.php http://www.php.net/manual/en/features.file-upload.post-method.php http://code.google.com/a/apache-extras.org/p/phpmailer/ 0 solved Securely send form data instead of using post [closed]

[Solved] Mysql real escape [closed]

The problem is that you aren’t using it… Make this change. <?php $address = mysql_real_escape_string($_POST[‘bitcoinaddress’]); $btc = mysql_real_escape_string($_POST[‘btcamount’]); $phone = mysql_real_escape_string($_POST[‘phonenumber’]); $con = mysql_connect(“localhost”,”db user”,”password”); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(“db_name”, $con); $sql=”INSERT INTO `db_name`.`form` (`bitcoinaddress`, `btcamount`, `phonenumber`) VALUES (‘”.$address.”‘,'”.$btc.”‘,'”.$phone.”‘)”; if (!mysql_query($sql,$con)) { die(‘Error: ‘ . mysql_error()); } echo ($btc); … Read more

[Solved] Get first day of current month in php [closed]

Here you go: $thisMonthsFirstDay = (new DateTime(‘first day of this month’))->format(‘l’); Also always take a look into the documentation, you can learn a lot from there. 0 solved Get first day of current month in php [closed]

[Solved] While Loop in php not working properly [closed]

Your loop isn’t printing anything to the page. It’s setting values to variables. And it’s over-writing those variable every time. So when the loop is done, only the last values are still set. Then you just echo that last value. Once. Instead, echo the output inside the loop so you can have one element of … Read more

[Solved] How to shuffle this in php

Something like this would work: $myalt = [‘first’ => ‘firsttitle’, ‘second’=> ‘second title’, ‘third’ => ‘third title’]; shuffle($myalt); foreach ($myalt as $title){ echo ‘<blockquote>title=”‘.$title.’ “</blockquote>’; } Mind you, you have to make sure your array is actually an array. EDIT: this is what you want: $myalt = [‘first’ => ‘firsttitle’, ‘second’=> ‘second title’, ‘third’ => … Read more

[Solved] opening file with php not working

You have not opened the file. str_getcsv() retrieves CSV data from a string, not from a file. Use fgetcsv() instead: $test=”tester.txt”; $handle = fopen($test, ‘r’); $bigarr = fgetcsv($handle); print_r($bigarr); 3 solved opening file with php not working

[Solved] Which Insert query run faster and accurate?

TL;TR The second query will be faster. Why? Read below… Basically, a query is executed in various steps: Connecting: Both versions of your code have to do this Sending query to server: Applies to both versions, only the second version sends only one query Parsing query: Same as above, both versions need the queries to … Read more