I am very sorry to be asking for help and it's been a while since I last did that.
In general I find my own solutions however I recently switched my website PHP version 7.0 and it seems that the mail send form is no longer working as a result.
The error I receive is:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function phpfmg_hsc(), 1 passed in contact2/indexnl.php on line 61 and exactly 2 expected in form.lib.php:1244
Stack trace:
#0 indexnl.php(61): phpfmg_hsc('field_1')
#1 form.lib.php(193): phpfmg_form('')
#2 indexnl.php(9): phpfmg_display_form()
#3 {main}
thrown in /public_html/contact2/form.lib.php on line 1244
In these lines i have:
#0
<textarea name="field_1" id="field_1" rows=4 cols=25 class='text_area'><?php phpfmg_hsc("field_1"); ?></textarea>
#1
phpfmg_header( $title, $keywords, $description );
if( !$isHideForm ){
phpfmg_form($sErr);
}else{
phpfmg_thankyou();
};
phpfmg_footer();
return;
}
#2
phpfmg_display_form();
#3
function phpfmg_hsc($field, $default){
echo isset($_POST[ $field ])
? HtmlSpecialChars( $_POST[ $field ] )
: $default;
}
I'm sorry for asking what I'm sure for a lot of you higher level programmers is stupid, but can someone please help me out? I really have tried to understand it, but I don't.
I look forward to your help.
-Isaac
I would hazzard a guess that this has always been an error, but when you changed versions of PHP the new php.ini has got error reporting turned on.
#3 tells you how to fix this!
The second parameter is what it should use as a default if the input field has not previously been set.
So change all calls to phpfmg_hsc() to have a default, the simplest solution would be to do
phpfmg_hsc('field_1', '')
to signify to leave the field empty
You might consider changing the function itself like this, but as that code is not yours, that might not be the best idea as if you ever update that addin your problem will come back.
function phpfmg_hsc($field, $default=''){
echo isset($_POST[ $field ])
? HtmlSpecialChars( $_POST[ $field ] )
: $default;
}
Related
This question already has answers here:
Reference: What is variable scope, which variables are accessible from where and what are "undefined variable" errors?
(3 answers)
Closed 5 years ago.
I cannot find the solution, spending hours of troubleshooting, though. Frustration growns steadily.
The problem: I try, after transferring a web page to a new provider that requires the oop approach for mysql interfaces, to reset all the sql command lines. This works fine. But there is one part that I cannot get working. The called php-file movie.php looks like:
<?php
include 'scripts/init.php';
...
$cameraString = AssignPerson( $movieID, 'camera' );
?>
The important bits from init.php are:
<?php
session_start();
include 'scripts/connect2SQL.php';
include 'scripts/logInOut.php';
include 'scripts/classes_functions.php';
?>
The connect2SQL.php reads
<?php
$connection2MySQL = mysqli_connect( "localhost" , "***" , "***", "***");
mysqli_query( $connection2MySQL , "SET CHARACTER SET 'utf8'" );
mysqli_query($connection2MySQL , "SET SESSION collation_connection ='utf8_unicode_ci'" );
?>
So the variable $connection2MySQL represents the oop connection to the database.
The function AssignPerson( $movieID, 'camera' ); in the movie.php is defined in the classes-file classes_functions.php. Here, the essential snippets are
function AssignPerson( $objectID, $type = 'actor' ) {
$memoryString = '';
// THAT FOLLOWING LINE IS NOT WORKING :::
$persons = $connection2MySQL->query( "SELECT * FROM actors2movies" );
if ( mysqli_num_rows( $persons ) ) {
while ($person = mysqli_fetch_assoc( $persons )) {
$personID = $person['personeID'];
$memoryString .= $person['personName'];
}
}
return $memoryString;
}
The error message that comes up in the browser looks like:
Fatal error: Uncaught Error: Call to a member function query() on null in /var/www/web26777278/html/filmstadt-quedlinburg/scripts/classes_functions.php:173 Stack trace: #0 /var/www/web26777278/html/filmstadt-quedlinburg/movie.php(354): AssignPerson('800', 'director') #1 {main} thrown in /var/www/web26777278/html/filmstadt-quedlinburg/scripts/classes_functions.php on line 173
The issue here is, that when I delete the lines of the query (and the following ones), the program works. So the error must be in the line i indicated above. On the other hand, if I copy that line directly into the movie.php, the line works! So it must have to do something with the encapsuling thing of php-files into the others.
I checked if I need to repeat the including line of the SQL connection in the classes.php. I checked also, whether there are forgotten brackets, spelling mistakes in the database tables and that kind of things. Can't help myself.
Do you have any idea where I could have another look for the problem?
Greetings and thank you
Frank
$connection2MySQL is declared outside function so it is null inside function.
You have to pass connection object to function to work properly
I have the following code
//$sp = new SharePointAPI('&&', '&&', 'https://&&.net/personal/zzz/_vti_bin/Lists.asmx?WSDL',);
//$sp = new SharePointAPI('&&', '&&', 'https://&&net/personal/zzz/_vti_bin/Lists.asmx?SDL', 'NTLM');
$sp = new SharePointAPI('&&', '&&', 'https://&&net/personal/zzz/_vti_bin/Lists.asmx?WSDL', 'SPONLINE');
$listContents = $sp->read('GetListCollection');
return $listContents;
Depending on which of the "new SharepointAPI" lines I execute, I get a different error.
Using "NTLM", I get the error: -
Uncaught exception 'Exception' with message 'Error'
in /home/shinksyc/public_html/sharepointUpload/src/Thybag/Auth/SoapClientAuth.php:129
Stack trace:
#0 [internal function]: Thybag\Auth\SoapClientAuth->__doRequest('<?xml
version="...', 'https://my.sp.m...', 'http://schemas....', 1, 0)
Using "SPONLINE", I get the error
'Error (Client) looks like we got no XML document'.
I am also slightly confused as to how to find out what the name of the lists may be that I get read.
Any help is much appreciated.
Thanks
Martin
The path to your xml must be local: in clear, log to your sharepoint, go to the url https://mySPsite/subsite/_vti_bin/Lists.asmx?WSDL
Download the XML and place it on your PHP server.
then
$sp = new SharePointAPI($login, $password, $localPathToWSDL, 'NTLM');
I want to implement Strip payment process in a site. I tried to do it but it's not look working. The error I got is
Fatal error: Uncaught exception 'Stripe_InvalidRequestError' with message 'Could not determine which URL to request: Stripe_Charge instance has invalid ID: ' in /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php:46 Stack trace: #0 /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php(15): Stripe_ApiResource->instanceUrl() #1 /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php(8): Stripe_ApiResource->refresh() #2 /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/Charge.php(14): Stripe_ApiResource::_scopedRetrieve('Stripe_Charge', NULL, NULL) #3 /home/twassist/public_html/wp-content/themes/inovado/functions.php(355): Stripe_Charge::retrieve(NULL) #4 /home/twassist/public_html/wp-content/themes/inovado/functions.php(361): Strip_Code() #5 /home/twassist/public_html/wp-settings.php(291): include('/home/twassist/...') #6 /home/twassist/public_html/wp-config.php( in /home/twassist/public_html/wp-content/themes/inovado/stripe-php-1.7.15/lib/Stripe/ApiResource.php on line 46
Do someone tried it here http://twassistant.com/hire change the quantity.
Fill this detail 5555 5555 5555 4444 expiry date 12 / 21 name: anything 121.
This will make test payment. When come redirect to the code it's give you this error.
Here is the code I tried in my php file.
function Strip_Code()
{
$stripCode = trim($_GET['stripeToken']);
if (strlen($stripCode) > 0) {
require_once dirname(__FILE__).'/stripe-php-1.7.15/lib/Stripe.php';
Stripe::setApiKey("sk_test_XXXXXXXXXXXXXXX");
$resp = Stripe_Charge::retrieve($$stripCode);
var_dump($resp);
}
}
Strip_Code();
could be that you have a typo (double $$):
Stripe_Charge::retrieve($$stripCode);
also, you shouldn't reveal your private key... even if it's just your test key
am trying to get a simple nested bean relationship - what am i missing?
i really like redbean's simple ORM syntax and really want to use it, but i can't seem to get it to work for me!
Is there anything else similar to this that's a bit more mature maybe? I want something light and simple to build wordpress plugins with but need to know i can rely on it in the future...
am starting to think about just using ezsql/sqlite but would rather not :/
Thanks for any help...
function p($s){
$s = htmlentities(print_r($s,true));
echo "<pre>$s</pre>";
}
require('rb.php');
R::setup('sqlite:dbfile.sql'); //sqlite\
R::debug(true);
// R::wipe('book');
// R::wipe('author');
$book = R::dispense( 'book' );
$book->title = 'Boost development with RedBeanPHP';
$a = R::dispense('author');
$a->name = "Dave";
$book->author = $a;
list($page1,$page2) = R::dispense('page',2);
$book->pages = array($page1,$page2);
$id = R::store($book);
echo $b = R::load('book',$id);
echo $b->author->name;
I'm getting the following error when trying to store the pages....
Fatal error: Uncaught exception 'RedBean_Exception_Security' with
message 'Invalid Bean: property pages ' in
/Users/sig/Sites/redbean/rb.php:1508 Stack trace: #0
/Users/sig/Sites/redbean/rb.php(1587):
RedBean_OODB->check(Object(RedBean_OODBBean)) #1
/Users/sig/Sites/redbean/rb.php(2523):
RedBean_OODB->store(Object(RedBean_OODBBean)) #2
/Users/sig/Sites/redbean/index.php(30):
RedBean_Facade::store(Object(RedBean_OODBBean)) #3 {main} thrown in
/Users/sig/Sites/redbean/rb.php on line 1508
the problem was that the array needs to have the same name as the objects in it, but with either own or shared prefixed depending on the relationship...
$book->ownPage = array($page1,$page2);
This is my first question :).
Im writing a little twitter app in PHP that sends a DMs to all your followers. What im trying to do right now is to get the list of followers. So through twitter api and getting all usernames but for some reason this parsing error appear. Im new to php(but not so much to programming), I actually started learning it yesterday so please be easy on me ;).
Here is the code:
$t= new twitter();
$t->username= $_GET["username"];
$t->password= $_GET["password"];
$fi = $t->followers();
$xml[$page] = new SimpleXMLElement($fi[2]);
$user1count=0;
while(isset($xml[$page]->user[0])){
foreach ($xml[$page]->user as $user) {
$userdet[(string)$user->screen_name]=array( ’screen_name’=> (string)$user->screen_name, ‘location’=>(string)$user->location, ‘description’=>(string)$user-> description, ‘profile_image_url’=> (string)$user-> profile_image_url, ‘url’=>(string)$user-> url, ‘name’=>(string)$user->name );
$user1details[$user1count]= (string)$user->screen_name;
$user1count++;
}
$page++;
$fi=getfilecontents($friendsurl.$username1."xml?page".$page);
if($fi[0]===false){
echo ("Error :".$fi[1]);
$err=new SimpleXMLElement($fi[2]);
echo " ".$err->error." ";
// echo ““;
die();
}
$xml[$page] = new SimpleXMLElement($fi[2]);
}
And the error said:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /Applications/XAMPP/xamppfiles/htdocs/scripts/dmsend.php:125 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/scripts/dmsend.php(125): SimpleXMLElement->__construct('') #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/scripts/dmsend.php on line 125
Thank you! :)
It looks like $fi[2] is not a valid xml string. I am not 100% familiar with the twitter API, but I would do a var_dump($fi) and evaluate what is begin returned. From there, you should be able to figure out what is happening.