Previously in PHP 5.4 I have create a payment redirection module. The bank ask me for security reasons to calculate the value $digest. Here is the code:
$form_data = "";
$form_data_array = array();
$form_data_array[1] = $merchantID;
$form_data_array[2] = $lang_fixed;
$form_data_array[3] = $orderId;
$form_data_array[4] = $order_descr_fixed;
$form_data_array[5] = $price_fixed;
$form_data_array[6] = $crncy;
$form_data_array[7] = $customerEmail;
$form_data_array[8] = $trans_type;
$form_data_array[9] = $form_confirmUrl;
$form_data_array[10] = $form_cancelUrl;
$form_data_array[11] = $sharedSecretKey;
$form_data = implode("", $form_data_array);
$digest = base64_encode(sha1($form_data,true));
This working fine with PHP 5.4. But when I choose PHP 5.6 the $digest is not calculated.
Related
I'm trying to make an ethereum raw transaction by php and these libraries:
https://github.com/simplito/elliptic-php
https://github.com/kornrunner/php-keccak
https://github.com/web3p/rlp
this is my code:
use Elliptic\EC;
use kornrunner\Keccak;
use Web3p\RLP\RLP;
$privateKeyHex = '.....'; // wallet private key
$toWallet = '118086be6247fBDa3BC64B4A11F07F3894aA1fAF';
$ec = new EC('secp256k1');
$key = $ec->keyFromPrivate($privateKeyHex );
$publicKeyHex = $key->getPublic('hex');
// $publicKeyHex => 0445e2caf0f227247dfa10440765812492e4d4c9df7b4e74d0d5cd3279fa80f5ef987a70e061ca20c06f09690957c9ba365cf06541181d1291e14c847d0d826583
$nonce= 0;
$gasPrice = 1e9;
$gasLimit = 21000;
$to = hex2bin($toWallet);
$value = 1e14-($gasLimit*$gasPrice)-1;
$inputData = 0;
//*********** EIP_155 *********
$chain_id = 1;
$r = 0;
$s = 0;
//*****************************
$SignData = [$nonce,$gasPrice,$gasLimit,$to,$value,$inputData,$chain_id,$r,$s];
$SignRlpData = rlpEncode($SignData);
$signHash = Keccak::hash(hex2bin($SignRlpData), 256);
$signature = $ec->sign($signHash ,$key);
$r = $signature->r->toString('hex');
$s = $signature->s->toString('hex');
$v = $chain_id*2 + ($signature->recoveryParam +35);
$trxData = [$nonce,$gasPrice,$gasLimit,$to,$value,$inputData,$v,hex2bin($r),hex2bin($s)];
$trxRlpData = rlpEncode($trxData );
// trxRlpData => f86980843b9aca0082520894118086be6247fbda3bc64b4a11f07f3894aa1faf8647d99eefefff8026a08a53214c92ff615c82eede2e51ab9d4d22d6a393f3ab8acee63c23d04e8e2fa7a07661f758f8b968d7597449ce05027edf3f2891fef0d1278f7330e99545109a2b
function rlpEncode($a){
$rlp = new RLP;
$encodedBuffer = $rlp->encode($a);
return $encodedBuffer->toString('hex');
}
now after I send value of $trxRlpData to the ethereum network by https://etherscan.io/pushTx, show me this error message:
Error! Unable to broadcast Tx : {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"transaction underpriced"}}
but where is problem ?
finally I solved this problem with increasing a little $gasLimit.
$gasLimit = 21001;
When there is a pending transaction and you try to send a new one with same nonce you see this error.
If you needs to make a new transaction while the old one has not confirmed yet, you must get pending transactions count getTransactionCount of address and use as nonce
This script have very long loading times.
If i refresh my page it takes 3.5 seconds to load up this script.
What can causes this?
<?php
//Instagram Getter
// use this instagram access token generator http://instagram.pixelunion.net/
$access_token="";
$photo_count=9;
$json_instalink="https://api.instagram.com/v1/users/self/media/recent/?access_token=$access_token&count=$photo_count";
$jsoninsta = file_get_contents($json_instalink);
$objinsta = json_decode($jsoninsta);
//Link zu den Bildern
$imagelink1 = $objinsta->data[0]->link;
$imagelink2 = $objinsta->data[1]->link;
$imagelink3 = $objinsta->data[2]->link;
$imagelink4 = $objinsta->data[3]->link;
$imagelink5 = $objinsta->data[4]->link;
$imagelink6 = $objinsta->data[5]->link;
$imagelink7 = $objinsta->data[6]->link;
$imagelink8 = $objinsta->data[7]->link;
$imagelink9 = $objinsta->data[8]->link;
//Das Bild an sich
$profilelink1 = $objinsta->data[0]->images->standard_resolution->url;
$profilelink2 = $objinsta->data[1]->images->standard_resolution->url;
$profilelink3 = $objinsta->data[2]->images->standard_resolution->url;
$profilelink4 = $objinsta->data[3]->images->standard_resolution->url;
$profilelink5 = $objinsta->data[4]->images->standard_resolution->url;
$profilelink6 = $objinsta->data[5]->images->standard_resolution->url;
$profilelink7 = $objinsta->data[6]->images->standard_resolution->url;
$profilelink8 = $objinsta->data[7]->images->standard_resolution->url;
$profilelink9 = $objinsta->data[8]->images->standard_resolution->url;
//Channel and API Key
$channel_id = '';
$api_key = '';
//Channel Statistics
$json_statsurl="https://www.googleapis.com/youtube/v3/channels?part=statistics&id=$channel_id&key=$api_key";
$jsonstats = file_get_contents($json_statsurl);
$listFromYouTube=json_decode($jsonstats);
$subscriberCount = $listFromYouTube->items[0]->statistics->subscriberCount;
//Last Video
$json_lastvidurl="https://www.googleapis.com/youtube/v3/search?key=$api_key&channelId=$channel_id&part=id&order=date&maxResults=1";
$jsonlastvid = file_get_contents($json_lastvidurl);
$listFromYouTube=json_decode($jsonlastvid);
$lastvidid = $listFromYouTube->items[0]->id->videoId;
//Last Video Views
$json_lastvidstatsurl="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$lastvidid&key=$api_key";
$jsonlastvidstats = file_get_contents($json_lastvidstatsurl);
$listFromYouTube=json_decode($jsonlastvidstats);
$lastvidviews = $listFromYouTube->items[0]->statistics->viewCount;
//Last Video Published Date
$json_lastvidinfourl="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$lastvidid&key=$api_key";
$jsonlastvidinfo = file_get_contents($json_lastvidinfourl);
$listFromYouTube=json_decode($jsonlastvidinfo);
$lastvidtitle = $listFromYouTube->items[0]->snippet->title;
$lastvidpublished = $listFromYouTube->items[0]->snippet->publishedAt;
//Playlist Videos 9
$json_9vidurl="https://www.googleapis.com/youtube/v3/search?key=$api_key&channelId=$channel_id&part=snippet,id&order=date&maxResults=10";
$json9vid = file_get_contents($json_9vidurl);
$listFromYouTube=json_decode($json9vid);
$vid0=$listFromYouTube->items[1]->id->videoId;
$vid1=$listFromYouTube->items[2]->id->videoId;
$vid2=$listFromYouTube->items[3]->id->videoId;
$vid3=$listFromYouTube->items[4]->id->videoId;
$vid4=$listFromYouTube->items[5]->id->videoId;
$vid5=$listFromYouTube->items[6]->id->videoId;
$vid6=$listFromYouTube->items[7]->id->videoId;
$vid7=$listFromYouTube->items[8]->id->videoId;
$vid8=$listFromYouTube->items[9]->id->videoId;
$watchlink="http://undercover-gaming.de/youtube/video/";
// TITLE PART
$vid0t=$listFromYouTube->items[1]->snippet->title;
$vid1t=$listFromYouTube->items[2]->snippet->title;
$vid2t=$listFromYouTube->items[3]->snippet->title;
$vid3t=$listFromYouTube->items[4]->snippet->title;
$vid4t=$listFromYouTube->items[5]->snippet->title;
$vid5t=$listFromYouTube->items[6]->snippet->title;
$vid6t=$listFromYouTube->items[7]->snippet->title;
$vid7t=$listFromYouTube->items[8]->snippet->title;
$vid8t=$listFromYouTube->items[9]->snippet->title;
// PUBLISH PART
$json_vid0url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid0&key=$api_key";
$jsonlastvid0 = file_get_contents($json_vid0url);
$listFromYouTube=json_decode($jsonlastvid0);
$vid0published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid1url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid1&key=$api_key";
$jsonlastvid1 = file_get_contents($json_vid1url);
$listFromYouTube=json_decode($jsonlastvid1);
$vid1published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid2url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid2&key=$api_key";
$jsonlastvid2 = file_get_contents($json_vid2url);
$listFromYouTube=json_decode($jsonlastvid2);
$vid2published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid3url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid3&key=$api_key";
$jsonlastvid3 = file_get_contents($json_vid3url);
$listFromYouTube=json_decode($jsonlastvid3);
$vid3published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid4url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid4&key=$api_key";
$jsonlastvid4 = file_get_contents($json_vid4url);
$listFromYouTube=json_decode($jsonlastvid4);
$vid4published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid5url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid5&key=$api_key";
$jsonlastvid5 = file_get_contents($json_vid5url);
$listFromYouTube=json_decode($jsonlastvid5);
$vid5published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid6url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid6&key=$api_key";
$jsonlastvid6 = file_get_contents($json_vid6url);
$listFromYouTube=json_decode($jsonlastvid6);
$vid6published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid7url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid7&key=$api_key";
$jsonlastvid7 = file_get_contents($json_vid7url);
$listFromYouTube=json_decode($jsonlastvid7);
$vid7published = $listFromYouTube->items[0]->snippet->publishedAt;
$json_vid8url="https://www.googleapis.com/youtube/v3/videos?part=snippet&id=$vid8&key=$api_key";
$jsonlastvid8 = file_get_contents($json_vid8url);
$listFromYouTube=json_decode($jsonlastvid8);
$vid8published = $listFromYouTube->items[0]->snippet->publishedAt;
//VIEW PART 0-8
$json_viewgetter="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid0&key=$api_key";
$jsonplaylistgetter = file_get_contents($json_viewgetter);
$listFromYouTube=json_decode($jsonplaylistgetter);
$vid0views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter1="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid1&key=$api_key";
$jsonplaylistgetter1 = file_get_contents($json_viewgetter1);
$listFromYouTube=json_decode($jsonplaylistgetter1);
$vid1views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter2="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid2&key=$api_key";
$jsonplaylistgetter2 = file_get_contents($json_viewgetter2);
$listFromYouTube=json_decode($jsonplaylistgetter2);
$vid2views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter3="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid3&key=$api_key";
$jsonplaylistgetter3 = file_get_contents($json_viewgetter3);
$listFromYouTube=json_decode($jsonplaylistgetter);
$vid3views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter4="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid4&key=$api_key";
$jsonplaylistgetter4 = file_get_contents($json_viewgetter4);
$listFromYouTube=json_decode($jsonplaylistgetter4);
$vid4views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter5="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid5&key=$api_key";
$jsonplaylistgetter5 = file_get_contents($json_viewgetter5);
$listFromYouTube=json_decode($jsonplaylistgetter5);
$vid5views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter6="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid6&key=$api_key";
$jsonplaylistgetter6 = file_get_contents($json_viewgetter6);
$listFromYouTube=json_decode($jsonplaylistgetter6);
$vid6views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter7="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid7&key=$api_key";
$jsonplaylistgetter7 = file_get_contents($json_viewgetter7);
$listFromYouTube=json_decode($jsonplaylistgetter7);
$vid7views=$listFromYouTube->items[0]->statistics->viewCount;
$json_viewgetter8="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$vid8&key=$api_key";
$jsonplaylistgetter8 = file_get_contents($json_viewgetter8);
$listFromYouTube=json_decode($jsonplaylistgetter8);
$vid8views=$listFromYouTube->items[0]->statistics->viewCount;
//Last Video Thumbnails
$images = json_decode(file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$lastvidid."?v=2&alt=json"), true);
$images = $images['entry']['media$group']['media$thumbnail'];
$image = $images[count($images)-4]['url'];
$maxurl = "http://i.ytimg.com/vi/".$lastvidid."/maxresdefault.jpg";
$vidurl0 = "http://i.ytimg.com/vi/".$vid0."/maxresdefault.jpg";
$vidurl1 = "http://i.ytimg.com/vi/".$vid1."/maxresdefault.jpg";
$vidurl2 = "http://i.ytimg.com/vi/".$vid2."/maxresdefault.jpg";
$vidurl3 = "http://i.ytimg.com/vi/".$vid3."/maxresdefault.jpg";
$vidurl4 = "http://i.ytimg.com/vi/".$vid4."/maxresdefault.jpg";
$vidurl5 = "http://i.ytimg.com/vi/".$vid5."/maxresdefault.jpg";
$vidurl6 = "http://i.ytimg.com/vi/".$vid6."/maxresdefault.jpg";
$vidurl7 = "http://i.ytimg.com/vi/".$vid7."/maxresdefault.jpg";
$vidurl8 = "http://i.ytimg.com/vi/".$vid8."/maxresdefault.jpg";
$max = get_headers($maxurl);
if (substr($max[0], 9, 3) !== '404') {
$image = $maxurl;
}
?>
I changed my code a little bet and got not that much file_get_contents.
But i found out that the Instagram API is really slow. So if i integrate the
instagram API my page loaded really slow. If i use Jquery Code it works fast but, everyone can look into the code and see the script brackets and thats what i dont want.
<?php
//Instagram Getter
// use this instagram access token generator http://instagram.pixelunion.net/
$access_token="";
$photo_count=9;
$json_instalink="https://api.instagram.com/v1/users/self/media/recent/?access_token=$access_token&count=$photo_count";
$jsoninsta = file_get_contents($json_instalink);
$objinsta = json_decode($jsoninsta);
//Link zu den Bildern
$imagelink1 = $objinsta->data[0]->link;
$imagelink2 = $objinsta->data[1]->link;
$imagelink3 = $objinsta->data[2]->link;
$imagelink4 = $objinsta->data[3]->link;
$imagelink5 = $objinsta->data[4]->link;
$imagelink6 = $objinsta->data[5]->link;
$imagelink7 = $objinsta->data[6]->link;
$imagelink8 = $objinsta->data[7]->link;
$imagelink9 = $objinsta->data[8]->link;
//Das Bild an sich
$profilelink1 = $objinsta->data[0]->images->standard_resolution->url;
$profilelink2 = $objinsta->data[1]->images->standard_resolution->url;
$profilelink3 = $objinsta->data[2]->images->standard_resolution->url;
$profilelink4 = $objinsta->data[3]->images->standard_resolution->url;
$profilelink5 = $objinsta->data[4]->images->standard_resolution->url;
$profilelink6 = $objinsta->data[5]->images->standard_resolution->url;
$profilelink7 = $objinsta->data[6]->images->standard_resolution->url;
$profilelink8 = $objinsta->data[7]->images->standard_resolution->url;
$profilelink9 = $objinsta->data[8]->images->standard_resolution->url;
//Channel and API Key
$channel_id = '';
$api_key = '';
//Channel Statistics
$json_statsurl="https://www.googleapis.com/youtube/v3/channels?part=statistics&id=$channel_id&key=$api_key";
$jsonstats = file_get_contents($json_statsurl);
$listFromYouTube=json_decode($jsonstats);
$subscriberCount = $listFromYouTube->items[0]->statistics->subscriberCount;
//Last Video ID/Title/Published/Thumbnails
$json_lastvidurl="https://www.googleapis.com/youtube/v3/search?key=$api_key&channelId=$channel_id&part=snippet,id&order=date&maxResults=10";
$jsonlastvid = file_get_contents($json_lastvidurl);
$listFromYouTube=json_decode($jsonlastvid);
$lastvidid = $listFromYouTube->items[0]->id->videoId;
$lastvidtitle = $listFromYouTube->items[0]->snippet->title;
$lastvidpublished = $listFromYouTube->items[0]->snippet->publishedAt;
$maxurl = "http://i.ytimg.com/vi/".$lastvidid."/maxresdefault.jpg";
//Playlist Videos 9 ID/Title/Published/Thumbnails
$vid0=$listFromYouTube->items[1]->id->videoId;
$vid1=$listFromYouTube->items[2]->id->videoId;
$vid2=$listFromYouTube->items[3]->id->videoId;
$vid3=$listFromYouTube->items[4]->id->videoId;
$vid4=$listFromYouTube->items[5]->id->videoId;
$vid5=$listFromYouTube->items[6]->id->videoId;
$vid6=$listFromYouTube->items[7]->id->videoId;
$vid7=$listFromYouTube->items[8]->id->videoId;
$vid8=$listFromYouTube->items[9]->id->videoId;
$vid0t=$listFromYouTube->items[1]->snippet->title;
$vid1t=$listFromYouTube->items[2]->snippet->title;
$vid2t=$listFromYouTube->items[3]->snippet->title;
$vid3t=$listFromYouTube->items[4]->snippet->title;
$vid4t=$listFromYouTube->items[5]->snippet->title;
$vid5t=$listFromYouTube->items[6]->snippet->title;
$vid6t=$listFromYouTube->items[7]->snippet->title;
$vid7t=$listFromYouTube->items[8]->snippet->title;
$vid8t=$listFromYouTube->items[9]->snippet->title;
$vid0published = $listFromYouTube->items[1]->snippet->publishedAt;
$vid1published = $listFromYouTube->items[2]->snippet->publishedAt;
$vid2published = $listFromYouTube->items[3]->snippet->publishedAt;
$vid3published = $listFromYouTube->items[4]->snippet->publishedAt;
$vid4published = $listFromYouTube->items[5]->snippet->publishedAt;
$vid5published = $listFromYouTube->items[6]->snippet->publishedAt;
$vid6published = $listFromYouTube->items[7]->snippet->publishedAt;
$vid7published = $listFromYouTube->items[8]->snippet->publishedAt;
$vid8published = $listFromYouTube->items[9]->snippet->publishedAt;
$vidurl0 = "http://i.ytimg.com/vi/".$vid0."/maxresdefault.jpg";
$vidurl1 = "http://i.ytimg.com/vi/".$vid1."/maxresdefault.jpg";
$vidurl2 = "http://i.ytimg.com/vi/".$vid2."/maxresdefault.jpg";
$vidurl3 = "http://i.ytimg.com/vi/".$vid3."/maxresdefault.jpg";
$vidurl4 = "http://i.ytimg.com/vi/".$vid4."/maxresdefault.jpg";
$vidurl5 = "http://i.ytimg.com/vi/".$vid5."/maxresdefault.jpg";
$vidurl6 = "http://i.ytimg.com/vi/".$vid6."/maxresdefault.jpg";
$vidurl7 = "http://i.ytimg.com/vi/".$vid7."/maxresdefault.jpg";
$vidurl8 = "http://i.ytimg.com/vi/".$vid8."/maxresdefault.jpg";
//Last Video Views
$json_lastvidstatsurl="https://www.googleapis.com/youtube/v3/videos?part=statistics&id=$lastvidid,$vid0,$vid1,$vid2,$vid3,$vid4,$vid5,$vid6,$vid7,$vid8&key=$api_key";
$jsonlastvidstats = file_get_contents($json_lastvidstatsurl);
$listFromYouTube=json_decode($jsonlastvidstats);
$lastvidviews = $listFromYouTube->items[0]->statistics->viewCount;
$vid0views = $listFromYouTube->items[1]->statistics->viewCount;
$vid1views = $listFromYouTube->items[2]->statistics->viewCount;
$vid2views = $listFromYouTube->items[3]->statistics->viewCount;
$vid3views = $listFromYouTube->items[4]->statistics->viewCount;
$vid4views = $listFromYouTube->items[5]->statistics->viewCount;
$vid5views = $listFromYouTube->items[6]->statistics->viewCount;
$vid6views = $listFromYouTube->items[7]->statistics->viewCount;
$vid7views = $listFromYouTube->items[8]->statistics->viewCount;
$vid8views = $listFromYouTube->items[9]->statistics->viewCount;
//Watchlink
$watchlink="http://undercover-gaming.de/youtube/video/";
?>
I'm having some trouble here V_shop_menu $order_uuid is not populating. Now I'm guessing this is because its yet to be created this is done further below. The problem I have is there are 2 statements here doing inserts to tables but they both rely on each other.
I have a bit of chicken and egg situation as I need $shop_menu_uuid from the top area to complete the bottom insert. I was led to believe that as they are in the same public function it would just work but this is not the case.
What do I need to do to make this happen?
Thanks!
public function add_shopmenu(){
$postData = $this->input->post();
$condition['conditions'][] = "site_name ='".$this->sessionInfo['site']."'";
$site = $this->frontguide_Model->selectSingleRow("t_place",$condition);
$site_uuid = $site['site_uuid'];
unset($condition);
$condition['conditions'][] = "site_uuid ='".$site['site_uuid']."'";
$condition['conditions'][] = "shop_menu_name ='".$postData['shop_menu_name']."'";
$shopmenu_name = $this->frontguide_Model->selectData("v_shop_menus",$condition);
unset($condition);
$condition['conditions'][] = "site_uuid ='".$site['site_uuid']."'";
$shopmenus = $this->frontguide_Model->selectData("v_shop_menus",$condition);
$shop_menu_enabled = (isset($postData['shop_menu_enabled']))?$postData['shop_menu_enabled']:"false";
$shop_menu_uuid = $this->frontguide_functions->uuid();
$v_shop_menu= array(
"shop_menu_uuid" =>$shop_menu_uuid,
"site_uuid" =>$site_uuid,
"order_uuid" =>$order_uuid,
"shop_menu_extension" =>$shop_menu_extension,
"shop_menu_name" =>$postData['shop_menu_name'],
"shop_menu_greet_long" =>$postData['shop_menu_greet_long'],
"shop_menu_greet_short" =>$postData['shop_menu_greet_short'],
"shop_menu_timeout" =>$postData['shop_menu_timeout'],
"shop_menu_enabled" => $shop_menu_enabled,
"shop_menu_cid_prefix"=>$postData['shop_menu_cid_prefix']
);
log_message('debug',print_r($v_shop_menu,TRUE));
$vgu_response = $this->frontguide_Model->insert("v_shop_menus",$v_shop_menu);
$shop_menu_option_digits = $postData['shop_menu_option_digits'];
$shop_menu_option_order = $postData['shop_menu_option_order'];
$shop_menu_option_description = $postData['shop_menu_option_description'];
$shop_menu_option_param = $postData['shop_menu_option_param'];
for($i=0;$i<count($shop_menu_option_digits);$i++){
$option = array();
$option['shop_menu_option_digits'] = $shop_menu_option_digits[$i];
$option['shop_menu_option_order'] = $shop_menu_option_order[$i];
$option['shop_menu_option_description'] = $shop_menu_option_description[$i];
$option['shop_menu_option_param'] = $shop_menu_option_param[$i];
$shop_menu_option_uuid= $this->frontguide_functions->uuid();
$option['shop_menu_option_uuid'] = $shop_menu_option_uuid;
$option['shop_menu_uuid'] = $shop_menu_uuid;
$option['site_uuid'] = $site_uuid;
$vgu_response = $this->frontguide_Model->insert("v_shop_menu_options",$option);
}
$order_uuid = $this->frontguide_functions->uuid();
$order_data = array(
"site_uuid"=>$site_uuid,
"order_uuid"=>$order_uuid,
“offer_uuid" => "a6788e9b-67bc-bd1b-df59-ggg5d51289ab",
"order_context"=>$site['site_name'],
"order_name" =>$postData['shop_menu_name'],
"order_number" =>$shop_menu_extension,
"order_continue" =>'true',
"order_order" =>'333',
"order_enabled" =>"true",
);
$v_orders = $this->frontguide_Model->insert("v_orders",$order_data);
Now I'm guessing this is because its yet to be created this is done
further below.
Yes you are right.
It is quite simple.
Insert v_shop_menus data without $order_uuid .
after inserting in v_orders, get the $order_uuid and update the v_shop_menus using $shop_menu_uuid.
I have to assign a long array to a codeigniter session but its not working. If I am using an array with three four element then this work. My array is given below.
$value['id'] = $checkout_product['checkout']['id'];
$value['user_id'] = $checkout_product['checkout']['user_id'];
$value['name'] = $checkout_product['checkout']['name'];
$value['maker'] = $checkout_product['checkout']['maker'];
$value['model'] = $checkout_product['checkout']['model'];
$value['color'] = $checkout_product['checkout']['color'];
$value['size'] = $checkout_product['checkout']['size'];
$value['slug'] = $checkout_product['checkout']['slug'];
$value['route_id'] = $checkout_product['checkout']['route_id'];
$value['description'] = $checkout_product['checkout']['description'];
$value['quantity'] = $checkout_product['checkout']['quantity'];
$value['p_units'] = $checkout_product['checkout']['p_units'];
$value['images'] = $checkout_product['checkout']['images'];
$value['label_type'] = $checkout_product['checkout']['label_type'];
$value['product_type'] = $checkout_product['checkout']['product_type'];
$value['auction_id'] = $checkout_product['checkout']['auction_id'];
$value['product_id'] = $checkout_product['checkout']['product_id'];
$value['budget_min'] = $checkout_product['checkout']['budget_min'];
$value['budget_max'] = $checkout_product['checkout']['budget_max'];
$value['bid_start_date'] = $checkout_product['checkout']['bid_start_date'];
$value['bid_end_date'] = $checkout_product['checkout']['bid_end_date'];
$value['status'] = $checkout_product['checkout']['status'];
$value['bid_id'] = $checkout_product['checkout']['bid_id'];
$value['bidder_id'] = $checkout_product['checkout']['bidder_id'];
$value['bid_product_id'] = $checkout_product['checkout']['bid_product_id'];
$value['bid_date'] = $checkout_product['checkout']['bid_date'];
$value['bid_qty'] = $checkout_product['checkout']['bid_qty'];
$value['bid_amount'] = $checkout_product['checkout']['bid_amount'];
$value['total_amount'] = $checkout_product['checkout']['total_amount'];
$value['payable_amount'] = $checkout_product['checkout']['payable_amount'];
$value['shipping_in'] = $checkout_product['checkout']['shipping_in'];
$value['shipping_method'] = $checkout_product['checkout']['shipping_method'];
$value['shipping_amount'] = $checkout_product['checkout']['shipping_amount'];
$value['pro_type'] = $checkout_product['checkout']['pro_type'];
$value['warranty_month'] = $checkout_product['checkout']['warranty_month'];
$value['warranty_type'] = $checkout_product['checkout']['warranty_type'];
$value['bid_note'] = $checkout_product['checkout']['bid_note'];
$value['bid_status'] = $checkout_product['checkout']['bid_status'];
$value['customer_id'] = $checkout_product['checkout']['customer_id'];
$value['customer_username'] = $checkout_product['checkout']['customer_username'];
$value['customer_firstname'] = $checkout_product['checkout']['customer_firstname'];
$value['customer_lastname'] = $checkout_product['checkout']['customer_lastname'];
$value['customer_email'] = $checkout_product['checkout']['customer_email'];
$value['customer_image'] = $checkout_product['checkout']['customer_image'];
$this->session->set_userdata('checkout', $value);
This code is not working for me. Please help me how I can post big array in session in codeigniter.
By default CodeIgniter stores the session data in a cookie, which has an upper limit of 2KB-4KB in size depending on browser.
If you are trying to store more than 4KB of data in the session you will start running into issues.
The easiest solution is to store the session details in the DB. The Codeigniter session documentation details the process for storing the session in the DB.
I'm currently working on a project with the MangoPay api (with PHP SDK) and I have some trouble with the PaymentDetails. The function below generate this key (when I call the MangoPay Create method on my PayIn object) :
payins_stdclass-direct_create
instead of :
payins_preauthorized-direct_create
The function I'm using :
<?php
private function createAuthorizationPayIn($authorization, $fees)
{
$payIn = new MangoPay\PayIn();
$payIn->CreditedWalletId = $this->adminWalletId;
$payIn->AuthorId = $this->adminUserId;
$payIn->PaymentType = "PREAUTHORIZED";
$PayIn->PaymentDetails = new MangoPay\PayInPaymentDetailsPreAuthorized();
$payIn->PaymentDetails->PreauthorizationId = $authorization->Id;
$payIn->DebitedFunds = new MangoPay\Money();
$payIn->DebitedFunds->Currency = $authorization->DebitedFunds->Currency;
$payIn->DebitedFunds->Amount = $authorization->DebitedFunds->Amount;
$payIn->CreditedFunds = new MangoPay\Money();
$payIn->CreditedFunds->Currency = $authorization->DebitedFunds->Currency;
$payIn->CreditedFunds->Amount = $authorization->DebitedFunds->Amount;
$payIn->Fees = $fees;
$payIn->ExecutionType = "DIRECT";
$payIn->ExecutionDetails = new MangoPay\PayInExecutionDetailsDirect();
$payIn->ExecutionDetails->SecureMode = "DEFAULT";
$payIn->ExecutionDetails->SecureModeReturnURL = "https://website.com";
$payIn = $this->mangoPayApi->PayIns->Create($payIn);
$authorization->payinId = $payIn->Id;
$authorization = $this->mangoPayApi->CardPreAuthorizations->Update($authorization);
return $payIn;
}
How can I create the right PaymentDetails object to create a preAuthorized PayIn ?