fife
Members-
Posts
381 -
Joined
-
Last visited
Everything posted by fife
-
basically I need some java script that loops my php within that div every 5 seconds but also swipes off to the left or right of the div before looping again.
-
I cant thank you enough for writing me some code (which works might i add) but, its not what I need it for. I basically need it to show me four records from my query. Then the next four records from the list, then the next four records again and so. The code above only refreshes the first table. As the other three tables are created dynamically in php the java code does not refresh them.
-
Hi. This is my first dip into java so I don't really know what im talking about just yet. The issue is this. I have a php loop running on my page which basically select all the records in my database and shows them inline one after the other. Now I want the java to show only 4 records (as that's all i can fit in my div) and then after a few seconds wipe those 4 records away and show another 4 records. I've looked at many different jquery pluggins as jquery is all I understand at the moment. I found jcaroseal and agilecarousel but they are too advanced for me at the moment. I can use however jquery cycle but that does not support what I needed for the query I am running. Can anybody point me in the right direction as to the script to look into please as I'm completely lost Here is my query in php; <?php $qGetUsers = "SELECT * FROM business ORDER BY rand() "; $rGetUsers = mysql_query($qGetUsers) or die(mysql_error()); while($allUsers = mysql_fetch_array($rGetUsers)) { ?> <table id="top4tbl" width="150px" height="140px" border="0" cellpadding="0" cellspacing="5"> <tr> <td width="150" height="20"><div align="center"><img src="<?php echo $allUsers['image_location'];?>" /> </div></td> </tr> <tr> <td width="150" height="20"><div align="center"><strong><?php echo $allUsers['Business_name'];?> </strong></div></td> </tr> <tr> </tr> <tr> <td width="150" height="20"><div align="center"><a href="businessinformation.php?businessid=<?php echo $allUsers['businessid'];?>">More Info</a></div></td> </tr> </table> <?php } ?>
-
Hi right here is the code I have. For some reason it is not working but not erroring either. Im basically trying to show a table but only if there are 2 or more records in the database. <?php $qGetUsers = "SELECT * FROM business WHERE cat1='".$BusinessInfo['cat1']."' AND businessid!='".$BusinessInfo['businessid']."' ORDER BY rand() LIMIT 4"; $rGetUsers = mysql_query($qGetUsers) or die(mysql_error()); while($allUsers = mysql_fetch_array($rGetUsers)) if( mysql_num_rows($rGetUsers) => 2 ) { ?> <p>Display table</p> <?php } else { ?> <p>No more available</p> <?php } ?>
-
Hi I was wondering if someone could help. There is some code I would like but I have no idea what to search the net for to learn it. Basically I have a query which finds a record in my database. Now, I want another query which says that if there are more than two or more records in the database returned display table 1, if less than 2 display table 2. Can someone please point me in the right direction?
-
thank you for your help works great.
-
Hi I am trying to perform an echo yes if field from query is equal to one or no if anything else. See the code below, Now its erroring saying unexpected t variable in string and its also saying expecting ' It seems to be erroring at the start of my IF statement. So can anyone please help with what I have done wrong. This will be my first personal written IF statement so if it is miles off i apologise. <?php $qGetCat = ("SELECT * FROM category ORDER BY `id`"); $rGetCat = mysql_query($qGetCat) or die(mysql_error()); while($Cat = mysql_fetch_assoc($rGetCat)) { ?> <td height="31" align="left" nowrap="nowrap"><?= $Cat['id'] ?></td> <td align="left" nowrap="nowrap"><?= $Cat['cat1'] ?></td> <td align="left" nowrap="nowrap"> <?php if $Cat['top']='1' { echo "Yes";} else { echo "No";} ?> </td> <td><a href="updatetopcategory.php?=<?= $Cat['id'] ?>"><img src="../images/Edit.png" width="29" height="29" /></a></td> <td><img src="../images/delete.jpg" width="29" height="29" /></td> <? } ?>
-
Hi. I have wrote a simple login script. Works perfectly. Now as my users can only register one email address at the minute if you register two the same you get the default sql error pop up. I want my own error so at the beginning of my script i wrote the following code. however. It does not seem to be running. It does not create an error but still allows duplicate emails in the database. can anyone see the error of my ways? <?php session_start(); if(isset($_POST['create'])){ //script for checking if the email account already exists $qCheckEmail = "SELECT * FROM members WHERE email='".$_POST['email']."'"; $rCheckEmail = mysql_query($qCheckEmail); $Email = mysql_fetch_array($rCheckEmail); if($_POST['email'] == $Email['email']) {$emailDup = "This email account has already been registered";} else { //Process data for validation $forename = trim($_POST['forename']); $surname = trim($_POST['surname']); $email = trim($_POST['email']); $password = trim($_POST['password']); $gender = trim($_POST['gender']); $birthday = $_POST['birthday']; $creationdate = $_POST['creationdate']; $validationID = $_POST['validationID']; $accesslevel = trim($_POST['accesslevel']); $accountType = trim($_POST['accountType']); // then the rest of the login script here
-
Hi I was just wondering if someone could send me a good tutorial on pulling several fields from a table and displaying them all in one drop down menu for people to select one of them. I dont know what this is called to I dont know what to research online.
-
sorry i was being distracted by my boss then who thinks he knows the issue but really he has no idea. Here is the proper connect file again, <?php $hostname_thebizconnect = "name"; $database_thebizconnect = "name"; $username_thebizconnect = "user"; $password_thebizconnect = "password"; $thebizconnect = mysql_pconnect($hostname_thebizconnect, $username_thebizconnect, $password_thebizconnect) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_thebizconnect); ?> Basically whats going on was my boss was trying to prove that merging dreamweaver code with your own code is quicker than writing your own! Don't get me wrong i preffer to write my own but now we have started and ended up with this issue. I really want to know the error so I can then say to him "see, here is the error! Wouldn't it have been much quicker to write my own code" lol. Anyway, now I'm getting the internal server error 500. Like its trying to send but failing somewhere.
-
<?php $hostname_thebizconnect = "name"; $database_thebizconnect = "database"; $username_thebizconnect = "user"; $password_thebizconnect = "password"; $thesite = mysql_pconnect($hostname_name, $username_thebizconnect, $password_thesite) or trigger_error(mysql_error(),E_USER_ERROR); ?>
-
Hey yes I'm sorry thats not the issue. It was just the way i posted the code. My original is not missing that in the code. I still have the no database selected
-
Hi. I have built a form on a page call join.php On this form I pass a variable in this manner; $url = "thankyou.php?val_id=".$validation.""; header("Location: {$url}"); So on the next page (which is the thankyou for registering page I want this page on load to find the user from the $validation and then email the user. I have done this many times but for some reason this time the output is "No database selected!" There really is though. Also I can see in the browser window the code I have passed so its not like that is not working! Here is the code, can anyone see my error because I just have no idea whats up! <?php include(thedatabase.php'); session_start(); $val_id = $_GET['val_id']; $FullRec__query=sprintf("SELECT * FROM users WHERE val_id= %s", $val_id); $FullRec = mysql_query($FullRec__query) or die(mysql_error()); $userInfo = mysql_fetch_array($FullRec); $user = $userInfo['username']; mail($userInfo['email'],"Validation Link From Us","Dear ".$userInfo['username'].",\n\nThank you for signing up to www.thesite.co.uk. Please find below you validation link to gain access to the site.\n\n link:\nhttp://www.thesite.co.uk/val_entrance.php?validation_id=" . $_GET['val_id'] . "\n\nTeam site\n\n\n\nFor a full list of terms and conditions please go to the main area on your page and click the terms at the bottom of the page!"); ?>
-
Thank you very much for your help
-
Hello. I have a quick question. In my database I have Business's and members. I want the business to be able to advertise to members in their local area (lets say within 30 miles) for a cost. When a member within that distance of the office logs on they see this advert. Outside this distance they do not. Obviously the best way to do this is by postcode of the business compared to the member. I'm basically after some advise as I have been all over the internet looking for answers. First of all is it possible to write this script and what type of functions do I need to learn to do this? Second of all does anybody know of software that can do this out there already? I have found some but they are actual written programs with their own GUI that can not be changed to suit my needs. Thank you
-
session_start(); $validation_id = strval(time()); if(isset($_POST['submit'])){ //Process data for validation $first_name = trim($_POST['first_name']); $last_name = trim($_POST['last_name']); $DOB = trim($_POST['DOB']); $sex = trim($_POST['sex']); $email = trim($_POST['email']); $username = trim($_POST['username']); $password = trim($_POST['password']); $agree = trim($_POST['agreed']); $creation_date = trim($_POST['creation_date']); $usertype = trim($_POST['usertype']); $access_level = trim($_POST['today_is']); $validation = trim($_POST['to']); $jobs = trim($_POST['jobs']); //Perform validations $errors = array(); if(empty($first_name)) { $errors[] = "Please enter a first name"; } if(empty($last_name)) { $errors[] = "Please enter a surname"; } if(empty($DOB)) { $errors[] = "Please enter your date of birth."; } else if(!(preg_match("/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/", $DOB))) { $errors[] = "Please enter your birthday in the format dd/mm/yyyy"; } if(empty($email)) { $errors[] = "Please enter a correct email."; } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ $errors[] = "Please enter a valid email [email protected]"; } if(empty($username)) { $errors[] = "Please enter a username."; } if(strlen($password)<6) { $errors[] = "Please enter a password greater than 6 characters long."; } //Check if there were errors if(count($errors)===0) { //Prepare data for db insertion $first_name = mysql_real_escape_string($first_name); $last_name = mysql_real_escape_string($last_name); $DOB = mysql_real_escape_string($DOB); $sex = mysql_real_escape_string($sex); $email = mysql_real_escape_string($email); $username = mysql_real_escape_string($username); $password = md5($password); $agree = mysql_real_escape_string($agree); $creation_date = mysql_real_escape_string($creation_date); $usertype = mysql_real_escape_string($usertype); $access_level = mysql_real_escape_string($access_level); $validation = mysql_real_escape_string($validation); $jobs = mysql_real_escape_string($jobs); //switch date around for database insertion $date_parts = explode('/', $DOB); $DOB_new = "{$date_parts[2]}/{$date_parts[1]}/{$date_parts[0]}"; //script for checking if the email account already exists $CheckEmail = "SELECT * FROM Members WHERE email='".$email."'"; $EmailQuery = mysql_query($CheckEmail); $Emailresult = mysql_fetch_array($EmailQuery); $GotEmail = mysql_num_rows($EmailResult); if($GotEmail != 0) { $emailDup = "This email account has already been registered"; } else { //run the rest of my scripts //insert $query = "INSERT INTO Members (`first_name`, `last_name`, `DOB`, `sex`, `email`, `username`, `password`, `agree`, `creation_date`, `usertype`, `access_level`, `validationID`,`jobs`) VALUES ('{$first_name}', '{$last_name}', '{$DOB_new}', '{$sex}', '{$email}', '{$username}', '{$password}', '{$agree}', '{$creation_date}', '{$usertype}', '{$access_level}', '{$validation}', '{$jobs}')"; $result= mysql_query($query) or die(mysql_error()); //send validation to the thankyou page $url = "thankyou.php?to={$validation}"; header("Location: {$url}"); exit(); } } } then in the middle of the page i have my echo $emailDup
-
i will post my full code now
-
basically I get this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/yourarena.co.uk/public_html/member_join.php on line 25 which which is this line $GotEmail = mysql_num_rows($EmailResult);
-
Hello im trying to write a simple script so that before my website inserts an account into the database it checks to see if that email already exists. Heres what i got but it does not work. //script for checking if the email account already exists $CheckEmail = "SELECT * FROM Members WHERE email='".$email."'"; $EmailQuery = mysql_query($CheckEmail); $Emailresult = mysql_fetch_array($EmailQuery); $GotEmail = mysql_num_rows($EmailResult); if($GotEmail != 0) { $emailDup= "This email account has already been registered"; } else { //run the rest of my scripts later down the page I have this to echo the message <? if($GotEmail)==1 echo $emailDup; ?>
-
What a dumb mistake. i think I've gone code blind. Break time! Cheers guys
-
Hello. Basically I've created a login script. Works great. It sends users to different locations depending on what type of user they are. Now I have also created a Members account. Upon logging in this user should go to the members area. That all works fine! In the login script i stored a few session variable like username, access_level and so on. Now in the members area I am trying to make the page echo the name of the current user. I have been stairing at my code too long and can no longer see why nothing is echo'ing. Any ideas. I thought that the session_start() would continue the session in the next page and throughout the site until the person logs off and runs the session_destroy()! Is this not correct. First ill post the login script <?php include('database.php'); session_start(); if(isset($_POST['submit3'])) { $email = stripslashes($_POST['email3']); $password = stripslashes($_POST['password3']); $email = mysql_real_escape_string($_POST['email3']); $password = md5($password); $CheckUser = "SELECT * FROM Members WHERE email='".$email."' AND password='".$password."'"; $userDetails2 = mysql_query($CheckUser); $userInfo = mysql_fetch_array($userDetails2); $count = mysql_num_rows($userDetails2); if($count != 0) { $_SESSION['username'] = $userInfo['username']; $_SESSION['usertype'] = $userInfo['usertype']; $_SESSION['access_level']= $userInfo['access_level']; if($userInfo['usertype']== 'Member') { header('Location: members/index.php'); } else if($userInfo['usertype'] == 'Owner') { header('Location: owner/index.php'); } else if($userInfo['usertype'] == 'Corporation') { header('Location: corporation/index.php'); } else if($userInfo['usertype'] == 'Administrator') { header('Location: owner/admin/index.php'); } else if($userInfo['usertype'] == 'Staff') { header('Location: owner/staff/index.php'); } } else { $message = "incorrect login details"; } } ?> now ill post the members page <?php include('../database.php'); session_start(); ?> <head> <link href="stylz.css" rel="stylesheet" type="text/css" /> <link href="reset.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> WELCOME TO THE MEMBERS AREA <?php $_SESSION['username']; ?> <?php include('../title.php');?> <?php include('../nav.php');?> <div id="test"></div> <?php include('../footer.php');?> </div> </body> </html>
-
I said there were no errors appearing in the code but I was wrong there is an error but it appears at the bottom of the page in the source code. Problem is when i google the answer there is no actual solution. They all seem to be different. here is the error Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively What is this? Here is my code again <?php include('Connections/YA1.php'); session_start(); ?> <?php if(isset($_POST['submit3'])) { $email = mysql_real_escape_string($_POST['email3']); $password = md5($_POST['password3']); $qCheckUserInfo = "SELECT email, password FROM Members WHERE email='$email' AND password='$password'"; $userInfo = mysql_query($qCheckUserInfo); if($userInfo && mysql_num_rows($userInfo) == 1) { $success = 1; $_SESSION['logged'] = 1; $_SESSION['username'] = $userInfo['username']; $_SESSION['first_name'] = $userInfo['first_name']; $_SESSION['last_name'] = $userInfo['last_name']; $_SESSION['email'] = $userInfo['email']; $_SESSION['usertype'] = $userInfo['usertype']; $_SESSION['access_level']= $userInfo['access_level']; echo $_SESSION['first_name']; if($_SESSION['usertype']== 'Member') { header('Location: member/index.php'); } else if($_SESSION['usertype'] == 'Owner') { header('Location: owner/index.php'); } else if($_SESSION['usertype'] == 'Corporation') { header('Location: corporation/index.php'); } else if($_SESSION['usertype'] == 'Administrator') { header('Location: owner/admin/index.php'); } else if($_SESSION['usertype'] == 'Staff') { header('Location: owner/staff/index.php'); } } else { $message = "Incorrect login details"; $success = 0; } } ?> <link href="stylz.css" rel="stylesheet" type="text/css" /> <link href="reset.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="title_box"> <div id="logo"><img src="images/site_images/your_arena.jpg" /></div> <div id="login_box"> <?php if($success != 1 && !($_SESSION['logged'])) { ?><?php if($success==0) { echo $message; } ?> <form name="login" method="post"> <label for="email3">Username:</label><br/> <input type="text" name="email3" id="email3" value="<?php echo $_POST['email3']; ?>" /><br/> <label for="password3">Password:</label><br/> <input type="password" name="password3" id="password3" /><br/> <br /> <input type="submit" name="submit3" id="submit3" value="Log In" /> <? } ?> </form> </div> </div> <?php include('nav.php');?> <div id="test">main page </div> <?php include('footer.php');?> </div> </body> </html>
-
yes my table structure consists of username var (50) email var (100) password var (50) and obviously all the other fields too.
-
Right I understand the code you wrote and yes thats a much better way to write it so. I incorporated your code with my old code and came up with the code below. Yet the same $error i wrote displays even if the right details are typed into the form. Any suggestions????? <?php include('Connections/database.php'); session_start(); ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The only 1</title> <?php if(isset($_POST['submit3'])) { $email = mysql_real_escape_string($_POST['email3']); $password = md5($_POST['password3']); $qCheckUserInfo = "SELECT email, password FROM Members WHERE email='$email' AND password='$password'"; $rCheckUserInfo = mysql_query($qCheckUserInfo); $result = mysql_num_rows($rCheckUserInfo); if($result && mysql_num_rows($result) == 1) { $success = 1; $_SESSION['logged'] = 1; $_SESSION['username'] = $userInfo['username']; $_SESSION['first_name'] = $userInfo['first_name']; $_SESSION['last_name'] = $userInfo['last_name']; $_SESSION['email'] = $userInfo['email']; $_SESSION['usertype'] = $userInfo['usertype']; $_SESSION['access_level']= $userInfo['access_level']; if($_SESSION['usertype']== 'Member') { header('Location: member_join.php'); } else if($_SESSION['usertype'] == 'Owner') { header('Location: owner/index.php'); } else if($_SESSION['usertype'] == 'Corporation') { header('Location: corporation/index.php'); } else if($_SESSION['usertype'] == 'Administrator') { header('Location: owner/admin/index.php'); } else if($_SESSION['usertype'] == 'Staff') { header('Location: owner/staff/index.php'); } } else { $message = "Incorrect login details"; $success = 0; } } ?> <link href="stylz.css" rel="stylesheet" type="text/css" /> <link href="reset.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="title_box"> <div id="logo"><img src="images/site_images/your_arena.jpg" /></div> <div id="login_box"> <?php if($success != 1 && !($_SESSION['logged'])) { ?><?php if($success==0) { echo $message; } ?> <form name="login" method="post"> <label for="username">Username:</label><br/> <input type="text" name="email3" id="email3" value="<?php echo $_POST['email3']; ?>" /><br/> <label for="password">Password:</label><br/> <input type="password" name="password3" id="password3" /><br/> <br /> <input type="submit" name="submit3" id="submit3" value="Log In" /> <? } ?> </form> </div> </div> <?php include('nav.php');?> <div id="test">main page </div> <?php include('footer.php');?> </div> </body> </html>
-
Hi I suppose my post consists of two questions really. The first being, when I try and login with an account that stored in the database (password is stored in md5 format) I get no syntax errors but I get my $error message of login details incorrect. I know for sure they are not as I have run this many times now. There must be a fault with the code. I even tried entering the password in as is md5 but that did not work either. Here is my code can anyone see where I have gone wrong? The other question relates to sql injection. I'm just wondering if the code I have written is safe or have I missed some basic checks out. I'm very new to hand coding php myself as I've always used Dreamweaver. However I do not like the way I puts in all that ridicules code. Also you don’t get that sense of achievement from software like that. Anyway here is the code. <?php include('Connections/database.php'); if(isset($_POST['submit3'])) { $qCheckUserInfo = "SELECT * FROM Members WHERE email='".mysql_real_escape_string($_POST['email3'])."'"; $rCheckUserInfo = mysql_query($qCheckUserInfo); $numUsers = mysql_num_rows($rCheckUserInfo); if($numUsers == 0) { $message = "Incorrect login details"; $success = 0; } else { $userInfo = mysql_fetch_array($rCheckUserInfo); $password = $userInfo['password']; if($password == md5($_POST['password3'])) { $success = 1; $_SESSION['logged'] = 1; $_SESSION['username'] = $userInfo['username']; $_SESSION['first_name'] = $userInfo['first_name']; $_SESSION['last_name'] = $userInfo['last_name']; $_SESSION['email'] = $userInfo['email']; $_SESSION['user_type'] = $userInfo['user_type']; $_SESSION['access_level']= $userInfo['access_level']; if($_SESSION['logged']) if($_SESSION['user_type']== 'Member') { header('Location: members/index.php'); } else if($_SESSION['usertype'] == 'Owner') { header('Location: owner/index.php'); } else if($_SESSION['usertype'] == 'Corporation') { header('Location: corporation/index.php'); } else if($_SESSION['usertype'] == 'Administrator') { header('Location: owner/admin/index.php'); } else if($_SESSION['usertype'] == 'Staff') { header('Location: owner/staff/index.php'); } } else { $message = "Incorrect login details"; $success = 0; } } } ?> <body> <div id="wrapper"> <div id="title_box"> <div id="logo"><img src="images/site_images/arena.jpg" /></div> <div id="login_box"> <?php if($success != 1 && !($_SESSION['logged'])) { ?><?php if($success==0) { echo $message; } ?> <form METHOD="POST" name="login_form" class="black_text" id="login_form"> <table width="252" border="0" align="right" cellpadding="0" cellspacing="5" id="login_tab"> <tr> <td width="84"><div align="left">Username:</div></td> <td><input name="email3" type="text" class="form_fields" value="<?php echo $_POST['email3']; ?>" id="email3" tabindex="1" /></td> </tr> <tr> <td><div align="left">Password:</div></td> <td><input name="password3" type="password" class="form_fields" id="password3" tabindex="2" /></td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td colspan="2" class="forgotten_pass"><div align="right">Forgotten your password?</div></td> </tr> <tr> <td height="24"><div align="left"></div></td> <td><div align="right"> <input name="submit3" type="submit" id="submit3" tabindex="3" value="Login" /> </div></td> </tr> </table> <?php } //end fail if ?> </form> </div> </div> <?php include('nav.php');?> <div id="test">main page </div> <?php include('footer.php');?> </div> </body>