Jump to content

legohead6

Members
  • Posts

    434
  • Joined

  • Last visited

    Never

About legohead6

  • Birthday 04/28/1992

Contact Methods

  • Website URL
    http://www.zelocalz.com

Profile Information

  • Gender
    Not Telling

legohead6's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. you can make a pretty simple registration page fairly quicky, and its not too difficult, but once you start validating it it can be time consuming and sometimes tricky(making sure emails are formatted correctly/email activation, making sure emails/usernames are not already registered) here is a code from a relativily simple registration i have. take what you want.. if(!empty($_SESSION['user'])){ echo "<p align=center><b>You cannot register Multiple accounts!</b></p>"; include 'footer.php'; exit; } if(isset($_POST['reg'])) { $connect=mysql_connect ("*****", "******", "**********") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("matts15_forum"); $errors = array(); $i=0; if(empty($_POST['fname'])){ $first1 = '<font color=red size=2>*Please enter your first Name!</font>'; $e++; }else{ if(!eregi ('^[a-zA-Z]{2,}$', $_POST['fname'])){ $first1 = '<font color=red size=2>*Please enter a valid first name!</font>'; $e++; }else{ $fi=$_POST['fname']; } } if(empty($_POST['lname'])){ $last1 = '<font color=red size=2>*Please enter your last Name!</font>'; $e++; }else{ if(!eregi ('^[a-zA-Z]{2,15}$', $_POST['lname'])){ $e++; $last1 = '<font color=red size=2>*Please enter a true last name!</font>'; }else{ $la=$_POST['lname']; } } if(empty($_POST['email'])){ $email1 = '<font color=red size=2>*Please enter your Email Address!</font>'; $e++; }else{ if(!eregi ('^[[:alnum:]][a-z0-9\.\-_]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', $_POST['email'])) { $email1 = '<font color=red size=2>*Email is not in correct Format'; $e++; }else{ $cem=$_POST['email']; $sql_email_check = @mysql_query("SELECT email FROM Members WHERE email='$cem'"); $email_check = mysql_num_rows($sql_email_check); } if($email_check != 0){ $email1 = "<font color=red size=2>*This Email Address is already registered!</font>"; $e++; } else{ $em=$_POST['email']; } } if(empty($_POST['user'])){ $user1 = '<font color=red size=2>*Please enter a username!</font>'; $e++; }else{ if(ereg('[^[:space:]a-zA-Z0-9_.-]{1,200}', $_POST['user'])){ $user1 = '<font color=red size=2>*Please Only use Letters and Numbers for usernames</font>'; $e++; }else{ $cus=$_POST['user']; $sql_username_check = mysql_query("SELECT username FROM Members WHERE username='$cus'"); $username_check = mysql_num_rows($sql_username_check); } if($username_check != 0){ $user1 = "<font color=red size=2>*The username Already Exists</font>"; $e++; } else{ $us=$_POST['user']; } } if(empty($_POST['pass'])){ $pass1 = '<font color=red size=2>*Please enter your Password!</font>'; $e++; }else{ if(($_POST['pass']) != ($_POST['cpass'])){ $pass1 = '<font color=red size=2>*Passwords Dont Match</font>'; $e++; }else{ $pa=$_POST['pass']; } } if($e == 0) { $active = rand(100000, 99999999); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Mattswebpage.com <activate@mattswebpage.com>' . "\r\n"; $sus = base64_encode("$us"); mail("$em", "Account Activation", " Welcome To Mattswebpage.com. To start using your new account Please Click below. <br><br><Br><a href=http://beta.mattswebpage.com/active.php?ac=$active&us=$sus>Activate Your Account Now!</a><br><br> Thankyou,<br> Mattswebpage.com<hr>This is an automatic message, please do not reply", "$headers"); $query = "INSERT INTO Members VALUES ('','$us','$pa','$em','$fi','$la','$active','0')"; mysql_query($query) or die('We are Experiancing Database Errors, Please Contact The Administrator'); echo "<p align=center>Please Activate Your Account By going to your email and following the directions from there.</p>"; include 'footer.php'; exit; }else{ $m= $e; $mistake="<div align=center><p><font color=red>Please Correct ($m) Mistakes</font></p></div>"; } } echo " <form method=POST><table><tr><td colspan=2><p align=center>Create An Account</p></td></tr><tr><td colspan=4>$mistake</td></tr> <tr><td>First Name</td><td><input type=text name=fname value=$fi></td></tr> <tr><td colspan=2>$first1</td></tr> <tr><td>Last Name</td><td><input type=text name=lname value=$la></td></tr> <tr><td colspan=2>$last1</td></tr> <tr><td>Desired Username</td><td><input type=text name=user value=$us></td></tr> <tr><td colspan=2>$user1</td></tr> <tr><td>Email Address</td><td><input type=text name=email value=$em></td></tr> <tr><td colspan=2>$email1</td></tr> <tr><td>Password</td><td><input type=password name=pass></td></tr> <td>Confirm Password</td><td><input type=password name=cpass></td></tr> <tr><td colspan=2>$pass1</td></tr> <tr><td colspan=2><p align=center><input type=submit name=reg value=Continue></td></tr></table></form> ";
  2. the thing you have to understand with php is so many things can cause 1 problem, so you may have to do a bit of trial and error to figure things out corbin's first response was one of the more obvious things that may be wrong. but hes not guaranteeing that is the only problem... PHP takes a lot of Patience and perseverance
  3. yes, the best way is to create a session with the username of the user, then on pages that require being logged in you start the page with if(empty($_SESSION['username'])){ echo "Please Login"; exit(); }
  4. i have tried that, i cant get the program to actually start on the computer. i cant make anything start on the localusers computer from a php command... even if i could make a php command that opens notepad i would be happy tried this <?php $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("notepad.exe", 7, false); ?> and i get Fatal error: Cannot instantiate non-existent class: com in ******/proxy.php on line 2
  5. Well, our school has a firewall, and currently i am just running Putty on my laptop and get around the firewall. this works great, but when my friends want to get in i have to login for them and set it up. what i am wonder is if i can somehow start a SSH connection(to the server the php is running on) with php, and then the user could connect to it in there internet explorer preferences(under proxy settings) could someone tell me if this is possible? if so point me in the right direction...
  6. wow, i just copied the exact code from the other page that works fine to the index, and it still does not work, this is really weird exact same code on 2 pages, 1 works, the other doesnt i put an '@' in front of Session start on the index and it works fine now, but who knows the real probelm
  7. tried that. when i remove session start it works, but as soon as i click to another page i loose the session
  8. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/matts15/public_html/beta/index.php:1) in /home/matts15/public_html/beta/header.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/matts15/public_html/beta/index.php:1) in /home/matts15/public_html/beta/header.php on line 2
  9. Nothing changes with that, funny thing is it is only in the index, i went to one of my other pages(that also includes the header) and it works fine!
  10. I have tried moving it, putting it on both pages, etc its not working
  11. fixed that, problem still exists check it at http://beta.mattswebpage.com
  12. I keep getting the stupid headers already sent, i went through the sticky, and ive tried a ton of things.. i cannot figure out why. Index.php <?PHP include "header.php"; echo "<h2>Welcome</h2> <p>Well, i decided that this space earns something better then a white page with links to my other sites, soo here it is! Im not exactly sure how this will turn out, i am also looking for input from others as to what i should put here. Anything is possible!!"; include "footer.php"; ?> header.php <?PHP SESSION_START(); $connect=mysql_connect ("localhost", "*****", "********") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("********"); if(empty($_SESSION['user'])){ if(isset($_POST['log'])){ $user2=$_POST['user']; $pass2=$_POST['pass']; $query2 = "SELECT * FROM Members WHERE username='$user2'"; $result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error()); $exist = mysql_num_rows($result2); while($caa = mysql_fetch_row($result2)){ $pass1=$caa[2]; } if($exist = 1){ if($pass1 == "$pass2"){ $_SESSION['user'] = "$user2"; }else{ $login= "<p align=center>Invalid Username/Password<br><form method=POST><table width=100><tr><td colspan=2><h2>Sign In</h2></td></tr><tr><td><b>Username:</b></td><td><input type=text name=user size=10></td></tr><tr><td><b>Password: </b></td><td><input type=password name=pass size=10></td></tr><tr><td><input type=submit name=log value=Login></form></td><td><a href=fpass.php>Forget Your Password?</a></td></tr></table>"; }//end of pass1 }else{ $login= "<p align=center>Invalid Username/Password<br><form method=POST><table><tr><td colspan=2><h2>Sign In</h2></td></tr><tr><td><b>Username:</b></td><td><input type=text name=user size=10></td></tr><tr><td><b>Password: </b></td><td><input type=password name=pass size=10></td></tr><tr><td><input type=submit name=log value=Login></form></td><td><a href=fpass.php>Forget Your Password?</a></td></tr></table>"; }//end of exist }else{ $login= "<form method=POST><table width=100><tr><td colspan=2><h2>Sign In</h2></td></tr><tr><td><b>Username:</b></td><td><input type=text name=user size=10></td></tr><tr><td><b>Password: </b></td><td><input type=password name=pass size=10></td></tr><tr><td><input type=submit name=log value=Login></form></td><td><a href=fpass.php>Forget Your Password?</a></td></tr></table>"; }//end of if login button }else{//if logged in $user=$_SESSION['user']; $login= "<p align=center>Welcome $user!</p>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="#" /> <meta name="keywords" content="#" /> <meta name="author" content="#" /> <link rel="stylesheet" type="text/css" href="http://mattswebpage.com/beta/voodoo.css" media="screen" /> <link rel="stylesheet" type="text/css" href="http://mattswebpage.com/beta/print.css" media="print" /> <link rel="stylesheet" type="text/css" href="http://mattswebpage.com/beta/handheld.css" media="handheld" /> <title>Mattswebpage.com</title> </head> <body> <div class="top"></div> <div class="page_wrap clearfix"> <div class="header"> <div class="header_block"> <div class="logo"><img alt="logo" src="http://mattswebpage.com/beta/img/pc_logo.jpg" /></div> <h1>Mattswebpage.com BETA</h1> What other website do you need? </div> </div> <div class="navbar" id="nav"> <ul> <li><a href="index.php">Home</a></li> <li><a href="about.php">About</a></li> <li><a href="#">Forum</a></li> <li><a href="#">Info</a></li> <li><a href="#">Contact</a></li> </ul> </div> <div class="container clearfix"> <div class="left_column"> <h3>News</h3> <p>Nov 3. New Mattswebpage getting started. Visit beta.mattswebpage.com!</p> </div> <div class="center_column"> <div class="box_right"> <? echo "$login"; ?> </div>
  13. This may be more javascript, but im hoping someone can help me out. i have a file management site, and currently if you open up a file then it will close when you open another. I would like to fix that. here is the segment of code that i have. echo "<script> var newwindow; function poptastic(url) { newwindow=window.open(url,'name','height=400,width=400,scrollbars=yes,toolbars=no'); if (window.focus) {newwindow.focus()} } </script>"; $file3 = @str_replace("_"," ", "$file"); echo "<tr><td bgcolor=#B4B4B4><p align=center><a href=\"#\" onClick=\"poptastic('doc.php?f=$doc');\">$file3</p></td><td bgcolor=#B4B4B4>"; echo "<a href=move.php?f=$doc&fo=$folde>Move File</a></td><td bgcolor=#B4B4B4><a href=move.php?f=$doc&d=1>Delete File</a></td><td bgcolor=#B4B4B4><a href=sfile.php?f=$doc>Send File</a></td><td bgcolor=#B4B4B4><a href=doc.php?f=$doc&DD=1>Download</a></td></tr>";
  14. take the quotes out, you dont use the quotes with color codes, only with colors eg <font color=#FFFFFF> or <font color="Black">
×
×
  • 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.