PHP - Call To Undefined Function Deposit()
What's undefined about deposit()?
Code: [Select] class BankAccount { private $name; var $balance = 0; private $dep = 0; function __construct() { if (array_key_exists ("deposit" , $_POST)) { $dep = $_POST['deposit']; echo $dep; deposit($dep); } } function deposit($dep) { $balance += $dep; echo $balance; } } Similar TutorialsCode: [Select] <html> <center> <form method="post" action=""> <b>Email</b><br><input type="text" name="email"/><br> <b>Password</b><br><input type="password" name="password"/><br> <input type="submit" name="submit" value="Login"/><br> </form> <?php if(isset($_POST['submit'])){ echo echo_post($_POST['email']); function echo_post($postvar){ return $postvar; } } ?> </center> </html> the filename is index.php How come I get the undefined function echo_post on line 14? I know it is probably something simple but I am kind of new to this, if you could help me out that would be great Hi all I have been trying to do a query but I get Call to undefined function mysql_connect() What other way can I perform a query? Or do I need to get something enabled? Thank in advance Dave Error: call to undefined function mcrypt_module_open() I have copied this code form net. And i think so that mcrypt_module_open() would be a built in function. But I think it is not so. How can i define this function. OR any other way to solve this problem?? Code: [Select] $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $iv_size = mcrypt_enc_get_iv_size($cipher); printf("iv_size = %d\n",$iv_size); $key256 = '12345678901234561234567890123456'; $key128 = '1234567890123456'; $iv = '1234567890123456'; printf("iv: %s\n",bin2hex($iv)); printf("key256: %s\n",bin2hex($key256)); printf("key128: %s\n",bin2hex($key128)); $cleartext = 'The quick brown fox jumped over the lazy dog'; printf("plainText: %s\n\n",$cleartext); if (mcrypt_generic_init($cipher, $key256, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("256-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); } if (mcrypt_generic_init($cipher, $key128, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("128-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); }Thanks In advance Currently, I am reading a book called PHP Web 2.0 Mashups and I have stumbled across an error on the second chapter which deals with XML-RPC protocol. The book has the following code which it uses to demonstrate the XML-RPC encoding functionality of PHP with the xmlrpc_encode_request function: <?php $singleVar = "Hello!"; $requestMessage = xmlrpc_encode_request('theRemoteCall', $singleVar); echo $requestMessage; ?> However when I load this page up on my local testing platform nothing is displayed. Upon checking the PHP error log I am confronted with this: [24-Jan-2011 07:56:40] PHP Fatal error: Call to undefined function xmlrpc_encode_request() in C:\wamp\www\jquery\collapsible.php on line 79 A couple of other points in relation to this: 1. I have the following lines in my PHP.ini file: Code: [Select] ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 ; An XML-RPC faultCode ;xmlrpc_error_number = 0 Does this not mean that xmlrpc functions are all ready installed on my WAMP server? I have download XML-RPC for PHP from http://phpxmlrpc.sourceforge.net/ (3.0.0 beta) and placed the files inside the extracted 'lib' folder into C:/PHP/includes and uncommented the PHP.ini line 'include_path = ".;c:\php\includes"'. However still, after restarting WAMP and refreshing the page it is still issuing a fatal error in PHP error log. Thank you for all your help in advance. Good day! I change my database from sql yog to SQL Server 2005 Express so in php the connection is different, so now I am new in SQL Server 2005 Express. i edit my login page and I encountered error: Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\web_intranet\index.php on line 14 here is my code: <?php session_start(); session_regenerate_id(); if($_SESSION['loggedin']){ //the user is already logged in, lets redirect them to the other page header("Location:company.php"); } //require_once 'conn.php'; $server = "PDOMAIN\MSFW"; $db_name="dspi"; mssql_connect($server) or die("Cannot connect to server"); mssql_select_db("$db_name")or die("Cannot select DB"); $department = $_POST['department']; $username = $_POST['username']; $sql=mssql_query("SELECT `Department`, `Username` FROM `tbllogin` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mssql_min_error_severity()); $ct = mssql_num_rows($sql); if($ct == 1) { // im guessing this means that the user is valid. $_SESSION['loggedin'] = true; // now that the user is valid we change the session value. $row = mssql_fetch_assoc($sql); //$_SESSION['username'] = $row['Username'] ; //$_SESSION['department'] = $row['Department']; $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain'); if (in_array($row['Department'], $Departments)){ header ('Location:company.php'); }else{ echo "Incorrect Username or Department"; header ('Location:index.php'); } } ?> //$_SESSION['department'] = $row['Department']; $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain'); if (in_array($row['Department'], $Departments)){ header ('Location:company.php'); }else{ echo "Incorrect Username or Department"; header ('Location:index.php'); } } ?> i already enable extension mssql in php.ini PHP Version 4.4.9 Fatal error: Call to undefined function: date_default_timezone_set() in /hsphere/local/home/xxxxx/addfeeds2.php on line 11 can sombady help me how to fix this please? can't upgrade php version line 11 is date_default_timezone_set("Europe/Rome"); Something strange is happning, line producing the error: if( ($this->subject == "") || ($this->message == "") ){ Any ideas guys? thanks lots!! I am using tidy_repair_string() function as part of a string filter, the except is below.
/* Tell Tidy to produce XHTML */ $xhtml = tidy_repair_string($html, array('output-xhtml' => true));I am getting a fatal error thrown up as below. I thought tidy_repair_string() is an inbuilt PHP function or is it not? Fatal error: Call to undefined function tidy_repair_string() in C:\wamp\www\APPLICATION-FOLDER\contituency-manager\filter.php on line 14 Hello, I have the situation shown below in the code: if(//condition is met) { $val = new Val(); $valon = $val->check($_POST, array(.........)); } if($valon->passes()) { $use = new Use(); ........ } //check() and passes() both belong to class Val public function check($source, $items = array()) { ...................... return $this; }I get the following warning and error: Notice: Undefined variable: valon and Fatal error: Call to a member function passes() on a non-object I can't see anything wrong with the code. check() returns an object of class Val which is assigned to $valon, $valon then calls a member function of class Val. Could you please help. Please let me know whether to include further code. can anyone see the problem here i am running php 5.3 on my server and GD seems to be enabled. and my host said it was probably something to do with the captcha files or script. <?php session_start(); /* * File: CaptchaSecurityImages.php * Author: Simon Jarvis * Copyright: 2006 Simon Jarvis * Date: 03/08/06 * Updated: 2007-08-12 by Jenny Ferenc (minor visual changes only) * Requirements: PHP 4/5 with GD and FreeType libraries * Link: http://www.white-hat-web-design.co.uk/articles/php-captcha.php * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details: * http://www.gnu.org/licenses/gpl.html * */ class CaptchaSecurityImages { var $font = 'VeraSe.ttf'; function generateCode($characters) { /* list all possible characters, similar looking characters and vowels have been removed */ $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $code; } function CaptchaSecurityImages($width=130, $height=40, $characters=6) { $code = $this->generateCode($characters); // font size will be 60% of the image height $font_size = $height * 0.6; $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream'); // set the colours $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); // generate random dots in background for( $i=0; $i<($width*$height)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color); } // generate random lines in background for( $i=0; $i<($width*$height)/150; $i++ ) { imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color); } // create textbox and add text $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4])/2; $y = ($height - $textbox[5])/2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function'); // output captcha image to browser header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $_SESSION['security_code'] = $code; } } $captcha = new CaptchaSecurityImages(); ?> this seems to be the problem line he Code: [Select] $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); [\code] I have a long list of variables with form fields inserted into them like this: $page_id = $_POST['exclude']; I just turned on WP_Debug just to see which error messages would come up and to my surprise it wasn't that bad, the most error messages were "Call to Undefined function". The solution to this problem is simple, all I have to do is wrap an isset around all the form field variables, like this: $page_id = isset($_POST['exclude']); My question is, is this really necessary or considered as good practice? Should I now go ahead and wrap to all the variables in that long list an isset around? Or should I just turn WP_Debug off again and leave it as is? I personally would like to adopt to the good practice way, but I don't know how much of an advantage it is to wrap an isset around every single form field variable. Any suggestions? MySQL Client Version: 5.1.50-community PHP Version: 5.3.5 Apache Version: 2.2.17 Okay, I am trying to get MySQL to cooperate with PHP. All of my attempts have been unsuccessful. Before you post a reply, please note I have taken these steps before I posted this topic: 1. My libmySQL.dll is in both my php and C:\Windows folder 2a. (Mental note: my installation directory is C:\Program Files\Apache 2.2\php\ext) 2b. The extension_dir in my php.ini file is as follows: Code: [Select] extension_dir = "C:\Program Files\Apache 2.2\php\ext"3. The php.ini file is also in the C:\Windows folder. 4. The extensions that are enabled for php are as follows: Code: [Select] [PHP_MYSQL] extension=php_mysql.dll [PHP_MYSQLI] extension=php_mysqli.dll [PHP_PDO_MYSQL] extension=php_pdo_mysql.dll5. Any section referencing to MySQL in my php info is not showing up. 6. I have tried replacing my php_mysql.dll, didn't work either. Okay, so when I try to install my forums for my website, it returns with this error: Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache 2.2\htdocs\forum\upload\includes\class_core.php on line 312 Please notify me of anything that has or will work(ed). Im taking my on-the-job. Code: [Select] <?php $zip = zip_open("zip.zip"); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp = fopen("zip/".zip_entry_name($zip_entry), "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); } } zip_close($zip); } ?> my supervisor said that i have a library to add.. im searching on it but i cant find anything.. help pls.. i run this on linux. I keep getting this error and can not figure out what is wrong: Fatal error: Call to undefined function showcart() in C:\xampp\htdocs\sas\shoppingcart\showcart.php on line 8 I have attached both the showcart.php and the functions.php files any help will be appreciated Thank you John when I try to upload the image on submit, I get there following error: Fatal error: Call to undefined function file_extension() in editlogo.php on line 41 Line 41 is the very last line of the code. Code: [Select] // get form data, making sure it is valid $img_name = $_FILES['myimage']['name']; $tmp_name = $_FILES['myimage']['tmp_name']; $img_size = $_FILES['myimage']['size']; if ($img_name) { if ($img_size>2097152) { die('Max image size is 2mb!'); } else { $file_ext = file_extension($img_name); After I did enable the following error reporting: Code: [Select] Default Value: E_ALL & ~E_NOTICE I am getting the error message described in the title of this thread. I do have the php_mysqli.dll extension enabled as well - AND the function used to work as is, before I changed the error reporting, thus the function actually should be defined, what could be another reason, that PHP thinks it is not a defined function? Hi there, I have already read some other topics concerning the same problem I am encountering. I have multiple applications which I programmed in PHP. In all of these applications I use a central authentication database and a central translation database (also on PHP). For this to work, I need to include a functions.php file for both the authentication db as for the translation db in all of my sites. Because I use different URL's for all my apps, including auth and transl, I am forced to use an URL when including both the functions.php files of the auth db and the transl db. As I found out (the hard way) PHP5 doesn't include the raw data of my functions.php files into the calling files, so none of my functions are known and I receive an error "Call to undefined function ...". Since I am using these programs only on an internal network (not public available), I am not afraid of any security issues. Is there any way I can include my functions.php files using an URL (like include ('http://trans.mysite.com/sys/functions.php');) so the defined functions in the functions.php file are known for the calling page? I hope I am not too confusing you all with my story, but I would really be very greatfull with some help. If needed I can also provide you with some more coding I used and configuring. I already checked my php.ini file and the following settings have already been applied: allow_url_fopen = On allow_url_include = On short_open_tag = On Many thanks in advance. Hello, i use MySQL with PHP. My php version is 5.2.0. After i connect to the db i use mysql_set_charset in order to change the system variables (character_set_client , character_set_results ,character_set_connection). i do: Code: [Select] if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); mysql_set_charset('utf8',$$link); } else { $$link = mysql_connect($server, $username, $password); mysql_set_charset('utf8',$$link); } I take the error: Fatal error: Call to undefined function mysql_set_charset(). In the manual page for mysql_set_character says: 1."(PHP 5 >= 5.2.3)" --> that means that i have an old php version?? 2."Note: This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended. " What shall i do in order to solve my problem?? thanks, in advance! This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=345884.0 |