Server Help

Trash Talk - Help with PHP

Contempt+ - Mon Sep 19, 2005 8:58 pm
Post subject: Help with PHP
I know this might piss some of you off, but I've got another question.

I've seen on a couple of other sites, and I've been wanting to do it to mine for a while, but some sites have a login for their phpBB forums on their home page, where it logs you into the forums. I was wondering if anyone knew the "action='link' ".

I've tried a few things, and none work. Would anyone be able to point me in some direction?
CypherJF - Mon Sep 19, 2005 9:47 pm
Post subject:
$_GET['action'].. remember to "sanatize" ANY user input; especially when dealing with SQL strings.
Maverick - Tue Sep 20, 2005 5:46 am
Post subject:
huh?

index.php?action=login ?
Contempt+ - Tue Sep 20, 2005 6:48 pm
Post subject:
I understand what Cypher is saying, at least 90%.. But I don't understand what you're trying to say Mav.

So I have to use $_GET['action'] in my /index.htm, or in the /forums/index.php? /forums/index.php, right?
Pests - Tue Sep 20, 2005 8:10 pm
Post subject:
Im assuming you want a form to log you into a phpbb forum on your homepage.

Taking a look at the html for the login box on these forums:

Quote:

<form action="login.php" method="post" target="_top">

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" class="nav"><a href="index.php" class="nav">Server Help Forum Index</a></td>
</tr>
</table>

<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">
<tr>
<th height="25" class="thHead" nowrap="nowrap">Please enter your username and password to login</th>
</tr>
<tr>
<td class="row1"><table border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<td colspan="2" align="center"> </td>

</tr>
<tr>
<td width="45%" align="right"><span class="gen">Username:</span></td>
<td>
<input type="text" name="username" size="25" maxlength="40" value="" />
</td>
</tr>
<tr>

<td align="right"><span class="gen">Password:</span></td>
<td>
<input type="password" name="password" size="25" maxlength="25" />
</td>
</tr>
<tr align="center">
<td colspan="2"><span class="gen">Log me on automatically each visit: <input type="checkbox" name="autologin" /></span></td>
</tr>

<tr align="center">
<td colspan="2"><input type="hidden" name="redirect" value="" /><input type="submit" name="login" class="mainoption" value="Login" /></td>
</tr>
<tr align="center">
<td colspan="2"><span class="gensmall"><a href="profile.php?mode=sendpassword" class="gensmall">I forgot my password</a></span></td>
</tr>
</table></td>
</tr>

</table>

</form>


The importaint parts are in bold and they are all that we need, so were left with:

Quote:


<form action="login.php" method="post" target="_top">

<input type="text" name="username" size="25" maxlength="40" value="" />

<input type="password" name="password" size="25" maxlength="25" />

Log me on automatically each visit: <input type="checkbox" name="autologin" />

<input type="hidden" name="redirect" value="" />

<input type="submit" name="login" class="mainoption" value="Login" />

</form>


But we still need to change some things:

Quote:


<form action="login.php" method="post" target="_top">

Username: <input type="text" name="username" size="25" maxlength="40" value="" />

Password: <input type="password" name="password" size="25" maxlength="25" />

Log me on automatically each visit: <input type="checkbox" name="autologin" />

<input type="hidden" name="redirect" value="***" />

<input type="submit" name="login" class="mainoption" value="Login" />

</form>


Blue
This needs to be changed to the location of your forums login.php file. Either a absolute url such as "http://www.example.com/phpbb/login.php" or a relative url such as "forums/login.php"


Green
This redirects the user to a page after they have logged in. If left blank the user is sent to the forum index after logging in. If you supply a url here then after the user has logged in they will be redirected back to this page.

I'm not sure if the green value can be an absolute url, might need to be relative. The *** I placed in the last example is just so you can see the color. If you want them to redirect to the main forum page remove those and replace with nothing.


Hope this is what you want. You would still need to format it and everything to your liking.
Contempt+ - Tue Sep 20, 2005 9:10 pm
Post subject:
Ok, I tried something like that before, I just didn't have the redirects. I'll try it again and see what happens.
Contempt+ - Tue Sep 20, 2005 9:18 pm
Post subject:
Ok, I tried that, but it didn't work. I had a feeling that there was some more work to be done than that.

Thanks for trying though pests.

I'll look around on the login.php page and see what I can find. More help would be appreciated.
Pests - Tue Sep 20, 2005 10:09 pm
Post subject:
That works if done correctly. Show me your html.
Contempt+ - Tue Sep 20, 2005 10:29 pm
Post subject:
Code: Show/Hide
<form action="/forums/login.php" method="post"><FONT face=Verdana><b>
                  <font size="1" face="Verdana">Forums Login Here</font></b>
                  <FONT face=Verdana size=2><BR><BR></FONT>
                  <font size="1"><b>Username: <br> </b></font>
                  <INPUT class=form maxLength=35 size=19 name=q><BR>
                  <font size="1"><b>Password: <br></b></font>
                  <INPUT class=form type = "password" maxLength=35 size=19 name=q1><BR>
        <input type="hidden" name="redirect" value="">
