PHP - Error In My Application.
Hey all I have an error in my Facebook application and I'm not sure what's wrong (New to PHP).
The error output is: Code: [Select] Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/app/view.php on line 15 And the PHP lines are as follows: $friends = $facebook->api('/me/friends'); print_r(array_rand($friends, 3)); Similar TutorialsHTTP Header input client-ip was set to 1 Error message found: Code: [Select] Notice: Undefined index: user_name in D:\wamp\www\javascript\public\proc\login.php on line <i>9</i> HTTP Header input user-agent was set to 1 Error message found: Code: [Select] Notice: Undefined index: user_name in D:\wamp\www\javascript\public\proc\login.php on line <i>9</i> HTTP Header input referer was set to 1 Error message found: Code: [Select] Notice: Undefined index: user_name in D:\wamp\www\javascript\public\proc\login.php on line <i>9</i> i dont know what they mean by HTTP header soo i cant fix this error .. help ? Hi all, I'm having a really strange problem. The application I've been developing isn't running ok on the server I got it hosted. Many select queries just didn't return any values, but on my computer everthing runs perfectly. I developed it using ZendStudio for Eclipse using Wampserver with PHP version 5.2.6., while the server runs the 5.1.6 version. I asked them many times to upgrade but they said it is not the problem. Before the last contact with the support, when I run the application with a PDO::FETCH_OBJ query, the page didn't returned any error message, just got blank. Now they activated some kind of error message service that reports all errors, but now it also reports errors that wasn't. For example, sometimes a page will pass a value like this: "page.php?v=true" and sometimes just not: "page.php". The code has a simple if: if(isset($_GET['v'])){ echo 'imagens/top_arearestrita.jpg'; } else ... Before this message service or on my computer it works fine, but on the server it gives this error: Notice: Undefined index: v in /var/www/html/www/intra/restrito.php on line 72 And it gives this errors for many a many lines, that before was working fine. What is that? Is there a way to activate a king of same service on my computer? And how do I can force a error message to be shown? Actually I use the code below, but it returns a black page: try{ ... }catch (Exception $ex){ echo "Erro: " .$ex->getMessage(); } Thankx Danilo Jr. Hi, I need a small help. Here is my situation. I am using a MVC application (e.g. Joomla or Drupal) which has a .htaccess redirect rule that all requests are passed through index.php file. That's normal and this is my main application. Now I installed another application within the application folder structure. What I want do do here is to allow opening the third party application URLs after one logged into my main application. Can anybody provide me some pointers to do the same? Please let me know if you need any further information on this. Any solution irrespective of framework will work. Thanks! Anupam I am building program to manage payment/monthly payments. I've ran into an issue that I haven't been able to overcome and need some help. I've been lurking for a while and decided it was time to ask you guys...Here's the issue: I have a table 'payments' that contains scheduled payments that looks like: id clientid paymentduedate balance expected pending 367 112233 4/16/2011 1030.00 257.50 Y 368 112233 5/16/2011 1030.00 257.50 Y 369 112233 6/16/2011 1030.00 257.50 Y 370 112233 7/16/2011 1030.00 257.50 Y What I need to do that I haven't figured out is to adjust the expected amount according to the payment, update the status to N (not pending) without affecting the later expected payments. For example: they make a payment of $257.50, applies that to row 367, sets the status to N, but leaves the other status' to Y (for obvious reasons). the make a payment of $250.00, leaving the balance at $7.50, so lets add $7.50 to row 368, mark 367 status to N the make a payment of $300.00, leaving the expected balance at $0.00 for row 367, but adjust the balance for row 368 to $215.00 Any ideas? Thanks I am urgently looking for a junior PHP web application developer with a portfolio of your code experience, no commercial experience will be considered to.
Please contact me to find out more!
Exciting opportunity for someone wanting to get a foot in the door in the world of IT!!
Hi all, this is my first time on this forum! I have a background with HTML and CSS but have recently started a Masters in Computer Science hoping to come out of it with the tools to get a job with PHP development. Our first assignment has somewhat 'thrown me in the deep end' as we have to construct a search engine that indexes the words of a number of documents and rank them using the TF*IDF algorithm along with the log rule associated with Information retrieval. I am completely new to PHP so the past week has been something of a crash course - This is the code I have so far: Code: [Select] <?php $filename = 'airlines.txt'; $fp = fopen( $filename, 'r' ); $file_contents = fread( $fp, filesize( $filename ) ); fclose( $fp ); //$new_contents = ereg_replace("[^A-Za-z0-9]", "", $file_contents); /*$file_contents = trim($file_contents); $file_contents = preg_replace('/\h+/', ' ', $file_contents); $file_contents = preg_replace('/\v{3,}/', PHP_EOL.PHP_EOL, $file_contents); */ $pat[0] = "/^\s+/"; $pat[1] = "/\s{2,}/"; $pat[2] = "/\s+\$/"; $rep[0] = ""; $rep[1] = " "; $rep[2] = ""; $new_contents = preg_replace("/[^A-Za-z0-9\s\s+]/","",$file_contents); $new_contents = preg_replace($pat,$rep,$new_contents); //preg_replace('~\s{2,}~', ' ', $text); $commonWords = array('a','able','about','above'........and another few hundreds cut out of this not to hurt your eyes!); $lines = explode ( "\n", $new_contents); $lines2 = implode (" ", $lines); $words = explode ( " ", $lines2 ); $useful_words = array_diff( $words, $commonWords ); /*for($i = 0; $i < count($lines); $i++) { echo "Piece $i = $lines[$i] <br />"; }*/ for($i = 0; $i < count($useful_words); $i++) { echo "Words $i = $useful_words[$i] <br />"; } //$arr=array("blah1","blah2","blah3"); file_put_contents("demo2.txt",implode(" ",$useful_words)); //$file_c = file_get_contents("demo.txt"); //$colms = explode(",",trim($file_c)); //print_r($colms); //echo $lines[2]; ?> I've got to the stage where that strips out most of the stop words when the final array is printed, but they have been replaced with spaces or something that I have not come acoss because as you may see I had a bit of trouble originally stripping the punctuation marks. I'm hoping someone can point me in the direction as to how to organise the words I have left after the stripping of stop words which are of no use during the search. I need to store those words into another array and index them which says how many times they appear in that document. I've come across the function array array_count_values ( array $input ) on the manual but I'm not sure about the best way to use it. I've attached the files I've used if that helps. Any help would be greatly appreciated! Hi, I need to develop a module called chat with doctor. User can able to chat with the doctor for that he has to pay some amount to website. Say example user got purchase the Package worth : 2$ =>5min. After 5 min chat will be closed , timer should be shown while chatting. How can we do this? There are ten list or bookmarks from Prof. Horner's Bible-Reading System found (http://www.facebook.com/group.php?gid=46416541831) each having set number of books from the Bible. One is to read ten chapters a day, one chapter from each of the bookmarks. Type in what day you are on and the program will show you on each of the lists as to what chapter you are suppose to be on. Also want to show statistics that will display how many times the Bible has been read with a break down of all 66 books of the Bible. Started a git respo http://github.com/Kutakizukari/Prof-Horners-Bible-Reading-System Bookmark list as follows: //List 1 $Matthew = 28; $Mark = 16; $Luke = 24; $John = 21; //List 2 $Genesis = 50; $Exodus = 40; $Levitieus = 27; $Numbers = 36; $Deuteronomy = 34; //List 3 $Romans = 16; $I_Corinthians = 16; $II_Corinthians = 13; $Galatians = 6; $Ephesians = 6; $Philipians = 4; $Colossians = 4; $Hebrews = 13; //List 4 $I_Thessalonians = 5; $II_Thessalonians = 3; $I_Timothy = 6; $II_Timothy = 4; $Titus = 3; $Philemon = 1; $James = 5; $I_Peter = 5 ; $II_Peter = 3 ; $I_John = 5; $II_John = 1; $III_John = 1; $Jude = 1; $Revelation = 22; //List 5 $Job = 42; $Ecclesiastes = 12; $Songs_of_Solomon = 8; //List 6 $Psalms = 150; //List 7 $Proverbs = 31; //List 8 $Joshua = 24; $Judges = 21; $Ruth = 4; $I_Samuel = 31; $II_Samuel = 24; $I_Kings = 22; $II_Kings = 25; $I_Chronicles = 29; $II_Chronicles = 36; $Ezra = 10; $Nehemiah = 13; $Esther = 10; //List 9 $Isaiah = 66; $Jeremiah = 52; $Lamentations = 5; $Ezekiel = 48; $Daniel = 12; $Hosea = 14; $Joel = 3; $Amos = 9; $Obadiah = 1; $Jonah = 4; $Micah = 7; $Nahum = 3; $Habakkuk = 3; $Zephaniah = 3; $Haggai = 2; $Zechariah = 14; $Malachi = 4; so on day 1 it should readout Matthew Chapter 1 Genesis Chapter 1 Romans Chapter 1 I Thessalonians Chapter 1 Job Chapter 1 Psalms Chapter 1 Proverbs Chapter 1 Joshua Chapter 1 Isaiah Chapter 1 Acts Chapter 1 on the second day it should all say Chapter two but Matthew reaches day 28 it should move on to Mark Chapter 1 and so on and so on and with each bookmark list. i got this application more then 10 years, all this years nothing happend, untill prev week, someone to lazzy to filled all the info required, but after submitting the form, their uncomplete info just being printed on the database. Which mean the required field code didnt work 2 all, all this year,.. what a dissapointment. Can someone take a look at my scripts and fixed please [attachment deleted by admin] I'm having a problem with passing the error checking in this script into the url. It's basically checking to see if the entry has a value and if doesn't give an error messaage. All the error messages (technically a error number to trigger the error message on the original page) should be combined into one array, and sent via the URL so the original page can get the information from the URL. All it produces right now is index.php?investors=register2&error=array. I thought serializing the array should stop that from happening. Code: [Select] <?php $host="localhost"; // Host name $username="username"; // Mysql username $password="password"; // Mysql password $db_name="db_name"; // Database name $tbl_name="application"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $error= array(); $name=$_POST['name']; $name = stripslashes($name); $name = mysql_real_escape_string($name); if(!isset($name)){ $error[0]=1; } $organization=$_POST['organization']; $organization = stripslashes($organization); $organization = mysql_real_escape_string($organization); $email=$_POST['email']; $email = stripslashes($email); $email = mysql_real_escape_string($email); if(!isset($email)){ $error[1]=1; } $area_code=$_POST['area_code']; $area_code = stripslashes($area_code); $area_code = mysql_real_escape_string($area_code); if(!isset($area_code) || is_int($area_code)){ $error[2]=1; } $phone3=$_POST['phone3']; $phone3 = stripslashes($phone3); $phone3 = mysql_real_escape_string($phone3); if(!isset($phone3) || is_int($phone3)){ $error[3]=1; } $phone4=$_POST['phone4']; $phone4 = stripslashes($phone4); $phone4 = mysql_real_escape_string($phone4); if(!isset($phone4) || is_int($phone4)){ $error[4]=1; } $ext=$_POST['ext']; $ext = stripslashes($ext); $ext = mysql_real_escape_string($ext); $phone="(".$area_code.") ".$phone3." - ".$phone4." Ext. ".$ext.""; $company_description=$_POST['company_description']; $company_description = stripslashes($company_description); $company_description = mysql_real_escape_string($company_description); $nature_inquiry=$_POST['nature_inquiry']; $nature_inquiry = stripslashes($nature_inquiry); $nature_inquiry = mysql_real_escape_string($nature_inquiry); if(!isset($nature_inquiry)){ $error[5]=1; } $company_assets=$_POST['company_assets']; $natural_person=$_POST['natural_person']; $employee_benefit_plan=$_POST['employee_benefit_plan']; $bank_savings=$_POST['bank_savings']; $broker_dealer=$_POST['broker_dealer']; $development_company=$_POST['development_company']; $equity_owners=$_POST['equity_owners']; $confirm_agreement=$_POST['confirm_agreement']; if($confirm_agreement=="no"){ $error[6]=1; } if($employee_benefit_plan=="plan-fiduciary"){ $employee_benefit_plan="The investment decision is being made by a plan fiduciary, as defined in Section 3(21) of ERISA, which is either a bank, savings and loan association, insurance company or registered investment adviser"; } elseif($employee_benefit_plan=="participant-directed"){ $employee_benefit_plan="It is a participant-directed plan (i.e., a tax-qualified defined contribution plan in which a participant may exercise control over the investment of assets credited to his or her account and the decision to invest is made by those participants investing) and each such participant qualifies as an accredited investor."; } elseif($employee_benefit_plan=="na"){ $employee_benefit_plan="Neither of the Above."; } if(isset($error)){ rawurlencode(serialize($error)); header("Location: ./index.php?investors=register2&error=".$error.""); } else{ $sql="INSERT INTO $tbl_name VALUES ('$name', '$organization', '$email', '$phone', '$company_description', '$nature_inquiry', '$company_assets', '$natural_person', '$employee_benefit_plan', '$bank_savings', '$broker_dealer', '$development_company', '$equity_owners', '$confirm_agreement')"; mysql_query($sql); } ?> Hi, I'm working on a project which was going pretty well until I discovered the application doesn't actually know where it is installed. So far when I want to include the config file I just use $_SERVER['DOCUMENT_ROOT'].'/config.php';() Which works fine if the application is installed in the root directory. But how do I get the folder the application is installed in? e.g. Document Root Folder: C:\Web\ Actually Application Folder: C:\Web\MyApp\ How do I get the \MyApp dynamically? I can't just use './' all the time because I have files accessed by AJAX stored in other folders. Thanks in advance. I am looking to save the user's access of an application. For instance, when they log in, I create a record in the "track_login" table which includes information such as the requesting IP, the user's ID, the date, (not the user's password), etc. And then for every page they visit, I store a record in the "track_page_viewed" table which includes a FK to the "track_login" table and also includes additional information about their request.
Both the track_login and track_page_viewed tables are currently in the same database as used by the primary application.
So far, so good.
Next, I want to start tracking when a user does special tasks such as when they forget their password and request that a new one be emailed to them. Or maybe when they attempt to login with an invalid username and password. Currently, I just included another table called "track_special" which includes the data, the type of special request, etc.
Now, I am thinking of adding three other things to track:
General PHP errors
MySQL errors
Try/Catch errors which I did not expect to happen
One option is just to add these to my "track_special" table or maybe make one or three new tables in the same database.
But is this a good idea? If I have a SQL error, do I really want to store the error in the same database? Maybe I should use a separate database called "myTrackerDB", and include all the above tables in that database? Or maybe I should just write the data to a flat file, and parse the file on a regular basis, and then store the information in the database?
Please provide any recommendations, guidance, suggestions, criticism, etc. Thank you
Hello php gurus,...i need some help here for my php online quiz application. I am doing an online quiz application,where at first a tutor will enter the question and selection of answers,and following by the correct answer through a form. Code: [Select] <html> <body> <form action="insert.php" method="post"> <p>Question: <input type="text" name="Q" /> </p ><p>Answer1: <input type="text" name="A" /> </p> <p>Answer2: <input type="text" name="B" /> </p> <p>Correct Answer: <input type="text" name="ans" /> </p> <p> <input type="submit" /> </p> </form> </body> </html> All the details will be sent to mysql database,and the database structure will be like this : Quote Question AnswerA AnswerB CorrectAnswer 1+1 2 4 A 2+3 6 5 B After that,i have created a php codes to retrieve the Questions from database,and display it in webpage,and the AnswerA and AnswerB will be shown in radio button.So users can choose the answer using radio button... My problem is,i don't know how to compare the 'value' in radio button with the 'CorrectAnswer' in the database,to know the correct answer. And also don't have idea how to calculate the correct answer and getting the results. So,if anyone could help me..i will be really gratefull... Hope can get the solution....plss help me Thank you very much I have attached my documents here... [attachment deleted by admin] here is the address http://bancorpfunding.com/contact-form.html either view source or look at code below How do i get the action to send to email without writing a message This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314459.0 Hello, I'm working on a project and at some point ill need to save user specific settings ex: show/hide email etc... configuration file is not the case i thin because there are specific to every user, database will be the choice but what practice(logic) is the best to save these settings? Thank you! My application has 3 user types. Admin , User and Super Admin. Users can register as either Admin or User. Each user type has different UI and functionality. The problem: If a particular type of user reports a problem/bug in his/her login, it is difficult to pin point to the exact problem. So if I could able to login as that user, then it will be very easy to point out the bug/problem. So I'm looking for some kind of master password. Using any username and the master password I should be able to login AS that user. Any suggestions..? My game on facebook is being displayed in the facebook application iframe. When users register in firefox or google chrome everything is fine and to a certain extent in IE as well. However, when logging into the game, through the browsers the game loads fine except when loaded in IE.... Basically i am using a session to state that the game is currently in facebook mode: Code: [Select] <?php session_start(); $_SESSION['isface'] = 1; include("game.php"); ?> All is good until it hits this code: Code: [Select] <html> <frameset cols="130" noresize border=0> <frame src="nav.php" name="nav"> <frame src="hq.php" name="main"> </frameset> </html> The frames then output error message: Code: [Select] <?php if ($isface !="1") { if (sha1($info[4]) != $pass) { mysql_close(); echo $isface; die("<br><br><center><body bgcolor='#000000'><b><font color='#FFFFFF' face='Verdana' size='2pt'>{$isface} Your username cannot be found or password doesnt match</font></b></center></body></html>"); } } ?> essentially the game is using cookies for authentication on the main site, but since this is facebook this is not needed so it SHOULD skip this check and proceed with using the facebook details as the login. this is only happening in IE... i dont get it. any ideas? |