Tylor Eddy Posted September 14, 2012 Report Share Posted September 14, 2012 G'day Guys, I am creating a popout login page, this page requires the form in a HTML document which is fine, but is there a way of calling a particular file to integrate the HTML document with my site, currently none of the php for the login form is working as its not a tpl file and im presuming the sites functions require a particular file to be called within the HTML document for any of the php to become effective. Anyone know how i can go about getting this to work ? Regards Tylor Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 17, 2012 Author Report Share Posted September 17, 2012 G'day Guys, I've been looking into the documentation and in order to get the website functions to work i need to call codon.config.php into the document. Basically i want to call the login form from a .html document instead of a .tpl so it will be compatible with my popout login box. Currently i have this but i am not doing something right, so a nudge in the right direction would be handy right now <head> <script> include '/core/codon.config.php'; // You can then access the API normally from here </script> </head> <form name="loginform" action="<?php echo url('/login'); ?>" method="post"> Sign-in with your pilot id or email, or <a href="<?php echo url('/registration'); ?>">register</a><br /> <input type="text" name="email" value="" onclick="this.value=''" /> <input type="password" name="password" value="" /> <input type="hidden" name="remember" value="on" /> <input type="hidden" name="redir" value="index.php/profile" /> <input type="hidden" name="action" value="login" /> <input type="submit" name="submit" value="Log In" /> </form> <script type="text/javascript"> $("#loginform").submit(function(ev) { if ($("#username").val() == "" | $("#password").val() == "") { $.lightbox().shake(); ev.preventDefault(); } }); </script> This is the error i recieve when trying to submit the form. Forbidden You don't have permission to access /< on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 18, 2012 Report Share Posted September 18, 2012 include '/core/codon.config.php'; Needs to be wrapped in PHP tags for starters mate. First, not everyone has Javascript turned on, second it just wouldn't work. So you need to call it like this: <?php include '/core/codon.config.php'; ?> 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 19, 2012 Author Report Share Posted September 19, 2012 G'day Paul, Just gave it a shot and i still receive the forbidden error when trying to login through the HTML file, should i be able to use a HTML file to login provided i include the website API ? Tylor What im attempting to do is have a popout login form, which is run by jquery. Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 19, 2012 Report Share Posted September 19, 2012 No, the included file should be a PHP in this case, unless you've got it to where you're including a phpvms .tpl file, which will run PHP if it enclosed in the correct PHP tags. 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 20, 2012 Author Report Share Posted September 20, 2012 Makes Perfect sense, Thanks for your help Paul much appreciated Quote Link to comment Share on other sites More sharing options...
RogerB Posted September 20, 2012 Report Share Posted September 20, 2012 include '/core/codon.config.php'; Needs to be wrapped in PHP tags for starters mate. First, not everyone has Javascript turned on, second it just wouldn't work. So you need to call it like this: <?php include '/core/codon.config.php'; ?> I tried this in HTML and it didn't work, you must name the files .php 1 Quote Link to comment Share on other sites More sharing options...
RogerB Posted September 20, 2012 Report Share Posted September 20, 2012 If you downloaded a custom login form merly copy and paste the whole document where you want it to appear. You also need to have the jquery script somewhere on your site if it requires the use of Jquery. 1 Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 20, 2012 Report Share Posted September 20, 2012 I tried this in HTML and it didn't work, you must name the files .php Agreed, per 2 posts up. 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 21, 2012 Author Report Share Posted September 21, 2012 The form itself is still the stock phpvms login form which i placed into a html file. What i tried to do was use the HTML file which is used by the lightbox module to display the login form inside this module ( the module is this one here: http://codecanyon.ne...volution/115655). I can view the form fine, but the php functions wont work and now i know why. My delema now is working out how to modify that module to accept a .tpl or .php file to get the form to work correctly. i'm presuming theres no way to manipulate the login form to not require the need for php ? Also would something like this work ? http://www.zubrag.com/forum/index.php?topic=61.0 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 23, 2012 Author Report Share Posted September 23, 2012 Ok i have found out that i can in fact use a .php file with this lightbox module, and i've tried calling the form with php but im not quite sure on the correct syntax for this. Here is what i have <head> <script> <?php include '/core/codon.config.php'; ?> // You can then access the API normally from here </script> </head> <body> <?php { echo '<form name="loginform" action="<?php echo url('/login'); ?>" method="post">'; echo 'Sign-in with your pilot id or email, or <a href="<?php echo url('/registration'); ?>">register</a><br />'; echo '<input type="text" name="email" value="" onclick="this.value=''" />'; echo '<input type="password" name="password" value="" />'; echo '<input type="hidden" name="remember" value="on" />'; echo '<input type="hidden" name="redir" value="index.php/profile" />'; echo '<input type="hidden" name="action" value="login" />'; echo '<input type="submit" name="submit" value="Log In" />'; echo '</form>'; } ?> </body> how can i display my form with php? any help would be great, im useless with php haha, but i'll learn it one day This is the error it throws Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/qantasvi/public_html/newsite/lib/skins/qantasvi/pilot-login.php on line 14 Tylor Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 23, 2012 Report Share Posted September 23, 2012 Tylor, first the best advice I can give it to google the error PHP gives you. The PHP manual is very well-written and you can 9 times out of 10 find your own solution by doing so. It also helps you learn the basic of PHP by debugging code. Anyway, I have commented what I did to clean you up, take a look at the differences and it'll help you understand. This isn't 100% sure to run with your script, but it is clean code as far as I can tell. <head> <?php //No need for script tags around PHP. include '/core/codon.config.php'; ?> </head> <body> <?php { // You needed to escape a bunch of single quotes and remove the PHP calls within the PHP. You were echo'ing within an echo statement. echo '<form name="loginform" action="/login" method="post">'; echo 'Sign-in with your pilot id or email, or <a href="/registration">register</a><br />'; // You need to use the backslash to "escape" the single quotes in the onclick function. echo '<input type="text" name="email" value="" onclick="this.value=\'\'" />'; echo '<input type="password" name="password" value="" />'; echo '<input type="hidden" name="remember" value="on" />'; echo '<input type="hidden" name="redir" value="index.php/profile" />'; echo '<input type="hidden" name="action" value="login" />'; echo '<input type="submit" name="submit" value="Log In" />'; echo '</form>'; } ?> </body> 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 24, 2012 Author Report Share Posted September 24, 2012 Thanks for your support Paul, and the including the corrections for the mistakes i made, very handy. now i'm recieving a codon.config related error. This is what im getting Warning: include(/core/codon.config.php) [function.include]: failed to open stream: No such file or directory in /home/qantasvi/public_html/newsite/lib/skins/qantasvi/pilot-login.php on line 4 Warning: include() [function.include]: Failed opening '/core/codon.config.php' for inclusion (include_path='.:/usr/lib/php') in /home/qantasvi/public_html/newsite/lib/skins/qantasvi/pilot-login.php on line 4 I've tried adding a full directory but that isn't co-operating. Other than that the form is displaying, so we're almost there! Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 24, 2012 Report Share Posted September 24, 2012 OK, so when you read that error, you can see it is telling you something is missing and the offending referral link is on line 4 and it's called 'core/codon.config.php'. So what that's saying, is that the path to codon.config.php is incorrect. Within phpvms, you can create a link back to the top directory of your site using SITE_URL. This is defined within the local.config.php file, but typically it would direct you to the root folder of your installation. So when you have links that point to something way outside your skin folder, use that to create links that will work. In this case, it won't work because you're using a PHP file, not a template within the MVC structure. So a better solution overall is to create a custom module and call it through a template. But that's beyond what I'm explaining. This will get you up and running, change line 4 to read: include $_SERVER['DOCUMENT_ROOT'].'newsite/core/codon.config.php'; But when you move this to the root URL of the website, you'll need to remember to take away "newsite". Having said that, there is a way that s 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 25, 2012 Author Report Share Posted September 25, 2012 G'day Paul, Thanks for the help setting up the URL directory for the codon.config file, i now have no errors displaying on the lightbox module itself and the form is displaying normally. My issue now is when i went to test the form in an attempt to login, i am presented with this error. Not Found The requested URL /login was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Any Idea's on this one ? Tylor Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 25, 2012 Report Share Posted September 25, 2012 Tylor, same as before, a link isn't correct. In this case, it's the form handler. It's looking for index.php/login. echo '<form name="loginform" action="/login" method="post">'; I don't have time to help much today, sorry. So you'll need to figure out how to get it linked to the base_url/index.php/login. 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 26, 2012 Author Report Share Posted September 26, 2012 G'day Paul, linking that to index.php/login wouldn't be correct would it? seeing as thats the directory to the login page. Tylor Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 26, 2012 Report Share Posted September 26, 2012 You could try, if it works it works. If it doesn't, you might have to try $_SERVER['DOCUMENT_ROOT'] in front of the URI. Like this: require ($_SERVER['DOCUMENT_ROOT']."/core/codon.config.php"); That worked in my test environment from a PHP file located in a skin folder, "lib/skin/testskin". 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 27, 2012 Author Report Share Posted September 27, 2012 G'day Paul, Thats working fine, when attempting to login itself it throws the 404 error, like below Not Found The requested URL /login was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Thats not related to the codon.config file is it ? This was using the code you provided above to call on the codon.config file. If you'd like i'll PM you the link to my site in development and you can take a look at it if it helps. I was just thinking a little further about this issue, could it involved login.php within the core/modules/login folder ? or does codon.config.php overide the need for this ? Regards Tylor Quote Link to comment Share on other sites More sharing options...
tutmeister Posted September 28, 2012 Report Share Posted September 28, 2012 No it should be just the way the URI's are formed. Because you're changing the location it is normally called from, the default paths require changing. So you just need to add the /index.php to the front of them. On your website, it seems you have deleted or renamed the registration module, so it doesn't work, but the below code works fine in my test environment with a default phpvms. <head> <?php include '/core/codon.config.php'; ?> </head> <body> <?php { echo '<form name="loginform" action="/index.php/login" method="post">'; echo 'Sign-in with your pilot id or email, or <a href="/index.php/registration">register</a><br />'; echo '<input type="text" name="email" value="" onclick="this.value=\'\'" />'; echo '<input type="password" name="password" value="" />'; echo '<input type="hidden" name="remember" value="on" />'; echo '<input type="hidden" name="redir" value="/index.php/profile" />'; echo '<input type="hidden" name="action" value="login" />'; echo '<input type="submit" name="submit" value="Log In" />'; echo '</form>'; } ?> </body> 1 Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted September 28, 2012 Author Report Share Posted September 28, 2012 Thank you so so much Paul!, Problem Solved 1 Quote Link to comment Share on other sites More sharing options...
RogerB Posted October 2, 2012 Report Share Posted October 2, 2012 Very nice site Tylor Quote Link to comment Share on other sites More sharing options...
Tylor Eddy Posted October 3, 2012 Author Report Share Posted October 3, 2012 Thanks Roger, i look forward to presenting it to you all once the it's completed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.