Jump to content

vixtay

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vixtay's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for your patience Nathan, really appreciate it. I am trying to learn php as I can see the great benefits of it. Where would I put that, I really do not know mate I am sorry, I am a complete newbie to all this. If it's easier for you I can show you the website and you can login yourself and see what it is I am trying to achieve. Chris
  2. sorry mate, I cut and pasted that straight into the login.php as you suggested and all I get is blank white page titled login.php even tried putting user1, user2, user3, user4 and user5 in the ($id== "1") and still the same.
  3. Thank you WatsonN that does look more like it, where exatly would I put that in the myaccount.php code? is it here:I cant see where it would go. Thank you If I made 5 duplicate myaccount.php pages and named them user1.php, user2.php etc. wouldn't I be able to just put there individual stuff on each of those pages while maintaining there own personal welcome details? If so, the code you suggest above, would that go into the login.php script instead? if so where exactly please
  4. here is the myaccount.php <?php include 'dbc.php'; page_protect(); ?> <html> <head> <title>My Account</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td colspan="3"> </td> </tr> <tr> <td width="160" valign="top"> <?php /*********************** MYACCOUNT MENU **************************** This code shows my account menu only to logged in users. Copy this code till END and place it in a new html or php where you want to show myaccount options. This is only visible to logged in users *******************************************************************/ if (isset($_SESSION['user_id'])) {?> <div class="myaccount"> <p><strong>My Account</strong></p> <a href="myaccount.php">My Account</a><br> <a href="mysettings.php">Settings</a><br> <a href="logout.php">Logout </a> <p>You can add more links here for users</p></div> <?php } if (checkAdmin()) { /*******************************END**************************/ ?> <p> <a href="admin.php">Admin CP </a></p> <?php } ?> <p> </p> <p> </p> <p> </p></td> <td width="732" valign="top"><p> </p> <h3 class="titlehdr">Welcome <?php echo $_SESSION['user_name'];?></h3> <?php if (isset($_GET['msg'])) { echo "<div class=\"error\">$_GET[msg]</div>"; } ?> <p>This is the my account page</p> </td> <td width="196" valign="top"> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </body> </html>
  5. All this is for is so that clients can login and select pictures from one page of their pictures on a normal html page. All I want to do and I do not know how to is let them log straight to their page of pics. I do not know much about php and am using someones elses free php login system. It all works ok and logs people in but doesn't exactly do what I want it to do.
  6. Thank you, yes that would be good if it worked for me but it doesn't. All users same to come to the same myaccount page. They all have just 1 page of their own stuff that I want them to see instead of seeing other members stuff. There would not be any more than 5 seperate users at any one time and they login with a username i.e. user1, user2 etc. and a password. I create these in the admin section when logged in, so in otherwords, I give them the username and password and activate them.
  7. Thank you Micah for the reply. Basically each of the users will only have to access one page that is relevant only to them, i.e. their pictures. Could you give me an example of how it would look with the usern names and page names as user1, user2, user3, user4 and user5 please linking to pages user1.php, user2.php, user3.php etc. This would be a great help if I could just cup and paste it into my form. The account details in not necessary so would probably omit them from the user1.php actual page. All I want is that when user1 logs in he will get sent to user1.php and when user2 logs in he will be sent to user2.php instead of the current format that sends them to myaccount.php Thank you very much for your help Chris
  8. Hi I am new to php and I have a login form for users that works ok with a mysql database table for users. The problem I have is that it only takes all loggedin users to the same page and I want to take logged in users to their own page. I should have no more than 5 users at anyone time and for example I will call them simply user1, user2, user3, user4 and user 5. I want user1 to go to user1.php, user2 to go to user2.php and so on. The login.php code is as follows, can someone please tell me in laymans terms how to change it to accommodate this: <?php include 'dbc.php'; $err = array(); foreach($_GET as $key => $value) { $get[$key] = filter($value); //get variables are filtered. } if ($_POST['doLogin']=='Login') { foreach($_POST as $key => $value) { $data[$key] = filter($value); // post variables are filtered } $user_email = $data['usr_email']; $pass = $data['pwd']; if (strpos($user_email,'@') === false) { $user_cond = "user_name='$user_email'"; } else { $user_cond = "user_email='$user_email'"; } $result = mysql_query("SELECT `id`,`pwd`,`full_name`,`approved`,`user_level` FROM users WHERE $user_cond AND `banned` = '0' ") or die (mysql_error()); $num = mysql_num_rows($result); // Match row found with more than 1 results - the user is authenticated. if ( $num > 0 ) { list($id,$pwd,$full_name,$approved,$user_level) = mysql_fetch_row($result); if(!$approved) { //$msg = urlencode("Account not activated. Please check your email for activation code"); $err[] = "Account not activated. Please check your email for activation code"; //header("Location: login.php?msg=$msg"); //exit(); } //check against salt if ($pwd === PwdHash($pass,substr($pwd,0,9))) { if(empty($err)){ // this sets session and logs user in session_start(); session_regenerate_id (true); //prevent against session fixation attacks. // this sets variables in the session $_SESSION['user_id']= $id; $_SESSION['user_name'] = $full_name; $_SESSION['user_level'] = $user_level; $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); //update the timestamp and key for cookie $stamp = time(); $ckey = GenKey(); mysql_query("update users set `ctime`='$stamp', `ckey` = '$ckey' where id='$id'") or die(mysql_error()); //set a cookie if(isset($_POST['remember'])){ setcookie("user_id", $_SESSION['user_id'], time()+60*60*24*COOKIE_TIME_OUT, "/"); setcookie("user_key", sha1($ckey), time()+60*60*24*COOKIE_TIME_OUT, "/"); setcookie("user_name",$_SESSION['user_name'], time()+60*60*24*COOKIE_TIME_OUT, "/"); } header("Location: myaccount.php"); } } else { //$msg = urlencode("Invalid Login. Please try again with correct user email and password. "); $err[] = "Invalid Login. Please try again with correct user email and password."; //header("Location: login.php?msg=$msg"); } } else { $err[] = "Error - Invalid login. No such user exists"; } } ?>
  9. Thank you again for the advice. Through trial and error I have no got the form to connect to the database, it seemed I simply had the password wrong!! So I have changed it and now the form is visable here: http://www.southwalespropertysolutions.com/insertinfo.php But the form does not input the data into the members table. Can you please take a look below and see why this is and how I correct it. I also want to link to this page when the registration is successful, what do I put in for this and where please: http://www.southwalespropertysolutions.com/thanks.php Here is the current code that gets the form to at least be seen. <?php //Connect To Database $hostname="vixtay.db.4394481.hostedresource.com"; $username="vixtay"; $password="password"; $dbname="vixtay"; $usertable="members"; mysql_connect($hostname,$username, $password) or die ("<html><script language='JavaScript'>alert('Unable to connect to database! Please try again later.'),history.go(-1)</script></html>"); mysql_select_db($dbname); $sql="INSERT INTO MEMBERS (Name, Telephone, Email, Username, Password) VALUES('$_POST[name]','$_POST[telephone]','$_POST','$_POST[username]','$_POST[password]')))"; if($result) { while($row = mysql_fetch_array($result)) { $name = $row["$yourfield"]; echo "Name: ".$name."<br>"; } } ?> <html> <body> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Name:</div></td> <td><input name="Name" type="text" value="" size="40" maxlength="40" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Telephone:</div></td> <td><input name="Telephone" type="text" value="" size="15" maxlength="15" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Email:</div></td> <td><input name="Email" type="text" value="" size="40" maxlength="40" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Username:</div></td> <td><input name="Username" type="text" value="" size="25" maxlength="25" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Password:</div></td> <td><input name="Password" type="password" value="" size="25" maxlength="25" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left"></div></td> <td><input type="submit" value="Register" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> </body> </html>
  10. Hi thanks for your suggestions. I just tried it with VixtayDatabase and by putting . mysql_error()); in and this is what I get: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'vixtay'@'72.167.232.219' (using password: YES) in D:\Hosting\4394481\html\insertinfo.php on line 11 Unable to connect to database! Please try again later.Access denied for user 'vixtay'@'72.167.232.219' (using password: YES) Why am I getting this and in particular D:\hosting\4394481\html\insertinfo.php on line 11 because I have uploaded the insertinfo.php to the host server
  11. This is the info on GoDaddy under MySql: Status:Setup Host Name:vixtay.db.4394481.hostedresource.com Database Name:vixtayDatabase Version:5.0 Description:Registrations User Name:vixtay DSN:Pending Setup Just to show that there is an actual database and it is all setup. I could really do with some help here guys as I am going to need a few php forms for this such as login check users etc. and the most important one is this one as it will be linked to a register form. The one below works perfect on localhost, can anyone help me change this one to work on GoDaddy? <?php require_once('Connections/vixtay.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO registrants (Name, Telephone, Email, Username, Password) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_POST['Name'], "text"), GetSQLValueString($_POST['Telephone'], "text"), GetSQLValueString($_POST['Email'], "text"), GetSQLValueString($_POST['Username'], "text"), GetSQLValueString($_POST['Password'], "text")); mysql_select_db($database_vixtay, $vixtay); $Result1 = mysql_query($insertSQL, $vixtay) or die(mysql_error()); $insertGoTo = "thanks.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_vixtay, $vixtay); $query_register = "SELECT Name, Telephone, Email, Username, Password FROM registrants"; $register = mysql_query($query_register, $vixtay) or die(mysql_error()); $row_register = mysql_fetch_assoc($register); $totalRows_register = mysql_num_rows($register); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Register</title> <style type="text/css"> <!-- .style2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; } --> </style> </head> <body> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Name:</div></td> <td><input name="Name" type="text" value="" size="40" maxlength="40" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Telephone:</div></td> <td><input name="Telephone" type="text" value="" size="15" maxlength="15" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Email:</div></td> <td><input name="Email" type="text" value="" size="40" maxlength="40" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Username:</div></td> <td><input name="Username" type="text" value="" size="25" maxlength="25" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left" class="style2">Password:</div></td> <td><input name="Password" type="password" value="" size="25" maxlength="25" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><div align="left"></div></td> <td><input type="submit" value="Register" /></td> </tr> </table> <p> <input type="hidden" name="MM_insert" value="form1" /> </p> </form> <p> </p> <p> </p> </body> </html> <?php mysql_free_result($register); ?>
  12. I have just logged into it to double check and the database is definately there and called vixtay with one table called members. What I did notice in the home page was that it had User: MYUSERNAME@72.167.233.37 That is all I can see everything is correct, i.e. the database name, the Hostname, my password etc.
  13. Hi everyone, I am completely new to PHP and trying very hard to teach myself how to use it as I am stepping up to database websites. I have created an MySQL database on GoDaddy and a duplicate on my laptop with phpmyadmin. Both are ok. I set up a testing server in Dreamweaver for the one on my laptop to try out an input info form and it worked perfectly. I have a connection to the database on localhost and the data from the form inserted into the datbase perfectly. Now I need to adapt that same form to do exactly the same but input info in my database on GoDaddy. I have looked on their help section and used the example that they give. But to no joy, I cannot connect to the datbase despite using the correct login details so I am assuming it must be somehting I am doing wrong with the PHP coding. Can someone please take a look at this and tell me where I am going wrong. Many thanks in anticipation. I have changed the actual details with capitals to show you. <?php //Connect To Database $hostname="HOSTNAME PROVIDED BY GoDADDY.hostedresource.com"; $username="MY USERNAME"; $password="MY PASSWORD"; $dbname="vixtay.db"; $usertable="members"; mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.'); mysql_select_db($dbname); $sql="INSERT INTO registrants (Name, Telephone, Email, Username, Password) VALUES ('$_POST[name]','$_POST[telephone]','$_POST','$_POST[username]','$_POST[password]')))"; if($result) { while($row = mysql_fetch_array($result)) { $name = $row["$yourfield"]; echo "Name: ".$name."<br>"; } } ?> <html> <body> <form action="http://www.southwalespropertysolutions.com/insertinfo.php" method="post"> <table width="300" border="1"> <tr> <td>Name:</td> <td><input name="name" type="text" id="name" size="40" /></td> </tr> <tr> <td>Telephone:</td> <td><input name="telephone" type="text" id="telephone" size="40" /></td> </tr> <tr> <td>Email:</td> <td><input name="email" type="text" id="email" size="40" /></td> </tr> <tr> <td>Username:</td> <td><label> <input name="username" type="text" id="username" size="40"> </label></td> </tr> <tr> <td>Password:</td> <td><label> <input name="password" type="text" id="password" size="40"> </label></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td> </td> <td><input type="submit" /></td> </tr> </table> <p> </p> <p> </p> <p> </p> <p> </p> </form> </body> </html>
×
×
  • 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.