
andy_b_1502
Members-
Posts
397 -
Joined
-
Last visited
Everything posted by andy_b_1502
-
does that suggest there isn't any output if the log is empty? if why is this happening?
-
i have located the error log, it's in my host's cpanel..... unfortunately the error log is empty?
-
Okay, i changed the forms method to GET but i'm still getting the same error: The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.
-
well $website was in the code i uploaded... i was saying that it's actually uploading $website from this line of code: $website = $_GET['website']; $query = "UPDATE companies SET website = '$website' My question is, how do i get it to upload what the user inputs into the field, NOT $website and so on for the other fields. Ill look for the error log now, thanks
-
i was just looking for that? where do i find it? Also iv'e noticed that the details (i changed the user's website) has been updated to: $website, so thats also incorrect
-
Thanks, ive changed it now to: <?PHP session_start(); include ('php only scripts/db.php'); $id = $_GET['id']; $website = $_GET['website']; $phone = $_GET['number1']; $phone2 = $_GET['number2']; $premiumuser_decription = $_GET['description']; $query = "UPDATE companies SET website = '$website', phone = '$phone', phone2 = '$phone2', premiumuser_description = '$premiumuser_decription' WHERE id = '$id'"; $result = mysql_query($query ) or die("SELECT Error: ".mysql_error()); header("url=view01.php?id=" . $row['id']); exit(); ?> but something weird happened, i get this error message: The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.
-
i'm trying to get the values to update on each section or field by clicking the "update" buttons. At the moment it updates with the number 0 for everything i update lol?
-
Hi all, Trying to get my coding to work, so that users may edit or update there user profiles, whats the best way to go about this. Here's what i have as the form: <form action="view02.php" method="post" enctype="multipart/form-data" class="cursive"> <table width="316" border="0"> <tr> <td colspan=2><h1>Edit Your details </h1> <p>fill out the form with your details...</p></td> </tr> <tr> <td> </td> <td><p> </p> <p>Click update to edit...</p> <p> </p></td> </tr> <tr> <td> </td> <td><p> </p> <p> </p> <p> <p> </p></td> </tr> <tr> <td>Website:</td> <td><p> </p> <p> <input name="website" type="text" id="website" value="optional" /> </p> <p><a href="view02.php?id=<?PHP echo $row['id']; ?>&website=$website">Update</a></p> <p> </p></td> </tr> <tr> <td>Primary Number:</td> <td><p> </p> <p> <input name="phone" type="text" id="phone" value="incl. area code" /> </p> <p><a href="view02.php?id=<?PHP echo $row['id']; ?>&number1="incl. area code">Update</a></p> <p> </p></td> </tr> <tr> <td>Secondary Number:</td> <td><p> </p> <p> <input name="phone2" type="text" id="phone2" value="optional" /> </p> <p><a href="view02.php?id=<?PHP echo $row['id']; ?>&number2=1">Update</a></p> <p> </p></td> </tr> <tr> <td>Company Description:</td> <td><p><em>Write a description of what your company does, the services it offers and any additional information here.</em> </p> <p> <textarea rows="10" cols="100" name="premiumuser_description" id="premiumuser_description"></textarea> </p> <p><a href="view02.php?id=<?PHP echo $row['id']; ?>&description=1">Update</a> </p></td> </tr> <tr> <td> </td> </tr> <tr></tr> </table> </form> And the coding "view02.php": <?PHP session_start(); include ('php only scripts/db.php'); $id = (int) $_GET['id']; $website = (int) $_GET['website']; $phone = (int) $_GET['number1']; $phone2 = (int) $_GET['number2']; $premiumuser_decription = (int) $_GET['description']; $query = "UPDATE companies SET website = '$website', phone = '$phone', phone2 = '$phone2', premiumuser_description = '$premiumuser_decription' WHERE id = '$id'"; $result = mysql_query($query ) or die("SELECT Error: ".mysql_error()); header("url=view01.php?id=" . $row['id']); exit(); ?> How do i get it to update properly? Thanks
-
Kind of found my way through, just another quick question in your verify.php code, is there a place where i can use the header () mines not re-directing user's to my desired page: <?php require_once('recaptchalib.php'); $privatekey = "my private key"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification header('www.360transport.co.uk/thankyou.html'); } ?> Thank you!
-
hi, i was just wondering how to put recaptcha on my site, i have two keys, one javascript and one server key?
-
Thank you .josh for the reply
-
Thank you, iv'e decided to go for the captcha as the site really doesnt ever require the user to be logged in. Is it easy/difficult, does the catpcha require software?
-
Hi all, I have some sort of bot or spam machine sending countless emails using the simple form on my site which is for reviews. The form: <form method="post" action="send-review.php"> Name<br /> <input type="text" name="name" id="name" /> <br /> Area<br /> <input name="area" type="text" id="area" /> <br /> Leave your review here: <p class="style3"> <textarea name="review" rows="10" cols="40" id="review"></textarea> <br /> <br /> <input name="Send it!" type="submit" id="Send it!" value="Send it!" /> </form> [\code] the code 'send-review.php': [code] <?php $to = "[email protected]"; $subject = "A customer has left a review"; $message = "This is an alert to say a customer has left a review,\n\n Go to www.360transport.co.uk/reviews \n\n Thank you!!"; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); ?> <?PHP $user_name = "username"; $password = "password"; $database = "db"; $server = "host"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "INSERT INTO Reviews (name, area, review) VALUES ('" .$name. "', '" .$area. "', '" .$review. "' )"; $result = mysql_query($SQL); mysql_close($db_handle); header( 'Location: http://www.www.360transport.co.uk/thankyou.html' ); exit(); } else { print "Database NOT Found "; mysql_close($db_handle); } ?> [\code] The emails are mostly adverts for business, with links to different websites, how do i stop this from coming up on my review section of my website?
-
$query = "SELECT * FROM companies WHERE what_services IN('R','B') ORDER BY approved DESC, company_name ASC"; worked as expected, many thanks!
-
Thanks, Which one will work best with my while loop do you think? <?php $what_services== "R"; $query = "SELECT * FROM companies WHERE what_services = '$what_services' ORDER BY approved DESC, company_name ASC"; $result = mysql_query($query); while ( $row = mysql_fetch_array($result)) { $approved = $row['approved']; $what_services = $row['what_services'];
-
like this: $what_services== "R", "B";
-
Hi everyone! I need to know how to write two $what_services variables in so it looks for both "R" AND "B".. R and B are values within my db table, here's the code: <?php $what_services = "R"; $query = "SELECT * FROM companies WHERE what_services = '$what_services' ORDER BY approved DESC, company_name ASC"; $result = mysql_query($query); ?> iv'e tried the following but have gotten undesired results: two what services like so; $what_services = "R"; $what_services = "B"; separating with comma's; $what_services = "R, B"; Using AND; $what_services = "R AND B"; None of which works, what is the correct way to write this? Thanks
-
Thanks! wasn't that obvious to me i'm afraid, never knew about how to do the . thing, thanks again
-
I thought i'd best post the full code. If you need any more please ask. <?PHP session_start(); include ('php only scripts/db.php'); /* set some validation variables */ $error_message = ""; /* =============================================== */ /*this section of code will set up an error message for the username if ANY of the conditions occur 1) checks to see if $_POST['username'] is NOT set 2) if length of username is less than 5 3) if username has anything other than letter, numbers or underscores */ if((!isset($_POST['username'])) || (strlen(trim($_POST['username'])) <5) || (trim($_POST['username']) != preg_replace("/[^a-zA-Z0-9\_]/", "", trim($_POST['username'])))) { /* if username is bad start building the error message */ $error_message = "You must enter a valid username<br>"; $error_message = $error_message . "Valid names are min 5 characters and use letters, numbers and underscores only.<br>"; $error_message = $error_message . 'Your invalid name was: <font color="red">' . $_POST['username'] . "</font><hr>"; }else{ $username = mysql_real_escape_string(trim($_POST['username'])); } /* END validating username */ /* =============================================== */ /* =============================================== */ /*this section of code will set up an error message for the password if ANY of the conditions occur 1) checks to see if $_POST['password'] is NOT set 2) if length of password is less than 5 3) if password has anything other than letter, numbers or underscores */ if((!isset($_POST['password'])) || (strlen(trim($_POST['password'])) <5) || (trim($_POST['password']) != preg_replace("/[^a-zA-Z0-9\_]/", "", trim($_POST['password'])))){ /* if it is NOT set, then set the error variable and start building the error message */ $error_message = $error_message . "You must enter a valid password<br>"; $error_message = $error_message . "Valid passwords are min 5 characters and use letters, numbers and underscores only.<br>"; $error_message = $error_message . 'Your invalid password was: <font color="red">' . $_POST['password'] . "</font><hr>"; }else{ $password = trim($_POST['password']); } /* END validating password *//* =============================================== */ /* =============================================== */ /* if any of the post variables are invalid */ /* set the session variable and send back to the form page */ if(strlen(trim($error_message))>0) { $_SESSION['error_message'] =$error_message; header("Location: login00.php"); exit(); } /* =============================================== */ /* =============================================== */ /* FUNCTION TO CREATE SALT */ function createSalt(){ $string = md5(uniqid(rand(), true)); return substr($string, 0, 3); } /* check to see if username is in the table if not send back to login*/ $query01 = "SELECT id, salt FROM companies WHERE username = '$username'"; $result01 = mysql_query($query01) or die(mysql_error()); if(mysql_num_rows($result01) != 1) { header("Location: login00.php"); exit(); } $row = mysql_fetch_array($result01); $salt = $row['salt']; $password = trim($_POST['password']); $hash = hash('sha256', $salt, $password); $query02 = "SELECT id FROM companies WHERE username = '$username' AND password = '$hash'"; $result02 = mysql_query($query02) or die(mysql_error()); if(mysql_num_rows($result02) !=1){ /* not found send back to login */ header("Location: login00.php"); exit(); } /* =============================================== */ /* success!!! send them where you want */ header( "refresh:5;url=view00.php?id=echo $row'id' " ); echo '<h1>You will be re-directed in 5 seconds...</h1>'; ?>
-
just an update: changed things around to look like this header( "refresh:5;url=view00.php?id=$row'id' " ); echo $row['id']; echo '<h1>You will be re-directed in 5 seconds...</h1>'; i'm getting this in the browser: www.website.com/view00.php?id=Array'id' where it should be for example: www.website.com/view00.php?id=51 where 51 is the id of the listing in the db table, any idea's guys?? Thank you
-
how do i delete this thread? sorry!
-
Hi everyone, I have a login area, and i also have set up for me is a view page... the view page is each user's sort of profile, it gets id and displays relevant content. i was wondering if i could get the id or post rather through a re-direct on log in? for example user logs in with username and password, user is re-directed to the view page like this: header( "refresh:5;url=view00=id.php " ); echo '<h1>You will be re-directed in 5 seconds...</h1>'; user is taken to view page where they can edit bits on it. So far though i'm getting page not found error? first of all is this possible? if not whats the correct way/better way? Thanks
-
Hi everyone, I have a login area, and i also have set up for me is a view page... the view page is each user's sort of profile, it gets id and displays relevant content. i was wondering if i could get the id or post rather through a re-direct on log in? for example user logs in with username and password, user is re-directed to the view page like this: header( "refresh:5;url=view00=id.php " ); echo '<h1>You will be re-directed in 5 seconds...</h1>'; user is taken to view page where they can edit bit on it. So far though i'm getting page not found error? first of all is this possible? if not whats the correct way/better way? Thanks
-
Hi everyone, how do i add and ampersand symbol into preg_replace preg_replace("/[^a-zA-Z0-9\s\-\'\,\.\_]/" where do i place the symbol? &