</FONT> <FONT face=Verdana><INPUT class=form type=submit value="Login"><BR><INPUT
                  name=s type=hidden value=SS></FONT><font size="1" face="Verdana"><b></b></font></FORM>

Donkano - Tue Sep 20, 2005 11:08 pm
Post subject:
Contempt+ wrote:
Code: Show/Hide
<form action="/forums/login.php" method="post"><FONT face=Verdana><b>
                  <font size="1" face="Verdana">Forums Login Here</font></b>
                  <FONT face=Verdana size=2><BR><BR></FONT>
                  <font size="1"><b>Username: <br> </b></font>
                  <INPUT class=form maxLength=35 size=19 name=q><BR>
                  <font size="1"><b>Password: <br></b></font>
                  <INPUT class=form type = "password" maxLength=35 size=19 name=q1><BR>
        <input type="hidden" name="redirect" value="">
</FONT> <FONT face=Verdana><INPUT class=form type=submit value="Login"><BR><INPUT
                  name=s type=hidden value=SS></FONT><font size="1" face="Verdana"><b></b></font></FORM>


Try:

Code: Show/Hide
<form action="/forums/login.php" method="post" enctype="multipart/form-data">
<font size="1" face="Verdana"><b>Forums Login Here<br><br>
Username:<br><input class="form" type="text" maxlength="35" size="19" name="q"><br>
Password:<br><input class="form" type="password" maxLength="35" size="19" name="q1"><br>
<input type="hidden" name="redirect" value="">
<input class="form" type="submit" value="Login"><br>
<input name="s" type="hidden" value="SS"></b></font>
</form>


I cleaned some stuff up on it and may clerify things.
Contempt+ - Tue Sep 20, 2005 11:35 pm
Post subject:
Tried that too, didn't work.. MGB, you should know how to do this, right? Oh, and is IPB coded in php? If so, Syrus might know this.
Purge - Tue Sep 20, 2005 11:37 pm
Post subject:
Most of the popular forums like IPB and PHPbb are done in PHP.
Solo Ace - Wed Sep 21, 2005 2:23 am
Post subject:
Heh, Cypher, I always satanize my input, look through these forums and you'll see.

Tell us, next to the fact that "it doesn't work", what doesn't work, exactly.
What kind of error are you getting? Which problems is it giving you?

Don't change the forums' code, your single index.html should be enough.

How can you still have issues with silly things like these? You've been doing stuff like this for several weeks, and you're still asking...
Contempt+ wrote:
So I have to use $_GET['action'] in my /index.htm, or in the /forums/index.php? /forums/index.php, right?


It may just be a simple path problem.
Contempt+ - Wed Sep 21, 2005 1:45 pm
Post subject:
First off, I haven't been doing things like this for several weeks. I jump around between php, c++, java, html, ect.

When I put in what Don gave me, and I have the redirect in, it just sends me to the /forums/login.php page without logging me in.
Mine GO BOOM - Wed Sep 21, 2005 1:59 pm
Post subject:
Want to try posting your homepage and a link to your forums? The homepage link in your profile goes to a non-existing domain.
Donkano - Wed Sep 21, 2005 4:02 pm
Post subject:
Contempt+ wrote:
First off, I haven't been doing things like this for several weeks. I jump around between php, c++, java, html, ect.

When I put in what Don gave me, and I have the redirect in, it just sends me to the /forums/login.php page without logging me in.


I gave you nothing but the enctype="multipart/form-data" the other stuff was useless so I just right out removed it.
Contempt+ - Wed Sep 21, 2005 7:44 pm
Post subject:
http://www.contempt.ssihosting.com/test is the page that I'm trying to get the login to work. It's just a template that I grabbed off the internet, I'm designing a new page now.

the forums are:
http://www.contempt.ssihosting.com/forums/index.php
Solo Ace - Wed Sep 21, 2005 8:01 pm
Post subject:
Stupid how nobody (yeah, I didn't see it either, until just now) noticed how the names for the login fields aren't matching those on the real phpBB login pages.
Contempt+ - Wed Sep 21, 2005 8:33 pm
Post subject:
Hey, Solo helped me out, and we got it working. Had a few errors in the form. Also thanks to the others that helped.
Pests - Thu Sep 22, 2005 3:28 pm
Post subject:
Solo Ace wrote:
Stupid how nobody (yeah, I didn't see it either, until just now) noticed how the names for the login fields aren't matching those on the real phpBB login pages.


Talking about the code he posted? Yeah, I just noticed it too.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group