PHP - Allow Third Party Application From Other Mvc Based Application
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 Similar TutorialsHello there, I'm quite new on PHP language.I'm trying to make an simple Phone book apps.I added insert & show options in Phone book.Now i want to add "update & delete" option.How can i do that. This is add code: Code: [Select] <?php mysql_connect("localhost","admin",""); mysql_select_db("simphp"); //Get Values from form $name=$_POST['name']; $email=$_POST['email']; $number=$_POST['number']; mysql_query("insert into phonebook(name,email,number) values('$name','$email','$number')"); echo"Saved Sucessfully"; echo "<br/>"; echo '<a href="index.php/">Homepage</a>'; echo "<br/>"; echo '<a href="select.php/">Show Data</a>'; echo "<br/>"; echo '<a href=update.php>Update</a>'; mysql_close(); ?>Show.php=>> Code: [Select] <?php mysql_connect("localhost","admin",""); mysql_select_db("simphp"); $query="select *from phonebook"; $result=mysql_query($query); $num=mysql_numrows($result); echo"Number of records Stored:$num"; $i=0; while($i<$num) { $name=mysql_result($result,$i,"Name"); $email=mysql_result($result,$i,"Email"); $number=mysql_result($result,$i,"number"); echo "<br/>"; echo "Name :<b> $name </b><br/>"; echo "<br/>"; echo "Email : <b>$email</b> <br/>"; echo "<br/>"; echo "Phone :<b>$number</b><br/>"; echo '<a href=update.php>Update</a>'; $i++; } ?> How can i update and delete data?? :confused:help me I am new to PHP. I have been trying to do some research online for a few days and not getting very far. I feel like I know less now than I did before I started. Here's the story: I've set up a LAMP server that runs a Wiki and AppGini (http://www.bigprof.com/appgini/) - AppGini allows you to "Create web database applications instantly without writing any code" - The only downside we have with it, is it's got it's own set of user accounts. My team all logs in with the default admin account which isn't a big deal but we'd prefer to use LDAP to AD for reasons I won't get into right now. I emailed AppGini support and asked about LDAP integration. Their response was that it's "a little bit of work" and "You can modify the login authentication function to authenticate using LDAP ... please see the example code he http://code.activestate.com/recipes/101525-ldap-authentication/ (needs some modifications to work with AppGini)" I've googled around and found 2 dozen different LDAP PHP samples. I've gotten some of them to work. By work I mean they connect to my domain controller and say "success" I'm not actually logged into anything. So I'm looking for a little help from square one. I need to have a better understanding of how things are supposed to work so I know where I'm supposed to go with all of this. Where do I start? What do I do? What would YOU do? This is the current "index.php" that logs you into the site. Code: [Select] <?php error_reporting(E_ALL ^ E_NOTICE); $d=dirname(__FILE__); include("$d/defaultLang.php"); include("$d/language.php"); include("$d/incCommon.php"); $x->TableTitle=$Translation['homepage']; include("$d/header.php"); if($_GET['signOut']==1){ logOutMember(); } $tablesPerRow=2; $arrTables=getTableList(); ?> <div align="center"><table cellpadding="8"> <?php if($_GET['loginFailed']==1 || $_GET['signIn']==1){ ?> <tr><td colspan="2" align="center"> <?php if($_GET['loginFailed']){ ?> <div class="Error"><?php echo $Translation['login failed']; ?></div> <?php } ?> <form method="post" action="index.php"> <table border="0" cellspacing="1" cellpadding="4" align="center"> <tr> <td colspan="2" class="TableHeader"> <div class="TableTitle"><?php echo $Translation['sign in here']; ?></div> </td> </tr> <tr> <td align="right" class="TableHeader"> <?php echo $Translation['username']; ?> </td> <td align="left" class="TableBody"> <input type="text" name="username" value="" size="20" class="TextBox"> </td> </tr> <tr> <td align="right" class="TableHeader"> <?php echo $Translation['password']; ?> </td> <td align="left" class="TableBody"> <input type="password" name="password" value="" size="20"class="TextBox"> </td> </tr> <tr> <td colspan="2" align="right" class="TableHeader"> <span style="margin: 0 20px;"><input type="checkbox" name="rememberMe" id="rememberMe" value="1"> <label for="rememberMe"><?php echo $Translation['remember me']; ?></label></span> <input type="submit" name="signIn" value="<?php echo $Translation['sign in']; ?>"> </td> </tr> <tr> <td colspan="2" align="left" class="TableHeader"> <?php echo $Translation['go to signup']; ?> <br /><br /> </td> </tr> <tr> <td colspan="2" align="left" class="TableHeader"> <?php echo $Translation['forgot password']; ?> <br /><br /> </td> </tr> <tr> <td colspan="2" align="left" class="TableHeader"> <?php echo $Translation['browse as guest']; ?> <br /><br /> </td> </tr> </table> </form> <script>document.getElementsByName('username')[0].focus();</script> </td></tr> <?php } ?> <?php if(!$_GET['signIn'] && !$_GET['loginFailed']){ if(is_array($arrTables)){ if(getLoggedAdmin()){ ?><tr><td colspan="<?php echo ($tablesPerRow*3-1); ?>" class="TableTitle" style="text-align: center;"><a href="admin/"><img src=table.gif border=0 align="top"></a> <a href="admin/" class="TableTitle" style="color: red;"><?php echo $Translation['admin area']; ?></a><br /><br /></td></tr><?php } $i=0; foreach($arrTables as $tn=>$tc){ $tChk=array_search($tn, array()); if($tChk!==false && $tChk!==null){ $searchFirst='?Filter_x=1'; }else{ $searchFirst=''; } if(!$i % $tablesPerRow){ echo '<tr>'; } ?><td valign="top"><a href=<?php echo $tn; ?>_view.php<?php echo $searchFirst; ?>><img src=<?php echo $tc[2];?> border=0></a></td><td valign="top" align="left"><a href=<?php echo $tn; ?>_view.php<?php echo $searchFirst; ?> class="TableTitle"><?php echo $tc[0]; ?></a><br /><?php echo $tc[1]; ?></td><?php if($i % $tablesPerRow == ($tablesPerRow - 1)){ echo '</tr>'; }else{ echo '<td width="50"> </td>'; } $i++; } }else{ ?><tr><td><div class="Error"><?php echo $Translation['no table access']; ?><script language="javaScript">setInterval("window.location='index.php?signOut=1'", 2000);</script></div></td></tr><?php } } ?> </table><br /><br /><div class="TableFooter"><b><a href=http://bigprof.com/appgini/>BigProf Software</a> - <?php echo $Translation['powered by']; ?> AppGini 4.61</b></div> </div> </html> 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. 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)); 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! 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] 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? 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 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] I've been developing an application for some time now. It's come to the point to populate the database with accurate information. I've been searching for a list of City, State, Zip, Long & Lat for each. How can I find something like this? I see tons of them for sale, 79 bucks or so, but I don't want to pay. How do most of these people get their data? Thank you 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 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, 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! So I have an webapp which has a built in proxy checker. However because I didn't write the code I am kind of confused on whats going on. I have a small amount of knowledge on php been looking all over the net to find a solution. So this file called (proxy_check.php) keeps causing my index.php to show the 404 designed page. The file is required in the index.php file. I believe its something to do with the $reponse variable. Please help <?php # Visitor proxy check snippet $v_ip = $_SERVER['REMOTE_ADDR']; $arContext['http']['timeout'] = 10; $context = stream_context_create($arContext); $response = file_get_contents('http://www.shroomery.org/ythan/proxycheck.php?ip='.$v_ip, 0, $context); if ('Y' === $response) { echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'> <head> <title> The page you were looking for doesn't exist (THIS BUG)</title> <style type='text/css'> body { background-color: #efefef; color: #333; font-family: Georgia,Palatino,'Book Antiqua',serif;padding:0;margin:0;text-align:center; } p {font-style:italic;} div.dialog { width: 490px; margin: 4em auto 0 auto; } img { border:none; } </style> </head> <body> <div class='dialog'> <a><img src='assets/img/404.png'></a> <p>It looks like that page you were looking has been mislaid, sorry.</p> </div> </body> </html>"; die(); }
Would it be possible to create a passive socket server using php, for a client-server php app, that runs as some sort of daemon? I understand that you probably can't understand much of what I mean, but I hope you understand enough to help me in some way. PHP APPLICATION - > APPLICATION SERVER - > DATABASE(S) Explanation: Each instance of the PHP application would connect to the "Application Server" and use it to fetch information and perform some commands. Could this be done using sockets ? Simple examples would help Thank You! 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? |