Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. aww that is so easy thanks very much
  2. oh, and I just set the database to auto_increment
  3. so now I can just insert? like this: <?php $q = "INSERT INTO `home` (id, content, title) VALUES ('$id', '$content', '$title')"; mysql_query($q); ?> wait, I am confused. Would that be right (above).
  4. I would have to think you would need to email the programmer who made it, and ask them how you could do this.
  5. I am not familiar with that, is that a PHP function?
  6. I am not sure PHP is what you are looking for.
  7. How would I be able to pull the highest ID number from the database and add 1 to it? example: --ID-- --title-- --news-- 1 wel.. welcome to the website 2 hi this is an update .. .. .. 11 hello look at this so I would want to select the ID 11 and add 1 to it so it would become 12, and then I could insert it into the database. Thanks Guys
  8. I do not understand.
  9. ya, Servage lets me do remote or local, and they give me a special subdomain like: mysql_155.servage.com
  10. the database has to be set to allow remote users to logon. I suggest you do it all local, it much safer.
  11. ya this sounds so simple, a beginner could do it. Lets think for a second, Database would help A special page for teachers A special page for the students That would be all, then programming it all out. I could do this in about 30mins, but I am not.
  12. from what I would think, you would need to talk to the owners of Megaupload, and Rapidshare.
  13. move the start session to the very first line of your code, if that does not help check the white space around the opening and closing php tags, and as a last resort at this to the top of your code: ob_start();
  14. I got it fixed, the current code worked, lol I forgot to uplaod it Thanks guys
  15. oh I understand now, I changed it, and all it is echoing out is "page page page..." here is my current code now: <?php ob_start(); $path = ""; $title = "Register"; $login = "no"; $ban = "no"; include ($path."main/include/cons/head.php"); echo '<p class="header">Register</p>'; //$r = mysql_query("SELECT * FROM `pgs`"); //$row = mysql_fetch_array($r); $r = mysql_query("SELECT * FROM `pgs`") or die (mysql_error()); $row = mysql_fetch_assoc($r); if ($row['reg'] == (1)){ echo '<p class="maintext">Registation is disabled at the moment.</p>'; include ($path."main/include/cons/foot.php"); exit; } else { /* $q = mysql_query("SELECT * FROM `site_status`"); $db = mysql_fetch_array($q);*/ $r = mysql_query("SELECT * FROM `site_status`") or die (mysql_error()); $row = mysql_fetch_assoc($r); if ($row['pass_on_reg'] == ('1')){ if (!isset($_SESSION['pass'])){ echo "pass gate"; exit; } }else{ echo "page page page page"; } } include ($path."main/include/cons/foot.php");
  16. now nothing is being echoed out here is what I changed: <?php ob_start(); $path = ""; $title = "Register"; $login = "no"; $ban = "no"; include ($path."main/include/cons/head.php"); echo '<p class="header">Register</p>'; $r = mysql_query("SELECT * FROM `pgs`"); $row = mysql_fetch_array($r); if ($row['reg'] == ('1'){ echo '<p class="maintext">Registation is disabled at the moment.</p>'; include ($path."main/include/cons/foot.php"); exit; } else { $q = mysql_query("SELECT * FROM `site_status`"); $db = mysql_fetch_array($q); if ($db['pass_on_reg'] == (1){ if (!isset($_SESSION['pass'])){ echo "pass gate"; exit; } }else{ echo "page page page page"; } } include ($path."main/include/cons/foot.php"); the disabled one is a varchar, the other is a int I get a blank page now, why?
  17. na I have a head and a foot, and I set some variables like $login = "yes"; $path = "../../; echo '<a href="'.$path.'index.php">Login</a>'; and the php file loads the login for that page, I have had no problem yet using my method, but it is what you like best
  18. I usually take a pre made template from a free template website, or I will make my own, as if it was a html website, then I will put blocks of html code in php include to I can call the template with one include file.
  19. I been looking over and over this block of code for a while now, I think I need a fresh pair of eyes here is the code: <?php ob_start(); $path = ""; $title = "Register"; $login = "no"; $ban = "no"; include ($path."main/include/cons/head.php"); echo '<p class="header">Register</p>'; //Check to see if reg. is enabled //1=>disabled, 0=>enabled $r = mysql_query("SELECT * FROM `pgs`"); $row = mysql_fetch_array($r); if ($row['reg'] == ('1')){ echo '<p class="maintext">Registation is disabled at the moment.</p>'; include ($path."main/include/cons/foot.php"); exit; } else { //check to see if passgate is on //1=>on 0=>off $q = mysql_query("SELECT * FROM `site_status`"); $db = mysql_fetch_array($q); if($db['pass_on_reg'] == ('1')){ if (!isset($_SESSION['pass'])){ echo "pass gate"; exit; } }else{ echo "page page page page"; } } include ($path."main/include/cons/foot.php"); what is happening is I set a 1 in the database to enable the passgate, so the code should echo out "pass gate", but it does not, all it says is "page page..." am I doing somthing wrong? Thanks for the help..again. -Lamez
  20. I figured it out, I used headers redirects, and sessions here is my final code: register.php <?php ob_start(); $path = ""; $title = "Register"; $login = "no"; $ban = "no"; include ($path."main/include/cons/head.php"); echo '<p class="header">Register</p>'; $r = mysql_query("SELECT * FROM `pgs`"); $row = mysql_fetch_array($r); if ($row['reg'] == (0)){ echo '<p class="maintext">Register is disabled at the moment.</p>'; }else $r = mysql_query("SELECT * FROM `site_status`"); $row = mysql_fetch_array($r); if($row['pass_on_reg'] == ('1')){ if (!isset($_SESSION['pass'])){ //if($_SESSION['pass'] !== (1)){ header('Location: '.$path.'main/include/passgate.php'); //} }else ?> <SCRIPT TYPE="text/javascript"> function numbersonly(myfield, e, dec) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); // control keys if ((key==null) || (key==0) || (key== || (key==9) || (key==13) || (key==27) ) return true; // numbers else if ((("0123456789").indexOf(keychar) > -1)) return true; // decimal point jump else if (dec && (keychar == ".")) { myfield.form.elements[dec].focus(); return false; } else return false; } //--> </SCRIPT> <?php if($session->isAdmin()){ echo '<p class="maintext">Please use the <a href="'.$path.'_admin/admin.php">Admin Center</a></p>'; }else if($session->logged_in){ echo '<p class="maintext">Please Wait!</p>'; }else if(isset($_SESSION['regsuccess'])){ if($_SESSION['regsuccess']){ echo '<p class="maintext">You are now registered, you may <a href="'.$path.'>index.php">Login</a>.</p>'; } else{ echo '<p class="maintext">Regisration Error.<br /><a href="register.php">Try Again</a>?</p>'; } unset($_SESSION['regsuccess']); unset($_SESSION['reguname']); }else{ ?> <p class="maintext"> <font color="#FF0000">All fields are required.</font> <form action="<?php echo $path; ?>main/include/process.php" method="POST"> <table width="100%" height="186" border="0"> <tr> <td width="149" height="24">Username</td> <td width="154"><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>" /></td> <td width="1066"><? echo $form->error("user"); ?></td> </tr> <tr> <td height="24">Password</td> <td><input name="pass" type="password" id="pass" value="<? echo $form->value("pass"); ?>" maxlength="30" /></td> <td rowspan="2"><? echo $form->error("pass"); ?></td> </tr> <tr> <td height="24">ReType Password</td> <td><input name="pass2" type="password" id="pass2" value="<? echo $form->value("pass"); ?>" maxlength="30" /></td> </tr> <tr> <td height="24">E-Mail</td> <td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>" /></td> <td><? echo $form->error("email"); ?></td> </tr> <tr> <td height="24">First Name</td> <td><input type="text" name="first" maxlength="50" value="<? echo $form->value("first"); ?>" /></td> <td><? echo $form->error("first"); ?></td> </tr> <tr> <td height="24">Last Name</td> <td><input type="text" name="last" maxlength="50" value="<? echo $form->value("last"); ?>" /></td> <td><? echo $form->error("last"); ?></td> </tr> <tr> <td height="24" colspan="3"><font color="#666666">This will not be shared with anyone, this will only be use if we need to contact you. Ex: 8775551234 (with area code)</font></td> </tr> <tr> <td height="24">Phone Number</td> <td><input name="phone" type="text" id="phone" onkeypress="return numbersonly(this, event)" value="<? echo $form->value("phone"); ?>" maxlength="10" /></td> <td><? echo $form->error("phone"); ?></td> </tr> <tr> <td> </td> <td><input type="hidden" name="subjoin" value="1" /> <input name="submit" type="submit" value="Signup!" /></td> <td align="right"><a href="<?php echo $path; ?>support/forgotpass.php">Forgot Password?</a></td> </tr> </table> </form> </p> <?php } } include ($path."main/include/cons/foot.php"); ?> passgate.php <?php ob_start(); $path = "../../"; $title = "Register"; $login = "no"; $ban = "no"; include ($path."main/include/cons/head.php"); $r = mysql_query("SELECT * FROM `site_status`"); $row = mysql_fetch_array($r); if($row['pass_on_reg'] == ('1')){ echo '<p class="header">Register</p>'; ?> <p class="maintext"> <form action="" method="post" name="pw_gate"> <label> </label> <table width="336" border="0"> <tr> <td colspan="3">Please enter the password to continue</td> </tr> <tr> <td width="79">Password</td> <td width="156"><input name="password" type="password" id="password" maxlength="30"></td> <td width="87"><label> <input type="submit" name="register" id="register" value="Continue"> </label></td> </tr> </table> <label></label> </form> </p> <?php $submit = $_POST['register']; $pass = $row['reg_pass']; $npass = $_POST['password']; if (isset($submit)){ if ($pass === ($npass)){ session_start(); $_SESSION['pass'] = 1; // store session data header('Location: '.$path.'register.php'); }else{ echo "Incorrect Password"; } } }else{ header('Location: '.$path.'register.php'); } include ($path."main/include/cons/foot.php"); ?>
  21. I think I might have a solution, I will get back to you guys
  22. well dannyb785 when the user enters the correct password, I want it to goto the registration form, but I boggled on how to get this done, I have so many if and else statements in the script, I do not know what to do. GingerRobot: I am reading the page you replied with...
  23. well maybe you guys can help me out with this, <?php $path = ""; $title = "Register"; $login = "no"; $ban = "no"; include ($path."main/include/cons/head.php"); echo '<p class="header">Register</p>'; $r = mysql_query("SELECT * FROM `pgs`"); $row = mysql_fetch_array($r); if ($row['reg'] == (0)){ echo '<p class="maintext">Register is disabled at the moment.</p>'; }else{ $r = mysql_query("SELECT * FROM `site_status`"); $row = mysql_fetch_array($r); if($row['pass_on_reg'] == ('1')){ ?> <form action="" method="post" name="pw_gate"> <label> </label> <table width="336" border="0"> <tr> <td colspan="3">Please enter the password to continue</td> </tr> <tr> <td width="79">Password</td> <td width="156"><input name="password" type="password" id="password" maxlength="30"></td> <td width="87"><label> <input type="submit" name="register" id="register" value="Continue"> </label></td> </tr> </table> <label></label> </form> <?php if(isset($_POST['register'])){ if ($_POST['password'] == ($row['reg_pass'])){ echo "Correct Password"; //show register form some how? }else{ echo "Incorrect Password"; unset($_POST['register']); } } }else{ ?> <SCRIPT TYPE="text/javascript"> function numbersonly(myfield, e, dec) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); // control keys if ((key==null) || (key==0) || (key== || (key==9) || (key==13) || (key==27) ) return true; // numbers else if ((("0123456789").indexOf(keychar) > -1)) return true; // decimal point jump else if (dec && (keychar == ".")) { myfield.form.elements[dec].focus(); return false; } else return false; } //--> </SCRIPT> <?php if($session->isAdmin()){ echo '<p class="maintext">Please use the <a href="'.$path.'_admin/admin.php">Admin Center</a></p>'; }else if($session->logged_in){ echo '<p class="maintext">Please Wait!</p>'; }else if(isset($_SESSION['regsuccess'])){ if($_SESSION['regsuccess']){ echo '<p class="maintext">You are now registered, you may <a href="'.$path.'>index.php">Login</a>.</p>'; } else{ echo '<p class="maintext">Regisration Error.<br /><a href="register.php">Try Again</a>?</p>'; } unset($_SESSION['regsuccess']); unset($_SESSION['reguname']); }else{ ?> <p class="maintext"> <font color="#FF0000">All fields are required.</font> <form action="<?php echo $path; ?>main/include/process.php" method="POST"> <table width="100%" height="186" border="0"> <tr> <td width="149" height="24">Username</td> <td width="154"><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>" /></td> <td width="1066"><? echo $form->error("user"); ?></td> </tr> <tr> <td height="24">Password</td> <td><input name="pass" type="password" id="pass" value="<? echo $form->value("pass"); ?>" maxlength="30" /></td> <td rowspan="2"><? echo $form->error("pass"); ?></td> </tr> <tr> <td height="24">ReType Password</td> <td><input name="pass2" type="password" id="pass2" value="<? echo $form->value("pass"); ?>" maxlength="30" /></td> </tr> <tr> <td height="24">E-Mail</td> <td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>" /></td> <td><? echo $form->error("email"); ?></td> </tr> <tr> <td height="24">First Name</td> <td><input type="text" name="first" maxlength="50" value="<? echo $form->value("first"); ?>" /></td> <td><? echo $form->error("first"); ?></td> </tr> <tr> <td height="24">Last Name</td> <td><input type="text" name="last" maxlength="50" value="<? echo $form->value("last"); ?>" /></td> <td><? echo $form->error("last"); ?></td> </tr> <tr> <td height="24" colspan="3"><font color="#666666">This will not be shared with anyone, this will only be use if we need to contact you. Ex: 8775551234 (with area code)</font></td> </tr> <tr> <td height="24">Phone Number</td> <td><input name="phone" type="text" id="phone" onkeypress="return numbersonly(this, event)" value="<? echo $form->value("phone"); ?>" maxlength="10" /></td> <td><? echo $form->error("phone"); ?></td> </tr> <tr> <td> </td> <td><input type="hidden" name="subjoin" value="1" /> <input name="submit" type="submit" value="Signup!" /></td> <td align="right"><a href="<?php echo $path; ?>support/forgotpass.php">Forgot Password?</a></td> </tr> </table> </form> </p> <?php } } } include ($path."main/include/cons/foot.php"); ?> as you can see where is shows the echoed out correct password, some how I need to get to the registration form, but how?
  24. well I know about IF and ELSE statements and Loops statements, but I am in a jiffy with this script here, and I cannot find anyway around it.
  25. I am fairly new to php, but I was wondering is there some sorta goto command that will let me goto a certain part of the script under a certain label? I am working on a password gate, but the script is really dynamic so I was wondering is there a goto command? example: echo "correct"; goto form :form echo "register"; -Thanks
×
×
  • 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.