I'm working on a basic PHP login for the very first time using a udemy online course.
I'm really struggling already as my code, which is in the tutorial, gives an error when I open the page!
All I have, saved in a file called salt.php is:
<?php
$salt = openssl_random_pseudo_bytes(1024);
var_dump($salt);
?>
Seems pretty basic, and I'm running this with WAMP. But I just get an error message instead of outputting the random characters.
Fatal error: Call to undefined function openssl_random_pseudo_bytes() in C:\wamp\www\login-register\salt.php on line 3
Related
I am trying to execute following code from the SVG basic output example from the docs.
<?php
include('vendors/phpqrcode/qrlib.php');
$svgCode = QRcode::svg('PHP QR Code :)');
echo $svgCode;
All I get is the error:
Fatal error: Call to undefined method QRcode::svg()
/path/to/php/file/index.php on line 1337
The strange thing is that the simple PNG output example works fine without any errors, so the include must be correct.
<?php
include('vendors/phpqrcode/qrlib.php');
QRcode::png('PHP QR Code :)');
Do you guys have an idea what I might have forgot to check? Maybe the error is obvious for you.
As noticed in another thread and I experienced myself, the latest version is at https://github.com/t0k4rt/phpqrcode. With the version there, SVG is implemented and working.
I am programming a website and my current task is to save the text on a mysql server so I can login as admin and then edit the displayed text online.
I already got so far that everything works but I have done it using mysql functions. Now changed all those functions to mysqli ones, since I heard those are way better.
Here is my mysql_connect.php which I created so I could include this in the other scripts wherever I need to connect to the server:
mysql_connect.php
This is my block1_aboutme.php file, where I connect to the server and request all the text from it so I can display it on my "about me" page. This also works as intended and it properly displays the text on my page.
block1_aboutme.php
The problem is when I login as an admin a part of the login verification is this code below in my class.login.php script. As soon as I am logged in and go to my aboutme page an error occurs:
Fatal error: Uncaught Error: Call to a member function query() on unknown in C:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php:84 Stack trace: #0 C:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php(73): Login->verifyDatabase() #1 C:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php(36): Login->verifySession() #2 C:\xampp\htdocs\mywebsites\LuPaw\aboutme.php(42): Login->isLoggedIn() #3 {main} thrown inC:\xampp\htdocs\mywebsites\LuPaw\admin\class.login.php on line 84
This error refers to line 84 which is the $data = $db-> query("select stuff") function.
Somehow this does not work here, while the nearly exact same code line does work in the block1_aboutme script.
I would place the link of my 3rd script here but I can't since I don't have reputation pints yet to place 3 links in one post. Will post 3rd picture in the comments.
I already tried out a few things. If I for example echo out the "$path" it shows the correct path which means $db should be a viable variavble.
Does anyone see the problem here?
Try not to use include_once in your class method as the file will not be included if anywhere during the script execution has been already included: use include instead.
Anyway this is not the best solution you can achieve, I can suggest you to implement a DB class as a singleton and then retrieve the database instance in order to execute your queries.
I have a script that is encoded with IONCUBE 8.3.
And now , I have a Bad problem that I can't solve it.
the version of Loader is 4.6 on server (its lastest version)
But I see this error :
Fatal error: Call to undefined function [obfuscated]() in .... .
I have already obfuscated all the functions and classes and I can't let them unobfuscated !
So what should I do to solve this ?
I tried to solve it by cheking all function and setting on server .
But they are ok
Assuming that you have encoded the files yourself and that you have the source, a first step would be to disable line number obfuscation so that you can find the location of the failed function call. From that you can look at the source code and identify the function that cannot be found. It may be, for example, that the code is calling a function with a name that has not been obfuscated, and an exclusion list could then be used so as not to obfuscate calls to that particular function.
I am working with an API that has a "supported" library written by a third party.
I've done as the instructions say and feel I am very close to getting it working as it should however no matter what I try, (renaming, absolute paths, aggregated file paths, etc.) I'm getting the same error.
*I have an API key. This is not the issue
The error arises in this block:
define('API_KEY', ''); // //-- Insert your API key
define('PHP_SELF', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'));
require_once("FFN.class.php");
$ffn = new FFN(API_KEY); //where actual error is thrown
if (!API_KEY) {
echo 'You did not set the API_KEY for your application. This is required.';
exit;
}
And states:
PHP Fatal error: Class 'FFN' not found in /st/3/g/public_html/path/nerdapi.php on line 16
The actual error is thrown on $ffn = new FFN(API_KEY);
If anyone can spot my probably very obvious error, I'd really appreciate it.
Here is the site where I got the 3rd party code for the API's
https://github.com/philip/FantasyNerdAPI
i download the file, and put up these file:
FFN.class.php
sdk.php
on htdocs/a and accessing localhost/a/sdk.php
result was : You did not set the API_KEY for your application. This is required.
well, i didnt put the key.
I'm getting the following using the PHP client on my server (connecting via FBML). I've included the appropriate php files (facebook etc..)
Fatal error:
Call to undefined method FacebookRestClient::feed_publishUserAction()
in ..../index.php on line 50
I'm trying to use the example given.
Any ideas?
You might want to take a quick browse/grep through your Facebook API files (facebookapi_php5_restlib.php) and make sure that the feed_publishUserAction() method exists. Perhaps you're using an older version of the API library?
OMG I found the answer
Because the facebookapi_php5_restlib.php that facebook.com provided you is a piece of outdated shit
i.e. you won't be able to find the word feed_publishUserAction in the facebookapi_php5_restlib.php file
HOWEVER, the official facebook smiley demo from this facebook wiki page , contained a more completed facebookapi_php5_restlib.php , along with the feed_publishUserAction function
Which finger would you like to show to the facebook developer staffs?