Skip to main content

Posts

axios : How exactly to preserve session after successful authorization and send with subsequent request

In this test case am sending an axios post request with userId and password to ExpressJS server running with passportjs local. Server respond with status code 200, and send appropriate header with set-cookie. I need subsequent request to be treated as authorized request, for that tried following options, but none seems to be working. It getting rejected with status code 401. First call with userid and password, responded with status 200 const userDoc = { userId: 'test-user-1', userName: 'Test User 1', emailId: 'test.user.1@abc.xom', password: 'test-password' } ; let resp resp = await axios({method : 'post', url : 'http://localhost:4040/auth/local', data : {userId: userDoc.userId, password: userDoc.password },withCredentials: true }) following options are used to send next request send cookies received as part of 1st request const headers = { headers : {Cookie: resp.headers['set-cookie'][0] } }; send

How can I contain a PDO query in a PHP function? [duplicate]

I verified that a query works. If I try to contain a version of it in a function, it doesn't seem to work. Here is the query on its own; the verification of its functionality comes from the echo in the last line: $stmt = $conn->prepare('SELECT * FROM ObjectTable WHERE RowNum = ?'); $stmt->execute([$objecttablerow]); while ($row = $stmt->fetch()) { $objectformout = "${row['ObjectForm']}"; } echo $objectformout; Here is my attempt to contain that query in a function; I was able to independently verify that $objecttablerow contains the expected integer value that a simple function can at least echo: function verbalize_object($vo_input) { $objectformout = ""; $stmt = $conn->prepare('SELECT * FROM ObjectTable WHERE RowNum = ?'); $stmt->execute([$vo_input]); while ($row = $stmt->fetch()) { $objectformout = "${row['ObjectFo

Bigger font and limit to show letters

Helo, I have some museum website from internet with image uploading and displaying. To display them it is using php function foreach. Problem is it looks like in picture. I would like to make Title bigger and if description is long, it is covered by image in next row. Is there a way to fix that 2 thing? (Simple I want to make Title bigger and if description has more than 15 letters, it show after 15th letter ... and it will be full visible when you click on image on fullscreen.) Or is there a way to make it better? This is how it looks .home .media-list { display: flex; flex-flow: wrap; } .home .media-list a { display: block; text-decoration: none; position: relative; margin-bottom: 60px; margin-left: 30px; } .home .media-list a:nth-child(3n) { margin-right: 0; } .home .media-list .placeholder { display: flex; flex-flow: column; width: 100%; height: 100%; justify-content: center; align-items: center; background-color: #ddd; color: #bb

Steps to get csv from Facebook Ads lead form in PHP?

What are the singular steps to follow to obtain a export csv from Facebook Ads lead form using PHP? I have found a curl command here: https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/ , but it doesn't work if I'm not logged in on Facebook and I don't understand the preliminary steps. source https://stackoverflow.com/questions/70146117/steps-to-get-csv-from-facebook-ads-lead-form-in-php

install libvpx on Centos 6, for enable webp support on php 5.5?

I use ann old system (centos 6, with php 5.5, Diectadmin with custombuild 1.2.43), and they are can't not update becase some reason... So i try install libvpx for enable webp support on php 5.5. These are what i do... tell me if you have better solution wget https://github.com/webmproject/libvpx/archive/v1.11.0/libvpx-1.10.0.tar.gz tar -zxvf libvpx-1.10.0.tar.gz cd libvpx-1.10.0 ./configure --enable-shared --enable-pic make make install cd .. if have some error like missing yasm and nasm, run: yam install yasm yam install nasm And re-run ./configure --enable-shared --enable-pic make make install cd .. output: [root@data libvpx-1.10.0]# make install [INSTALL] /usr/local/include/vpx/vp8.h [INSTALL] /usr/local/include/vpx/vp8cx.h [INSTALL] /usr/local/include/vpx/vp8dx.h [INSTALL] /usr/local/include/vpx/vpx_codec.h [INSTALL] /usr/local/include/vpx/vpx_frame_buffer.h [INSTALL] /usr/local/include/vpx/vpx_image.h [INSTALL] /usr/local/include/vpx/vpx_integer.h [INSTALL] /usr/local

Display parent and child from query result to html with php or Ci3 [closed]

Now i have result from query : id name parent 1 a 0 2 b 0 3 c 1 4 d 1 5 e 3 and i need to display in html like this how i can do this by php or Codeigniter3 parent | child | subchild| and more..... | c | e | a | d | | | | | b | - | | source https://stackoverflow.com/questions/70146049/display-parent-and-child-from-query-result-to-html-with-php-or-ci3

wordpress how to access error messages in login form

I want to use my custom login form in wordpress. I want to show in my form the wordpress login error messages too but i don't know how to do this. I have creaded the div class="log-msg" to output the login error messages. Here my code: my-custom-login.php <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> <input type="text" name="log" class="form-control" id="user-login" required> <label for="user-login">Login</label> <input type="password" name="pwd" id="user_pass" class="form-control" required> <label for="user_pass">Password</label> <?php // Here how can i access to error login messages? // echo '<div class="lo