Jump to content

Psycho-Path

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Psycho-Path's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I think I have made enough threads so I'm just going to post it in here... I have this register page for users, and the page is blank, I think it's the if statements that are screwing up. [code="register.php"]<?php require ("connect.php"); //mysql db connection here require ("functions.php"); //echo some styles to spice it up... echo " <style> body { background: 131313; font-family: Verdana, Arial; font-weight: bold; font-size: 9px; color: FFFFFF; } .register_box { border: 1px solid 323232; background: 202020; font-family: Verdana, Arial; font-weight: bold; font-size: 9px; color: FFFFFF; } </style> "; echo " <font class='title-top'>Register</font> <br /> "; switch($_GET['action']) { case "new": //-------------------------------------- // [New Registration] //-------------------------------------- if(!isset($_POST['register'])) { echo " <form action='index.php?act=register.php&action=new' method='POST'> Username: <br /> <input type='text' name='username' class='register_box'> <br /> Email: <br /> <input type='text' name='email' class='register_box'> <br /> Password: <br /> <input type='password' name='password' class='register_box'> <br /> <input type='submit' name='register' value='Register' class='register_box'> </form> "; } elseif(isset($_POST['register'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $email = mysql_real_escape_string($_POST['email']); $activation_code = generateCode(25); $userq = "SELECT username FROM user_system WHERE username = '$username' LIMIT 1"; $emailq = "SELECT email FROM user_system WHERE email = '$email' LIMIT 1"; //put errors into an array $errors = array(); if(empty($username)) { $errors[] = "The username field was blank! <br />"; } if(mysql_num_rows(mysql_query($userq)) > 0) { $errors[] = "The username given is already in use! Please try another one! <br />"; } if(empty($password)) { $errors[] = "The password field was blank! <br />"; } if(empty($email)) { $errors[] = "The email field was blank! <br />"; } if(mysql_num_rows(mysql_query($emailq)) > 0) { $errors[] = "The email given is already in use! Please try another one! <br />"; } if(count($errors) > 0) { foreach($errors as $err) { echo $err; } } else { $sqlq = "INSERT INTO user_system (username, password, email, is_activated, activation_code)"; $sqlq .= "VALUES ('$username', '".md5($password)."', '$email', '0', '$activation_code')"; mysql_query($sqlq) or die(mysql_error()); echo "Thanks for registering! You will recieve an email shortly containing your validation code, and a link to activate your account!"; mail($email, "New Registration, localhost", " Thanks for registering at the site. Here are your login details: Username: ".$username." Password: ".$password." In order to login and gain full access, you must validate your account. Click here to validate: http://localhost/test/index.php?act=register.php&action=activate&user=".$username."&code=".$activation_code." Thanks! [Webmaster] "); } } break; } ?> [/code]
  2. For the creation of a new table called catagories would this be ok sql? [code]CREATE TABLE `forum_cat` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(250) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM;[/code] and then for the table that holds the threads [code]SELECT * FROM `forum_posts` WHERE 1 `cat_id` VARCHAR(250) NOT NULL, ) ENGINE=MyISAM;[/code] is that correct?
  3. Alright, then can you just help me with the catagories?  I can't find anything on them muchless forum tutorials that have catagories.
  4. Sorry I thought I was clear. And it's not quite a question but a request. A request to have tutorials, help, etc, on adding these to my forums: registration to be a member member profile page login page bbcode on posting pming catagories etc etc.
  5. Please people, I need more tuts, ideas, and help.
  6. some php tutorials in this flash site: [url=http://www.gotoandlearn.com/]gotoandlearn.com[/url]
  7. Ok I have some forums on my site and I would like to customize for it to be most like the leading ones out there (ipb, phpbb, vb, etc.) So I have the basics setup right now, but I would like to make it so there is: registration for membership page member page login page bbcode on posting etc etc I'm not asking for people to just change my script for me, cause I'm not a freeloader, I like doing work.  But I like getting help as well :) So here are the files I have so far. forums.php [code]<?php include "connect.php"; //mysql db connection here print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=40% class='headline-text'>Topic</td><td width=20% class='headline-text'>Topic Starter</td><td width=15% class='headline-text'>Replies</td><td class='headline-text'>Last replied time</td></tr>"; $getthreads="SELECT * from forumtutorial_posts where parentid='0' order by lastrepliedto DESC"; $getthreads2=mysql_query($getthreads) or die("Could not get threads"); while($getthreads3=mysql_fetch_array($getthreads2)) { $getthreads3[title]=strip_tags($getthreads3[title]); $getthreads3[author]=strip_tags($getthreads3[author]); print "<tr class='mainrow'><td><a class='topic' href='index.php?act=topics&id=$getthreads3[postid]'>$getthreads3[title]</a></td><td class='info-text'>$getthreads3[author]</td><td class='info-text'>$getthreads3[numreplies]</td><td class='info-text'>$getthreads3[showtime]<br>&nbsp;Last post by <b>$getthreads3[lastposter]</b></td></tr>"; } print "</table>"; ?> [/code] post.php [code]<?php include "connect.php"; //connection string print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<table class='maintables'>"; print "<tr class='headline'><td>Post a message</td></tr>"; print "<tr class='maintables'><td>"; if(isset($_POST['submit'])) { $name=$_POST['name']; $yourpost=$_POST['yourpost']; $subject=$_POST['subject']; if(strlen($name)<1) { print "You did not type in a name."; //no name entered } else if(strlen($yourpost)<1) { print "You did not type in a post."; //no post entered } else if(strlen($subject)<1) { print "You did not enter a subject."; //no subject entered } else { $thedate=date("U"); //get unix timestamp $displaytime=date("F j, Y, g:i a"); //we now strip HTML injections $subject=strip_tags($subject); $name=strip_tags($name); $yourpost=strip_tags($yourpost); $insertpost="INSERT INTO forumtutorial_posts(author,title,post,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$displaytime','$thedate','$name')"; mysql_query($insertpost) or die("Could not insert post"); //insert post print "Message posted, go back to <A href='index.php'>Forum</a>."; } } else { print "<form action='post.php' method='post'>"; print "Your name:<br>"; print "<input type='text' name='name' size='20'><br>"; print "Subject:<br>"; print "<input type='text' name='subject' size='20'><br>"; print "Your message:<br>"; print "<textarea name='yourpost' rows='5' cols='40'></textarea><br>"; print "<input type='submit' name='submit' value='submit'></form>"; } print "</td></tr></table>"; ?>[/code] reply.php [code]<?php include "connect.php"; //connection string print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<table class='maintables'>"; print "<tr class='headline'><td>Reply</td></tr>"; print "<tr class='maintables'><td>"; if(isset($_POST['submit'])) { $name=$_POST['name']; $yourpost=$_POST['yourpost']; $subject=$_POST['subject']; $id=$_POST['id']; if(strlen($name)<1) { print "You did not type in a name."; //no name entered } else if(strlen($yourpost)<1) { print "You did not type in a post."; //no post entered } else { $thedate=date("U"); //get unix timestamp $displaytime=date("F j, Y, g:i a"); //we now strip HTML injections $subject=strip_tags($subject); $name=strip_tags($name); $yourpost=strip_tags($yourpost); $insertpost="INSERT INTO forumtutorial_posts(author,title,post,showtime,realtime,lastposter,parentid) values('$name','$subject','$yourpost','$displaytime','$thedate','$name','$id')"; mysql_query($insertpost) or die("Could not insert post"); //insert post $updatepost="Update forumtutorial_posts set numreplies=numreplies+'1', lastposter='$name',showtime='$displaytime', lastrepliedto='$thedate' where postid='$id'"; mysql_query($updatepost) or die("Could not update post"); print "Message posted, go back to <A href='message.php?id=$id'>Message</a>."; } } else { $id=$_GET['id']; print "<form action='reply.php' method='post'>"; print "<input type='hidden' name='id' value='$id'>"; print "Your name:<br>"; print "<input type='text' name='name' size='20'><br>"; print "Your message:<br>"; print "<textarea name='yourpost' rows='5' cols='40'></textarea><br>"; print "<input type='submit' name='submit' value='submit'></form>"; } print "</td></tr></table>"; ?>[/code] topics.php [code]<?php include "connect.php"; //mysql db connection here $id=$_GET['id']; print "<link rel='stylesheet' href='style.css' type='text/css'>"; $getthreads="SELECT * from forumtutorial_posts where parentid='0' order by lastrepliedto DESC"; $getthreads2=mysql_query($getthreads) or die("Could not get threads"); { $getthreads3[title]=strip_tags($getthreads3[title]); $getthreads3[author]=strip_tags($getthreads3[author]); print "<font class='title-top'>Forums -> Topic</font>"; print "<br />"; } print "<table class='maintable'>"; print "<tr class='headline'><td width=20%>Author</td><td width=80%>Post</td></tr>"; $gettopic="SELECT * from forumtutorial_posts where postid='$id'"; $gettopic2=mysql_query($gettopic) or die("Could not get topic"); $gettopic3=mysql_fetch_array($gettopic2); print "<tr class='mainrow'><td valign='top'>$gettopic3[author]</td><td valign='top'>This topic was made on $gettopic3[showtime]<br><hr>"; $message=strip_tags($gettopic3['post']); $message=nl2br($message); print "$message<br /><br />"; print "</td></tr>"; $getreplies="SELECT * from forumtutorial_posts where parentid='$id' order by postid desc"; //getting replies $getreplies2=mysql_query($getreplies) or die("Could not get replies"); while($getreplies3=mysql_fetch_array($getreplies2)) { print "<tr class='mainrow'><td valign='top'>$getreplies3[author]</td><td valign='top'>Last replied to at $getreplies3[showtime]<br><hr>"; $message=strip_tags($getreplies3['post']); $message=nl2br($message); print "$message<br /><br />"; print "</td></tr>"; print "<tr class='mainrow'><td valign='top'><a class='topic' href='index.php?act=post&id=$getthreads3[postid]'>Reply<br>"; print "</td></tr>"; } print "</table>"; ?>[/code] ok those are all the files I have, could you guys direct me in some tutorials that could give me help or if you could help me on the things I asked for. Thanks A BUNCH! Andrew
  8. Ok I have my site set so so the index.php reads the rest of the .php files and puts their contents into a certain part of index.php, right?  ill give an example of the code im using. [code]<? $val = $_GET['id']; $val .= ".php"; $dirty = array(".."); $clean = array(""); $val = str_replace($dirty, $clean, $val); if (isset($_GET['id'])) { if (file_exists($val)) { include "$val"; } else { include "404.php"; } } else { include "news.php"; } ?>[/code] so anyways I followed a tut on forums ( I think I got it from here ) and so I have the forums index done - index.php?id=forums so it looks fine,  well I have a problem b/c the way these forums are made it of course sets numbers for posts made, so you would think that I would use index.php?id=message  but no, it would need to be something like index.php?id=message&id=1 so it knows which reply it is using or else it just looks at message.php rather than message.php?id=1 which is what I need. so please help me Thanks, Andrew
  9. Why won't the script work? What do you mean before the form is even created?
  10. I am having a problem with mysql and phpmyadmin, not sure which one it is, but when I make a database and everything, the information isn't being sent!  I have had several sites but this is the first time for me to have one on a local server..so I'm kind of new to this, especially since I used to use cPanel.  So I'm wondering... what am I doing wrong? This is what I used on this b/c it didn't give me any errors.  Infact..it didn't give me any information, the page was blank.. [code]<?php $database="cms"; //Your database name $mysql_user = "localhost_root"; //Your database username to login with $mysql_password = ""; //Your database password to login with $mysql_host = "localhost"; //Your server, Tends to be localhost $success = mysql_connect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die ("Cannot connect to database, check if username, password and host are correct."); //Message if it connected correctly $success = mysql_select_db ($database); if (!$success) { print "Cannot choose database, check if database name is correct."; //Message if the connection failed. die(); } ?>[/code] This is what I used to use when I had a payed host (cusername stands for my cpanel username) [code]<?php $database="cusername_database"; //Your database name $mysql_user = "cusername_username"; //Your database username to login with $mysql_password = "password"; //Your database password to login with $mysql_host = "localhost"; //Your server, Tends to be localhost $success = mysql_connect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die ("Cannot connect to database, check if username, password and host are correct."); //Message if it connected correctly $success = mysql_select_db ($database); if (!$success) { print "Cannot choose database, check if database name is correct."; //Message if the connection failed. die(); } ?>[/code] Please tell me why the information is not being sent! :( Also I am having a problem parsing the information: [code]<?php include 'parser.php'; $parser = new parser(); $default_text = <<<EOF :) :( This is a sample text. [url=http://phpfreaks.com]PHP Freaks[/url] is a PHP website :) [b]bold[/b] [b]bold again[/b] [i]italic[/i] [u]underline[/u] left [center]center[/center] [right]right[/right] [url]http://phpfreaks.com[/url] [mail=somebody@example.com]Somebody's mail[/mail] [mail]somebody@example.com[/mail] [center][url=http://google.com][img]http://www.google.com/intl/en/images/logo.gif[/img][/url][/center] EOF; $text = !empty($_POST['text']) ? $_POST['text'] : $default_text; $ps_checked = (bool)$_POST['parse_smilies'] ? " checked='checked'" : null; $pbbc_checked = (bool)$_POST['parse_bbcodes'] ? " checked='checked'" : null; echo <<<EOF <form action='{$_SERVER['REQUEST_URI']}' method='post'> <label><input type='checkbox' name='parse_smilies' value='1'{$ps_checked}> Parse smilies</input></label><br /> <label><input type='checkbox' name='parse_bbcodes' value='1'{$pbbc_checked}> Parse BBcodes</input></label><br /><br /> <label>Text to parse:<br /><textarea cols='10' rows='15' style='width: 100%;' name='text'>{$text}</textarea></label><br /><br /> <button type='submit'>Parse text</button> </form> EOF; if(!empty($_POST['text'])) {     $parser->parse_smilies = (bool) $_POST['parse_smilies'];     $parser->parse_bbcodes = (bool) $_POST['parse_bbcodes'];     $text = $parser->parse($_POST['text']);         echo <<<EOF <hr /> <div style='overflow: auto; height: 200px;'>{$text}</div> EOF; } ?>[/code] [quote="Error"] Notice: Undefined index: parse_smilies in c:\program files\easyphp1-8\www\bbcode\index.php on line 24 Notice: Undefined index: parse_bbcodes in c:\program files\easyphp1-8\www\bbcode\index.php on line 25[/quote] Hope you guys can help me, and it didn't look like jibberish.. Thanks, Andrew
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.