Jump to content

adamjones

Members
  • Posts

    172
  • Joined

  • Last visited

Everything posted by adamjones

  1. Well, I changed the code to this; <?php ob_start(); $host="localhost"; $username="domainey_x"; $password="pass"; $db_name="domainey_x"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $data=mysql_fetch_array($result); $access= $data['access']; $id= $data['id']; $name= $data['name']; $email= $data['email']; $number= $data['number']; $count=mysql_num_rows($result); if($count==1){ session_start(); $_SESSION['myusername'] = $myusername; $_SESSION['access'] = $access; $_SESSION['mypassword'] = $mypassword; $_SESSION['name'] = $name; $_SESSION['email'] = $email; $_SESSION['number'] = $number; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $lastlogin = $data['lastlogin']; session_register("lastlogin"); $DB_Query = @mysql_query("UPDATE `members` SET lastlogin=Now() WHERE username='$myusername'") OR die('MySQL error: '.mysql_error()); header("location:admin.php"); } else { echo "silly PHP "; } ob_end_flush(); ?> But it's still not registering.
  2. Ok. I changed it to; $_SESSION['myusername'] = $myusername; $_SESSION['access'] = $access; $_SESSION['mypassword'] = $mypassword; $_SESSION['name'] = $name; $_SESSION['email'] = $email; $_SESSION['number'] = $number; But it's still not registering them?
  3. Haha, session register being deprecated is hardly all of php Lol! I suppose not, but I'm just confused as to what I need to change?
  4. Right.. :s So, I need to like, re-learn all of PHP?
  5. Hi. I set up a CMS quite a while back, and it was all working fine, until about a week ago, when it just suddenly stopped echoing things, like usernames, last logins, etc.. I think it's just no longer registering the username, etc... But I haven't a clue why. Can anyone find out the problem? (This is the forum where username and password are posted to): <?php <?php ob_start(); $host="localhost"; $username="domainey_x"; $password="pass"; $db_name="domainey_x"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $data=mysql_fetch_array($result); $access= $data['access']; $id= $data['id']; $name= $data['name']; $email= $data['email']; $number= $data['number']; $count=mysql_num_rows($result); if($count==1){ session_register("myusername"); session_register("access"); session_register("mypassword"); session_register("name"); session_register("email"); session_register("number"); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $lastlogin = $data['lastlogin']; session_register("lastlogin"); $DB_Query = @mysql_query("UPDATE `members` SET lastlogin=Now() WHERE username='$myusername'") OR die('MySQL error: '.mysql_error()); header("location:admin.php"); } else { echo "Silly PHP. "; } ob_end_flush(); ?> It logs in, etc, just doesn't register anything! Cheers!
  6. Well, it wont echo out '<?php echo $secretq?>' And now, when I have just logged in, it doesn't echo out my username... Come to think of it, it's not echoing out anything?
  7. Hi. I'm making a form for users who have forgotten their password. Basically, they type in their username, and then 'checklost.php' puls their 'Secret Question' from the database. They fill in the answer, and if it matches with their chosen answer, they will then have the option to reset their password. Sounds pretty simple, but it won't work!! Here is the main form; <form name="form1" method="post" action="checklost.php"> <fieldset> <!--[if !IE]>start row<![endif]--> <div class="row"> <label>Username:</label> <span class="input_wrapper"> <input class="text" name="user" type="text" /> </span> </div> <!--[if !IE]>end row<![endif]--> <!--[if !IE]>start row<![endif]--> <!--[if !IE]>end row<![endif]--> <!--[if !IE]>start row<![endif]--> <!--[if !IE]>end row<![endif]--> <!--[if !IE]>start row<![endif]--> <div class="row"> <div class="inputs small_inputs"> <span class="button gray_button unlock_button"><span><span><em> <input name="apdiv" type="submit" /> Next Step</em></span></span></span> </div> </div> <!--[if !IE]>end row<![endif]--> </fieldset> </form> And this is 'checklost.php'; <?php ob_start(); $host="localhost"; $username="wowdream_hub"; $password="PASSWORD"; $db_name="wowdream_hub"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $user=$_POST['user']; $sql="SELECT * FROM $tbl_name WHERE username='$user'"; $result=mysql_query($sql); $data=mysql_fetch_array($result); $secretq= $data['serectq']; $secrera= $data['secreta']; $count=mysql_num_rows($result); if($count==1){ session_register("user"); session_register("secretq"); session_register("secreta"); header("location:step2.php"); } else { header("location:error.php"); } ob_end_flush(); ?> And this is where their secret question is echoed; <?PHP session_start(); if(!session_is_registered(secretq)){ header("location:index.php"); } ?> <form name="form1" method="post" action="checklost2.php"> <fieldset> <!--[if !IE]>start row<![endif]--> <div class="row"> <label><? echo $secretq ?>:</label> <span class="input_wrapper"> <input class="text" name="user" type="text" /> </span> </div> <!--[if !IE]>end row<![endif]--> <!--[if !IE]>start row<![endif]--> <!--[if !IE]>end row<![endif]--> <!--[if !IE]>start row<![endif]--> <!--[if !IE]>end row<![endif]--> <!--[if !IE]>start row<![endif]--> <div class="row"> <div class="inputs small_inputs"> <span class="button gray_button unlock_button"><span><span><em> <input name="apdiv" type="submit" /> Next Step</em></span></span></span> </div> </div> <!--[if !IE]>end row<![endif]--> </fieldset> </form> Can anyone see my problem? Cheers, Adam.
  8. Hi. I'm making a settings page where users can update their info, however, when submitting the form, it's just overwriting the old details with nothing... This is my code; <?php $host="localhost"; $username="designby_x"; $password="password"; $db_name="designby_x"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $name=$_GET['myusername']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?> <form name='form1' method='send' action='update_ac.php' id='formular' class='formular' rel='facebox'> <fieldset> <legend>Account Info</legend> <label> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="52%"><div align="left"><b>Your Password</b>:</div></td> <td width="48%"><div align="left"> <label> <input name="pass" type="password" id="pass" value="<? echo $rows['password']; ?>" /> </label> </div></td> </tr> </table> </fieldset></label> <fieldset> <legend>Personal Info</legend> <label> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="52%"><div align="left"><b>Name</b>:</div></td> <td width="48%"><div align="left"> <label> <input name="name" type="text" id="name" value="<? echo $rows['name']; ?>" /> </label> </div></td> </tr> <tr> <td><div align="left"><b>E-Mail address:</b></div></td> <td><div align="left"> <label> <input name="email" type="text" id="email" value="<? echo $rows['email']; ?>" /> </label> </div></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="22%"><label> <input type="submit" name="submit" id="submit" value="Update" /> </label></td> <td width="78%"><label> <input type="reset" name="Reset" id="Reset" value="Reset" /> </label></td> </tr> </table> <p> <label></label> (If you are having troubles clicking in the boxes, please use the 'tab' button, on your keyboard)</p> </fieldset> </form> This is update_Ac.php; <? session_start(); if(!session_is_registered(myusername)){ header("location:index.php"); } ?> <?php $host="localhost"; $username="designby_x"; $password="password"; $db_name="designby_x"; $tbl_name="members"; $name=$_POST['name']; $pass=$_POST['pass']; $email=$_POST['email']; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="UPDATE $tbl_name SET name='$name', password='$pass', email='$email' WHERE username='$myusername'"; $result=mysql_query($sql); if($result){ header("location:updated.php"); } else { header("location:editadminerror.php"); } ?> Can anyone see the problem? Cheers, Adam.
  9. Hi. I have this code; <?php session_start(); if ($frozenr == ) { echo("No reason given"); } else echo("$frozenr"); } ?> And get this error; Parse error: syntax error, unexpected ')' in /home/designby/public_html/clients/frozen.php on line 65
  10. Hi. I have this code; <?php mysql_connect("localhost", "designby_x", "password") or die(mysql_error()); mysql_select_db("designby_x") or die(mysql_error()); $result = mysql_query("SELECT * FROM members") or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { if($row['frozen'] == 'yes' WHERE ($row['username'] == '$myusername' { header('location:frozen.php'); } } ?> And I get this error; Parse error: syntax error, unexpected T_STRING in /home/designby/public_html/clients/home.php on line 14
  11. Ok. So I have a login form, and its posting to this page, where it checks the user and pass, and then registers sessions, etc; <?php ob_start(); $host="localhost"; $username="wowdream_molten"; $password="password"; $db_name="wowdream_molten"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $data=mysql_fetch_array($result); $access= $data['access']; $id= $data['id']; $count=mysql_num_rows($result); if($count==1){ session_register("myusername"); session_register("access"); session_register("mypassword"); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $lastlogin = $data['lastlogin']; session_register("lastlogin"); $DB_Query = @mysql_query("UPDATE `members` SET lastlogin=Now() WHERE username='$myusername'") OR die('MySQL error: '.mysql_error()); header("location:community.php"); } else { header("location:loginerror.php"); } ob_end_flush(); ?> Just wondering how to make it redirect to an error page, if the username is already registered in the database? Regards.
  12. Hi. Yes, there is a row called theme, with is the primary row, and in it 'christmas'. Adam.
  13. My table structure is; CREATE TABLE IF NOT EXISTS `theme` ( `theme` varchar(65) NOT NULL default 'christmas', PRIMARY KEY (`theme`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; ...if that helps?
  14. @ Maq: Notice: Undefined variable: data in /home/wowdream/public_html/index.php on line 17 which is this line: print ("location:{$data['theme']}/");
  15. It's so admins can set a theme in the admin panel, eg: christmas, easter, etc.. ...and the output is: location:/
  16. Hi. I have this code; <?php $DB_Server = 'localhost'; $DB_Username = 'wowdream_db'; $DB_Password = 'pass'; $DB_Name = 'wowdream_db'; $DB_Conn = @mysql_connect($DB_Server, $DB_Username, $DB_Password) OR die('MySQL error: '.mysql_error()); @mysql_select_db($DB_Name) OR die('MySQL error: '.mysql_error()); $DB_Query = @mysql_query("SELECT * FROM `theme`") OR die('MySQL error: '.mysql_error()); while ($data = mysql_fetch_array($DB_Query)) { $data['theme'] = nl2br($data['theme']); header("location:{$data['theme']}/"); } ?> It's meant to redirect to 'whatever_the_theme_is/', but it isn't redirecting. Can anyone help?
  17. Hi. So, I have this code; <?php $DB_Query = @mysql_query("SELECT * FROM `news` WHERE 1 ORDER BY `ID` DESC") OR die('MySQL error: '.mysql_error()); ?> But I want it to only echo the last 2 entries. How can I achieve this? Adam.
×
×
  • 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.