|
-
Oct 30th, 2009, 07:48 AM
#1
Thread Starter
Fanatic Member
login system
i found this site: http://evolt.org/PHP-Login-System-wi...ts_per_page=50
but my problem is that it wont work properly, i will see the php tags on the page... ( i got php and mysql ) any idea how to fix this?
-
Oct 30th, 2009, 10:53 AM
#2
Re: login system
If you see the PHP tags on the screen then the server isn't executing the PHP code, instead it is simply outputting it as if it was HTML.
1) Do all relevant files end in .php
2) Are you sure your server has PHP installed
3) And is it turned on?
ILMV
-
Oct 30th, 2009, 11:20 AM
#3
Thread Starter
Fanatic Member
Re: login system
i've been working with wamp for over 1 year... i'm sure i can tell its on and all files with php code are .php files
-
Oct 30th, 2009, 12:57 PM
#4
Frenzied Member
Re: login system
Then maybe you need more than 1 year experience to realize it's not parsing it.
-
Oct 30th, 2009, 01:18 PM
#5
Thread Starter
Fanatic Member
Re: login system
it runs php lol... i got many sites with php and its functioning...
Last edited by Justa Lol; Oct 30th, 2009 at 01:25 PM.
-
Oct 30th, 2009, 05:48 PM
#6
Re: login system
well, you're obviously doing something wrong then. if the PHP files you're running are just spitting out plain text, then they're not being parsed. ensure that you didn't save them with microsoft word, or something, too.
-
Oct 30th, 2009, 05:53 PM
#7
Re: login system
@ Justa Lol,
If you are talikng about this:
\n"; } /** * displayBannedUsers - Displays the banned users * database table in a nicely formatted html table. */ function displayBannedUsers(){ global $database; $q = "SELECT username,timestamp " ."FROM ".TBL_BANNED_USERS." ORDER BY username"; $result = $database->query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; return; } if($num_rows == 0){ echo "Database table empty"; return; } /* Display table contents */ echo "\n"; echo "\n"; for($i=0; $i<$num_rows; $i++){ $uname = mysql_result($result,$i,"username"); $time = mysql_result($result,$i,"timestamp"); echo "\n"; } echo "
Appearing all over the screen when you run the *.php files in WAMP (Whatever you use) that is just bad programming. I don't think the author double checked his scripts, etc to make sure they actually worked just before he uploaded them.
Below is the code I used just to create the database! That guy's code is a mess.
PHP Code:
<?php // Database connection variables $dbDatabase = "Test"; //connect to db $conn = mysql_connect("localhost", "root", ""); if (!$conn) { die("Connection failed: " .mysql_error()); } //create database $query = "CREATE DATABASE IF NOT EXISTS Test"; if (mysql_query($query, $conn)) { echo ("Database create query successful!"); }else { die ("Database query failed: " .mysql_error()); } //select database if (mysql_select_db($dbDatabase, $conn)) { echo ("Database selection successful!"); }else { die ("Could not locate test database" .mysql_error()); } //Table structure for users table $query = "CREATE TABLE IF NOT EXISTS users ( username varchar(30) primary key, password varchar(32), userid varchar(32), userlevel tinyint(1) unsigned not null, email varchar(50), timestamp int(11) unsigned not null )"; if (mysql_query($query, $conn)) { echo ("Database users query successful!"); }else { die ("Database query failed: " .mysql_error()); }
// Table structure for active users table $query ="CREATE TABLE IF NOT EXISTS active_users ( username varchar(30) primary key, timestamp int(11) unsigned not null )"; if (mysql_query($query, $conn)) { echo ("Database active_users query successful!"); }else { die ("Database query failed: " .mysql_error()); } // Table structure for active guests table $query ="CREATE TABLE IF NOT EXISTS active_guests ( ip varchar(15) primary key, timestamp int(11) unsigned not null )"; if (mysql_query($query, $conn)) { echo ("Database active_guests query successful!"); }else { die ("Database query failed: " .mysql_error()); } //Table structure for banned users table $query ="CREATE TABLE IF NOT EXISTS banned_users ( username varchar(30) primary key, timestamp int(11) unsigned not null )"; if (mysql_query($query, $conn)) { echo ("Database banned_users query successful!"); }else { die ("Database query failed: " .mysql_error()); } ?>
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Oct 30th, 2009, 06:04 PM
#8
Re: login system
if you copied and pasted it like that, that means you most likely did not use a text editor that supports proper line breaks. notepad is an example of one that does not. wordpad, however, does.
no one would actually type out code like that. you'd be silly for thinking so.
-
Oct 30th, 2009, 07:12 PM
#9
Re: login system
 Originally Posted by kows
if you copied and pasted it like that, that means you most likely did not use a text editor that supports proper line breaks. notepad is an example of one that does not. wordpad, however, does.
no one would actually type out code like that. you'd be silly for thinking so.
The author has a zip file with the code available on the same site! Just keep scrolling passed the code until you get to the "Download" section. The downloaded is the code I got the quoted part from above.
Edit:
Found this on the last page of the comments:
 Originally Posted by bladeone_2k
Hopefully, that version of the script works without needing editing!
To get the scripts to work you need to replace "<?" with "<?php", save and reload them.
Last edited by Nightwalker83; Oct 30th, 2009 at 07:54 PM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Oct 31st, 2009, 06:54 AM
#10
Thread Starter
Fanatic Member
Re: login system
i didnt notice that, thanks... gonna test now.
edit: it works... only problem is the mailing part, is there something special i need for this?
Last edited by Justa Lol; Oct 31st, 2009 at 07:11 AM.
-
Oct 31st, 2009, 11:24 PM
#11
Re: login system
Try replacing the mail code with:
PHP Code:
<?php include("include/session.php"); if(!$session->logged_in){ header("Location: ".$session->referrer); } ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Jpmaster77's Login Script</title> </head> <body>
<div id="main" class="container_12"> <h1>User Message System</h1> <form method="post" action="mail.php"> <input type="submit" name="mailAction" value="Compose" /><input type="submit" name="mailAction" value="Inbox" /> </form>
<?php
if(!empty($_POST['mailAction']) && isset($_POST['mailAction'])){ $action = $_POST['mailAction']; } else { $action = 'Inbox'; }
if(($action == 'Compose') || ($action == 'Reply')) { if(isset($_POST['mailSubject']) && !empty($_POST['mailSubject'])){ $mailSubject = 'Re: '.$_POST['mailSubject']; } else { $mailSubject = ""; } if(isset($_POST['mailFrom']) && !empty($_POST['mailFrom'])){ $mailTo = $_POST['mailFrom']; } else { $mailTo = ""; } ?> <form action="mail.php" method='post'> <div id="compose"> <p class="textinput">To:</p><p class="grid_2"><input type='text' name='mailTo' size='20' value='<?php echo $mailTo; ?>'></p> <div class="clear"></div> <p class="textinput">Subject:</p><p class="grid_2"><input type='text' name='mailSubject' size='20' value='<?php echo $mailSubject; ?>'></p> <div class="clear"></div> <p class="textinput">Message:</p><p class="grid_4"><textarea rows='16' cols='45' name='mailMessage'></textarea></p> <div class="clear"></div> <p class="grid_1"><input type="submit" name="mailAction" value="Send" /></p> </div> </form> <?php } if($action == 'Send') { if(empty($_POST['mailSubject']) || !isset($_POST['mailSubject'])){ echo "Subject Blank"; } else { $subject = $_POST['mailSubject']; } if(empty($_POST['mailTo']) || !isset($_POST['mailTo'])){ echo "To Blank"; } else { $mailTo = $_POST['mailTo']; } if(empty($_POST['mailMessage']) || !isset($_POST['mailMessage'])){ echo "Message Blank"; } else { $message = $_POST['mailMessage']; } $date = date('m/d/Y')." at ".date('g:i.s')." ".date('a'); $q = "INSERT INTO mail (UserTo, UserFrom, Subject, Message, SentDate, status) VALUES ('$mailTo','$session->username','$subject','$message','$date','unread')"; if(!($send = $database->query($q))){ echo "A letter could not be sent to ".$mailTo."!"; } else { echo "Message Sent to ".$mailTo."!"; } } if($action == "Inbox") { $user = $session->username; $q = "SELECT * FROM mail WHERE UserTo = '$user' ORDER BY SentDate DESC"; $getMail = $database->query($q) or die(mysql_error());
echo "<div id='inbox'>"; if(mysql_num_rows($getMail) == 0){ echo "<p>you have no mail</p><br /><br />"; } else { ?> <table> <tr class="title"> <td colspan="2" align="center">Action</td> <td>Status</td> <td>From</td> <td>Subject</td> <td>Time</td> </tr> </div> <?php while($mail = mysql_fetch_array($getMail)){ echo "<form action='mail.php' method='post'>"; ?> <tr> <input type="hidden" name="mail_id" value="<?php echo $mail['mail_id']; ?>" /> <td align="center"><input type="submit" name="mailAction" value='View' /></td> <td align="center"><input type="submit" name="mailAction" value="Delete" /></td> <td><?php echo $mail['status']; ?></td> <td><?php echo $mail['UserFrom']; ?></td> <td><?php echo $mail['Subject']; ?></td> <td><?php echo $mail['SentDate']; ?></td> </tr> <?php echo "</form>";
} } echo "</table>"; } if($action == "View") { $mail_id = $_POST['mail_id']; $user = $session->username; $result = $database->query("SELECT * FROM mail WHERE UserTo = '$user' AND mail_id = '$mail_id'") or die ("cant do it"); $row = mysql_fetch_array($result); if($row['UserTo'] != $session->username) { echo "<font face=verdana><b>This isn't your mail!"; exit; } $q = "UPDATE mail SET status='read' WHERE UserTo='$session->username' AND mail_id='$row[mail_id]'"; $database->query($q) or die("An error occurred resulting that this message has not been marked read."); ?> <form method="post" action="mail.php"> <div id="single"> <p class="grid_1">From: </p><p class="grid_2"><?php echo $row['UserFrom']; ?><input type="hidden" name="mailFrom" value="<?php echo $row['UserFrom']; ?>" /></p> <p class="grid_1 clear">Subject: </p><p class="grid_2"><?php echo $row['Subject']; ?><input type="hidden" name="mailSubject" value="<?php echo$row['Subject']; ?>" /></p> <p class="grid_4 clear">body: <br /><?php echo $row['Message']; ?><br /></p> <p class="grid_4 clear" align="right"><input type="submit" name="mailAction" value="Reply" /></p> </div> </form> <?php } if($action == 'Delete') { $id = $_POST['mail_id']; $query = $database->query("DELETE FROM mail WHERE mail_id='$id' LIMIT 1"); if(!$query) { echo "The message wasn\'t deleted"; } else { header("Location: mail.php"); } } echo "<div class='clear'>"; echo "[<a href=\"main.php\">Main</a>] "; echo "[<a href=\"userinfo.php?user=$session->username\">My Account</a>] "; echo "[<a href=\"process.php\">Logout</a>]"; echo "</div>"; ?>
</div> </body> </html>
That code is available on the forums linked to in my other post.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|