...

View Full Version : Quick and easy PHP questions.



Murdok09
05-06-2008, 02:46 AM
Okay, I'm fairly ignorant with php and mySQL, and I apologize. Here's what I don't understand.

http://www.evolt.org/PHP-Login-System-with-Admin-Features

I'm using that, and it says "hey, just cut and paste/mod this and you are good". I have the tables made in my database, but I don't know where to put the .php files and what I need to do.

I am done with the first section of code, and I am stuck on the second. Any suggestions?

tomws
05-06-2008, 02:59 AM
It also says it's for intermediate to advanced PHPers, which explains they brevity of the documentation.

You do have a web server up and running, yes? Apologies if that seems like a stupid question, but some think that only code is enough.

The easiest situation would be that all you do is drop all the files in your web root. However, I glanced through and found at least one file that includes one of the others from a subdirectory (include "includes/whatever.php"). You ought to be able to determine what the implied directory structure is by looking at those includes. Any of the format include "filename.php" should all be in the same directory. Any with paths, create appropriately.

Murdok09
05-06-2008, 11:01 AM
I have a server, a host, and a mySQL server. I downloaded the entire tutorial and I came pre-ordered in folders including "includes", "variables", etc. Can I assume it is in order? If so, I'll just log into my server via FTP, and drop everything to the main part, no dropping in public_html, private_html, www, right?

idalatob
05-06-2008, 12:21 PM
Goodness me, I see where your problem lies. Sometimes the method of setting up a website is what a lot of people struggle with.

It's really difficult to explain procedure as opposed to explaining snippets of code. I suggest you take a deep breathe, backup your website and start experimenting.

Normally you would upload the module to the public_html folder on your webserver.

Good luck.

Murdok09
05-07-2008, 11:17 AM
Take a look at my site now. I inserted the PHP scripts as they were grouped in the public_html folder. I tried to insert the <? include "sessions.php" ?> into my HTML, but it would not stay. Every time, for some reason it "disappears". Any ideas? I'm only taking the code from one of the PHP files that says "this is the main table to use" and inserting the <? ___ ?> and <table>___</table>

tomws
05-07-2008, 01:05 PM
If by "disappears" you mean you can't see it with a View Source, that's expected. Happens with all php unless the web server is broken. That's the effect of the browser implementing the php script in building the page.

Murdok09
05-07-2008, 08:55 PM
<table>
<tbody>
<tr>
<td><?php IF($LOGGEDIN==TRUE)
echo "
<h?>Logged
In
";
echo "Welcome <b>$session-&gt;username</b>, you are
logged in. <br />
<br />
"
."[<a href="%5C%22userinfo.php?user=$session-">username\"&gt;My
Account</a>] &nbsp;&nbsp;"
."[<a href="%5C%22useredit.php%5C%22">Edit Account</a>]
&nbsp;&nbsp;";
if($session-&gt;isAdmin()){
echo "[<a href="%5C%22admin/admin.php%5C%22">Admin Center</a>]
&nbsp;&nbsp;";
}
echo "[<a href="%5C%22process.php%5C%22">Logout</a>]";
}
else{
?&gt;
<h1>Login</h1>
num_errors &gt; 0){
echo "<font color="\&quot;#ff0000\&quot;" size="2">".$form-&gt;num_errors."
error(s) found</font>";
}
?&gt;
<form action="process.php" method="post">
<table align="left" border="0"
cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td>Username:</td>
<td><input name="user" maxlength="30"
value="&lt;? echo $form-&gt;value(" user="" )="" ?=""
type="text" />"&gt;</td>
<td>error("user"); ?&gt;</td>
</tr>
<tr>
<td>Password:</td>
<td><input name="pass" maxlength="30"
value="&lt;? echo $form-&gt;value(" pass="" )="" ?=""
type="password" />"&gt;</td>
<td>error("pass"); ?&gt;</td>
</tr>
<tr>
<td colspan="2" align="left"><input
name="remember" type="checkbox" />value("remember")
!= ""){ echo "checked"; } ?&gt;&gt; <font size="2">Remember
me next time &nbsp;&nbsp;&nbsp;&nbsp; <input
name="sublogin" value="1" type="hidden" /> <input
value="Login" type="submit" /></font></td>
</tr>
<tr>
<td colspan="2" align="left"><br />
<font size="2">[<a
href="forgotpass.php">Forgot Password?</a>]</font></td>
<td align="right"></td>
</tr>
<tr>
<td colspan="2" align="left"><br />
Not registered? <a href="register.php">Sign-Up!</a></td>
</tr>
</tbody>
</table>
</form>
?&gt; </td>
</tr>
<tr>
<td align="\&quot;center\&quot;"><br />
<br />
";
echo "<b>Member Total:</b>
".$database-&gt;getNumMembers()."<br />
";
echo "There are $database-&gt;num_active_users registered members
and ";
echo "$database-&gt;num_active_guests guests viewing the site.<br />
<br />
";
include("include/view_active.php");
?&gt; </td>
</tr>
</tbody>
</table>


I can't figure it out. I've looked at it over and over again, and I'm not sure what the problem is.

tomws
05-08-2008, 12:36 AM
Something is screwy with your editor maybe. All those &gt; should be actual greater than signs.

Just curious: do you happen to be using Dreamweaver? And do you happen to type your PHP code into the HTML viewport (as opposed to the text/source viewport)?

Murdok09
05-08-2008, 12:51 AM
I'm actually using Nvu, and it must have transferred it over somewhere. IDK, thanks though, I'm going to try that now!

Murdok09
05-09-2008, 01:01 AM
Okay...I'm about to sell a kidney and buy an asian to do this for me.

Okay, every time I input the table, it says nothing exists.

Could someone please, PLEASE look at the tutorial from the top, download the files at the end of the tut, and look through them quickly? I am using the main.php document, and it says "hey, put this in your HTML and your site will magically work" and NOTHING! I put all the files as they were downloaded, only out of the "login/login" folders, and uploaded them to my public_html folder.

tomws
05-09-2008, 01:25 AM
Since that's an entire project including db setup, you probably won't get many takers for doing your testing. Error messages would be helpful for tracking down problems. Showing a section of code where you know there's a problem is good. It's pretty easy to get some quick help when there's something to work with.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum