Jump to content

Search the Community

Showing results for tags 'error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. help!!! i have been trying things all day with this and it wont work! <html> <div align="center"> <?php $key = $_POST['key']; $answer = $_POST['answer']; $username = $_POST['username2']; $item = explode(" ", $key); $final = $item[0]; $removals = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); $lower = str_replace($removals, "", $final); $newkey = strtolower($lower); $areplace = str_replace("," , "', '", $answer); $buff = "['$areplace']"; $finalanswer = strtolower($buff); if ($key&&$username&&$answer) { $connect = mysql_connect("fakedatabase","fakeuser", "fakepassword") or die("Couldn't Connect"); mysql_select_db("wordlist") or die("No Table"); $query = mysql_query("SELECT * FROM keylist WHERE keys='$newkey'"); $numrows = mysql_num_rows($query); echo $numrows; if ($numrows!=0) { $queryadduser1 = mysql_query("INSERT INTO userkeys Values('$username', 'Tried : $newkey')") or die("Unable to connect"); die("The key '$newkey' has already been added!"); } else $queryadd = mysql_query("INSERT INTO keylist Values('$newkey')") or die("Unable to connect"); $queryadd2 = mysql_query("INSERT INTO KeysAndAnswers Values('$newkey', '$finalanswer')") or die("Unable to connect"); $queryadduser1 = mysql_query("INSERT INTO userkeys Values('$username', 'Added : $newkey ')") or die("Unable to connect"); echo("The key '$newkey' and the answer '$finalanswer' Has just been submitted! Thank you!"); } else die("Key or answer or username was blank"); ?> </div> </html> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'keys='123-123'' at line 1
  2. Hi, when I am on a page, with a URL like: http://localhost/index.php/users/index and I have a HTML <a> tag with a href of "users/add" when I click on the link it takes me to the following URL: http://localhost/index.php/users/users/add it does not remove the controller name??? BUT when I am on: http://localhost/index.php/users/ it goes to the right URL: http://localhost/index.php/users/add any ideas welcome.
  3. Hi, i need some help with directory in php, everything works fine when i use wamp with localhost, but when i ftp my files to a webhost i get this error: Warning: include_once(/admin/root.php) [function.include-once]: failed to open stream: No such file or directory in /home/username/public_html/index.php on line 2 I think that I miss something in my config.php file, but Im not really sure how I can fix this since Im very new to PHP, I only need some basic PHP atm to make stuff easier for me. admin/config.php http://pastebin.com/hZWLJJ3D index.php http://pastebin.com/VFRKGNGX Appreciate all the help i get!
  4. I am trying to get user input from the command line, but everytime I run this no matter what I enter I get "hi" returned. I don't know why this isn't working, and was hoping someone could take a quick look at it. Thank you: function getUserInput(){ fwrite(STDOUT, "Enter your choice\n"); $selected = fgets(STDIN); if ($selected = "josh"){ echo "hi"; } else{ break; } }
  5. Hi there, I am having the following ad posting page. But i m really confused of applying a input validation. I just want to display error when there is any field which left unfilled. Error should be displayed near the field. In case of email i want to show whether the email is already available in the database or not. if available i will show available. if not available then i will show the same. All the validations should happen when i click submit button. If everything is filled, then the submit button should take me to next page. Can anyone help me with this. I m terrible in search for it. my code: <?php include("conndb.php"); function createoptions($table , $id , $field) { $sql = "select * from $table ORDER BY $field"; $res = mysql_query($sql) or die(mysql_error()); while ($a = mysql_fetch_assoc($res)) echo "<option value=\"{$a[$id]}\">$a[$field]</option>"; } ?> <!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=iso-8859-1" /> <title>Post a Free Ad</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> <style> #entrydt1 { margin-left: 100px; } #orderid1 { margin-left: 107px; } #orderdt1 { margin-left: 94px; } #itemid { margin-left: 142px; } #qtyid { margin-left: 122px; } #packid { margin-left: 120px; } #qtynoid { margin-left: 80px; } #Poid { margin-left: 80px; } #resetid { margin-left: 80px; } #clearid { margin-left: 80px; } #Name { margin-left: 50px; width: 100px; } </style> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" charset="utf-8"> $(function(){ $("select#MRP").change(function(){ var qty = $('#subcat2').val(); var MRP = $('#MRP').val(); var t7 = $('#t7').val(); var total = (qty * (MRP*(t7/100))); $("#amount").val(total); }) }) $(function(){ $("select#category").change(function(){ $.getJSON("select.php",{category: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; } $("select#subcategory").html(options); }) }) $("select#subcategory").change(function(){ $.getJSON("select.php",{subcategory: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; //options = '<input type="text" id="subcat2" name="subcat2" value="' + j[i].optionDisplay + '" />'; } /*$("select#subcategory2").html(options);*/ }) }) }) $(function(){ $("select#category").change(function(){ $.getJSON("select.php",{category: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; } $("select#subcategory").html(options); }) }) $("select#subcategory").change(function(){ $.getJSON("select.php",{subcategory: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; //options = '<input type="text" id="subcat2" name="subcat2" value="' + j[i].optionDisplay + '" />'; } ("select#subcategory2").html(options); }) }) }) </script> </script> </head> <body> <h1>Post a Free Ad</h1> <form method="post" name="form" action="preview.php"> <table border='0'> <tr> <td><label for="name">Enter the name of the product or service you want</label></td> <td> <input type="text" name="ad" size=20 value=""/></td> </tr> <tr> <td> Select your Category</td> <td><select name="cat" id="category" style="width:11em;"> <option value="-1">--Select--</option> <?php createoptions("category", "cat_id", "category"); ?> </select> </td> </tr> <tr> <td> Select Subcategory </td> <td><select name="subcat" id="subcategory" style="width:11em;"> </select> </td> </tr> <tr> <td>Ad Type </td> <td><input type="radio" name="adtype" value="I Am Offering">I Am Offering <input type="radio" name="adtype" value="I Am Looking For">I Am Looking For </td> </tr> <tr> <td>Ad Title <font color="red">*</font></td> <td><input type="text" name="title" value="" style="width:15em;"></td> </tr> <tr> <td>Location<font color="red">*</font></td> <td><input type="text" name="location" value="" style="width:15em;"></td> </tr> <tr> <td>Addtional Details</td> <td><textarea name="info" rows="5" cols="50"></textarea></td> </tr> <tr> <td> <font face="arial" color="green" size="5"/> Verification Details here!! </td> </tr> <tr> <td>Email </td> <td><input type="text" name="email" value="" style="width:15em;" / > </td> </tr> <tr> <td>Mobile </td> <td><input type="text" name="mobile" value="" style="width:15em;" / > </td> </tr> <td> <input type="submit" name="submit" value="Preview Ur Ad"/></td> </tr> </table> <br /> <br /> </form> </body> </html>
  6. I've been using WAMPs since I started web development but recently I decided to get my hands a little dirty and to set Apache, PHP, MySQL and phpMyAdmin up by myself. I had been fiddling around in the Apache configuration for a while so I have a little experience. I installed Apache 2.2.22, PHP 5.3.5, MySQL 5.5 and phpMyAdmin 3.5.5 and after a little configuration I got everything to work together. I quickly ran into problems with Apache and my lack of understanding of it. Many of the things that used to work perfectly in the WAMP httpd.conf have either no effect on my fresh install or prevent me from starting the server. Some examples: The ErrorLogFormat directive prevents Apache from starting which is weird because it's part of the core module. Even though I have both mod_info.so and mod_status.so, if I try to start with SetHandler server-info or SetHandler server-status (within Location directives of course) the Apache will not start. For some reason the installation does not come with mod_authz_core.so which I rely on quite a bit (not sure if that's because it's obsolete and has been replaced or what). I don't know enough about compiling Apache or whatever you need to do to add additional modules. Some of the directives I use seem to be completely ignored even though I know the modules are loaded. For example, I made my own index page with handpicked icons. The mod_autoindex.so takes care of these things and I'm using a bunch of AddDescription, AddIcon, AddIconByType and other directives like that. Everything seems to work except that it's unable to find my icons, which are in the server root in a folder called "icons" just like on my WAMP setup so nothing has changed - except that things aren't working. The great thing about the Apache web server is that if it isn't able to start because of misconfiguration it only shows a window saying "The requested operation has failed!". The programmers could just as well have written something like "Hahaha! You idiot! You're screwed now!".
  7. Hello the community, i have create a little script that connect to the mysql database & search for the email field <? $host = "localhost"; $user = "root"; $password = "password"; $db = "test"; $type = "MYSQL_BOTH"; $conn = mysql_connect($host, $user, $password); mysql_select_db($db) or die("cannot open DB $db"); $file = "http://localhost/tmp/log.txt"; $result = parse_table ( "user",$type,"file" ); mysql_close($conn); function parse_table($tablename,$mode,$file) { $email= "email@email.com"; $fo = fopen($file,"w++"); $sql = "SELECT email FROM user WHERE email = '".$email."'"; $req = mysql_query($sql)or die('Error SQL !<br>'.$sql.'<br>'.mysql_error()); $tbl_array = array(); while($data = mysql_fetch_array($req, $mode)) { foreach($data as $key => $value) { $tbl_array[$key][] = $value; fputs ($fo,$tbl_array[$key]); } } } ?> here is the sql dump /* CREATE TABLE IF NOT EXISTS user ( id int(10) unsigned NOT NULL AUTO_INCREMENT, email varchar(80) NOT NULL, pass char(41) NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO user (id, email, pass) VALUES (1, 'email@email.com', '664c0750f8c73ec0086e88c8b02bb112''); */ the problem is i got an error the line 20 is while($data = mysql_fetch_array($req, $mode)) { im not sure where the problem come from could you help me to fix the script please ? thx you very much
  8. Hi all, I'm sending an email with php as a part of my user registration process, and for some reason the mail script begins to fail when I use my full desired email in my headers. I use the standard PHP Manual headers for email: // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Jake M*** <**********@gmail.com>' . "\r\n"; $headers .= "From: CFS <noreply@crossfitst.com>" . "\r\n"; Now, if I make my last header: $headers .= "From: CFS <noreply@crossfitstmarys.com>"."\r\n"; It fails! As soon as I put the m in on CrossfitStMarys it fails the whole script. Any ideas? Cheers. P.S. I have real data in for my Jake M, just censored it out because I don't want everyone having my email haha.
  9. Hello all, I am trying to chase down an error thrown by timthumb.php I get this error: however A TimThumb error has occured The following error(s) occured: Could not find the internal image you specified. Query String : src=http://omegaopc.org/wp-content/connection_images/dillon_original.jpg&h=54&w=80&zc=2 TimThumb version : 2.8.11 however, the url source without the resize info (http://omegaopc.org/wp-content/connection_images/dillon_original.jpg) loads just fine. I have set the permissions on the connection_images folder to 755 as well as on timthumb.php I have heard this error comes from a permissions issue - but I can't find where else a permissions restriction would be? Any ideas how to track this down?
  10. Hi there! I have only just started making my first page and have thrown myself in the deep end as it seems. My contact page has turned out quite professional but I keep receiving error messages after 'sent'. Previously from my localhost test server the emails did get sent but I did also receive the error message - now, from my remote server (GoDaddy) it does not get sent at all and the error is still there! I receive the following error: Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\hosting\12345678\html\contact-page.php on line 54 this is referring to: // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); It seems as if it tries to contact a 3rd party server but I seriously don't have any idea where I can adjust that in my script :-\ I have searched and adjusted some things but simply cannot find the actual issue...anyone here who can help me please? Thanks x
  11. Hey Everyone, Could someone find the error in this? My log isnt working and I can't stare at it anymore. The include file has nothing wrong with it. It is my functions file. Can't spell functions without FUN! include("../fun/fun.php"); if ($_POST['announce']) { $first = mysql_real_escape_string($_POST['first']); $last = mysql_real_escape_string($_POST['last']); $email = mysql_real_escape_string($_POST['email']); $ann = "INSERT INTO members ('first', 'last', 'email') VALUES ('$first', '$last', '$email')"; $annq = mysql_query($ann $connection); if ($annq) { header("Location:../pages/annoucements.php"); } else { echo "Query failed " . mysql_error(); } } if ($_POST['contact']) { $first = mysql_real_escape_string($_POST['first']); $last = mysql_real_escape_string($_POST['last']); $email = mysql_real_escape_string($_POST['email']); $line = mysql_real_escape_string($_POST['line']); $con = "INSERT INTO contact ('first', 'last', 'email', 'comment') VALUES ('$first', '$last', '$email', '$line')"; $conq = mysql_query($con $connection); if ($conq) { header("Location:../pages/contact.php"); } else { echo "Query failed " . mysql_error(); } } else { header("Location:../pages/index.php"); } Thanks in advance!
  12. I got an error in my code and I'm not really sure of what it might be... this is the problem that I get I guess the problem is in the area that I will colour red in the code below. Since that is the 8th row of sql that is initiated I moved the green one to the end of the other row and the number switched from 8 to 7 so it is that code that is red that atm is what I see is the error so if someone could help me with this I would really appreciate it. <?php include '../../php/header2.php'; echo' <!--Mainbody--> <div align="center"class="box">'; echo '<h2>Create a topic</h2>'; if($_SESSION['signed_in'] == false) { echo 'Sorry, you have to be <a href="/forum/signin.php">signed in</a> to create a topic.'; } else { if($_SERVER['REQUEST_METHOD'] != 'POST') { $sql = "SELECT cat_id, cat_name, cat_description FROM categories"; $result = mysql_query($sql); if(!$result) { echo 'Error while selecting from database. Please try again later.'; } else { if(mysql_num_rows($result) == 0) { if($_SESSION['user_level'] == 1) { echo 'You have not created categories yet.'; } else { echo 'Before you can post a topic, you must wait for an admin to create some categories.'; } } else { echo '<form method="post" action=""> Subject: <input type="text" name="subcat_name" /><br /> Category:'; echo '<select name="subcat_cat">'; while($row = mysql_fetch_assoc($result)) { echo '<option value="' . $row['cat_id'] . '">' . $row['cat_name'] . '</option>'; } echo '</select><br />'; echo 'Message: <br /><textarea name="subcat_description" /></textarea><br /><br /> <input type="submit" value="Create subcategory" /> </form>'; } } } else { $query = "BEGIN WORK;"; $result = mysql_query($query); if(!$result) { echo 'An error occured while creating your topic. Please try again later.'; } else { $sql = "INSERT INTO subcategories (subcat_name, subcat_cat, subcat_description) VALUES('" . mysql_real_escape_string($_POST['subcat_name']) . "', NOW(), " . mysql_real_escape_string($_POST['subcat_cat']) . " " . mysql_real_escape_string($_POST['subcat_description']) . " )"; $result = mysql_query($sql); if(!$result) { echo 'An error occured while inserting your data. Please try again later.<br /><br />' . mysql_error(); $sql = "ROLLBACK;"; $result = mysql_query($sql); } else { $sql = "COMMIT;"; $result = mysql_query($sql); echo 'You have succesfully created <a href="subcategories.php?id='. $subcat_id . '">your new subcategorie</a>.'; } } } } ?> <?php echo '</div> <!--Bottom--> <div align="left"class="bottom"> </div>'; ?>
  13. i keep getting this error all the time i don't understand why this is happening could someone please help me. <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb"> <body> <h1>image upload to freecycle</h1><p> <?php require 'auth.php'; if(isset($_SESSION['loggedin'])){ //session is set, user is logged in }else{ header("http://stuweb.cms.gre.ac.uk/~sn027/login.html"); if ( !isset($_FILES['userFile']['type']) ) { die('<p>No image submitted</p></body></html>'); } ?> <body> <h1>Uploading Images to MySQL</h1><p> <?php if ( !isset($_FILES['userFile']['type']) ) { die('<p>No image submitted</p></body></html>'); } ?> You submitted this file:<br /><br /> Temporary name: <?php echo $_FILES['userFile']['tmp_name'] ?><br /> Original name: <?php echo $_FILES['userFile']['name'] ?><br /> Size: <?php echo $_FILES['userFile']['size'] ?> bytes<br /> Type: <?php echo $_FILES['userFile']['type'] ?></p> <?php require 'mysql.php'; // Validate uploaded image file if ( !preg_match( '/gif|png|x-png|jpeg/', $_FILES['userFile']['type']) ) { die('<p>Only browser compatible images allowed</p></body></html>'); } else if ( strlen($_POST['altText']) < 9 ) { die('<p>Please provide meaningful alternate text</p></body></html>'); } else if ( $_FILES['userFile']['size'] > 16384 ) { die('<p>Sorry file too large</p></body></html>'); // Connect to database } else if ( !($link=mysql_connect($host, $user, $passwd)) ) { die('<p>Error connecting to database</p></body></html>'); } else if ( !(mysql_select_db($dbName)) ) { die('<p>Error selecting database</p></body></html>'); // Copy image file into a variable } else if ( !($handle = fopen ($_FILES['userFile']['tmp_name'], "r")) ) { die('<p>Error opening temp file</p></body></html>'); } else if ( !($image = fread ($handle, filesize($_FILES['userFile']['tmp_name']))) ) { die('<p>Error reading temp file</p></body></html>'); } else { fclose ($handle); // Commit image to the database $image = mysql_real_escape_string($image); $alt = htmlentities($_POST['altText']); $query = 'INSERT INTO image (title,type,name,alt,img,description) VALUES ("' . $_FILES['userFile']['type'] . '","' . $_FILES['userFile']['name'] . '","' . $alt . '","' . $image . '")'; if ( !(mysql_query($query,$link)) ) { die('<p>Error writing image to database</p></body></html>'); } else { die('<p>Image successfully copied to database</p></body></html>'); } }
  14. Hi, I am fairly new to PHP and I can't for the life of me correct this error: "Parse error: syntax error, unexpected '$username' (T_VARIABLE) in D:\Computer Forensics\xampp\htdocs\xampp\iis\php\userprofile.php on line 7" Here is the corrosponding file code: <?php include 'connection.php'; ?> <?php $username = $_SESSION['authenticatedUser']; $query = 'SELECT firstname, surname, username, password, email, address1, address2, postcode FROM customers WHERE username='$username' LIMIT 1'; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $username = $row['username']; } ?> <html> <table border=1> <tr> <th>Username</th><td><input type="text" name="username" value="<?php echo $_SESSION["authenticatedUser"] ?>" /></td> </tr> </table> </html> I have tried using the $_SESSION variable instead of $username and alternated the quotation marks etc but it still has no affect. It would be much appreciated if anyone could help me out. Thanks, Sam.
  15. Let's suppose we have some objects hierarchy built via composition. Is there any pattern to register business logic errors within inner objects and pass them to the upper objects ? I am just tired of all these addErrors, getErrors on each level and I feel that I do something incorrectly. I know about exceptions, but I have no mind how to use them in such case. Business logic error is technically not a critical situation, which should result in interruption of the program execution. Actually interruption is not supposed at all, because we need to register the error and just move on. Thanks in advance to share your wisdom and knowledge ) Small snippet to illustrate the problem: <?php class ErrorContainer { private $errors = array(); function addError($error) { if (!is_array($error)) { $this->errors[] = $error;} else { $this->errors = array_merge($this->errors, $error); } } function getErrors() { return $this->errors[]; } function hasErrors() { return !empty($this->errors); } } class Processor extends ErrorContainer { function process($account_id, $orders) { $account = new Account(); if (!$account->loadById($account_id)) { $this->addErrors($account->getErrors);} foreach ($orders as $order_id) { $order = new Order(); if (!$order->loadById($order_id)) { $this->addErrors($order->getErrors);} } } return $this->hasErrors(); } class Account extends ErrorContainer { function loadById($account_id) { $account = select_from_database($account_id); if (!$account) { $this->addError("Account is missing"); } if (!$account['active']) { $this->addError("Account is inactive"); } // and so on, some checks may add errors in a cycle return $this->hasErrors(); } } class Order extends ErrorContainer {} // very similar to Account, but has its own checks //Usage: $errors = array(); $items = load_items_from_xml($xml); foreach ($items as $item) { $processor = new Processor(); if (!$processor->process($item['account_id'], $item['orders'])) { $errors = array_merge($errors, $processor->getErrors()); } }
  16. Dear all, Can somebody tell me what the problem is from this results! And my result if i want it load in my browser: Just look here!! Maby is it a stupid ask but i sitting on this moment stuck.. Thanks!
  17. If i hit Edit button i got these error before i click Submit <? if ($_GET['do'] == 'test2') { $id = ($_POST['id']); $username = cleanuserinput($_POST['username']); $password = cleanuserinput($_POST['password']); $rpassword = cleanuserinput($_POST['rpassword']); $pass = md5($_POST['password']); if(isset($_POST['delete'])){ mysql_query("delete from admin where id='".$id."'"); print '<center><font color=black>Admin has been deleted!</font><br>'; } if(isset($_POST['edit'])){ //Make sure username isn't blank if (!$username){ $error .= '<font color=red>Sorry, the username was empty.</font><br>'; } //Make sure password isn't blank if (!$password){ $error .= '<font color=red>Sorry, your password was empty.</font><br>'; } //Make sure both passwords match if ($password != $rpassword) { $error .= '<font color=red>Passwords Doesn\'t Match!</font><br>'; } //Check username length if (!ctype_alnum($username) || strlen($username) < 4 || strlen($username) > 15) { $error .= '<font color=red>Username must be between 4-15 characters!</font><br>'; } //Check password length if (!ctype_alnum($password) || strlen($password) < 4 || strlen($password) > 15) { $error .= '<font color=red>Password must be between 4-15 characters.</font><br>'; } if (!$error){ $sql_update = "UPDATE admin set username = '$username', password= '$pass' where id='".$id."'"; $result = mysql_query ($sql_update) or die(mysql_error()); print "<center><font color=black>User ". $_POST['username'] ." Has been edited.</font><br>"; } $get_admin = mysql_query("select * from admin where id='".$id."'"); $admin = mysql_fetch_array($get_admin); echo $error . "<form action='?do=test2' method='post'> <table> <tr><th colspan=20>Edit Admin</th></tr> <tr><td><b>Username<font color=red>*</font></b></td><td><div><small>[ 4-15 characters ]</small></div><input name='username' type='text' maxlength='50' size='25' tabindex='1' value='".$admin['username']."'></td></tr> <tr><td><b>Password<font color=red>*</font></b></td><td><div><small>[ 4-15 characters ]</small></div><input name='password' type='text' maxlength='50' size='25' tabindex='2' value=''></td></tr> <tr><td><b>Password 2<font color=red>*</font></b></td><td><input name='rpassword' type='text' maxlength='50' size='25' tabindex='3' value=''></td></tr> </table> <input type=hidden name=id value='".$admin['id']."'> <div align='center'><br><input type='submit' name='submit' tabindex='4' value='Submit'></div> </form>"; } else { print" <table width=90%> <tr><th colspan=20>Current Admin</th></tr> <td>Admin Name</td> <td>Added Date</td> <td align=center>Action</td>"; $get_admin = mysql_query("select * from admin "); while ($row = mysql_fetch_array($get_admin)){ print " <tr> <td>". $row['username'] ."</td> <td>". $row['date'] ."</td> <td align=center> <form method=POST> <input name=id type=hidden value='".$row['id']."'> <input type=submit name=edit value='Edit'> <input type=submit name=delete value='Delete'> </td> </form> </tr>"; } print "</table>"; } } else { admin_wrong_file(); } ?>
  18. I been trying to figure this out for about 3 or so hours (usually I wait 3 days of trying to fix something before I post here, but I can't wait xP) . . . and I am sure - as always - someone sees a simple fix and saves the day on PHPfreaks. Below is the code and details of what is happening is below. $stmt = $mysqli->prepare("SELECT question, uniqueid FROM pollquestion WHERE status = 1"); $stmt->execute(); $stmt->bind_result($question, $uniqueid); while ($stmt->fetch()) { echo "<center><div class=tablebox><h5>$question</h5></div></center><br><div class=tablebox>"; if (!$mysqli->query("SELECT optionname FROM pollchoices WHERE pollid = $uniqueid")) {echo "Multi-INSERT failed: (" . $mysqli->errno . ") " . $mysqli->error;} else{ $stmt2 = $mysqli->prepare("SELECT optionname FROM pollchoices WHERE pollid = ?"); $stmt2->bind_param('s', $uniqueid); mysqli_free_result(); $stmt2->execute(); $stmt2->bind_result($option); while ($stmt2->fetch()){echo "$option";} $stmt2->close(); } echo "</div>"; } $stmt->close(); With this I get the error "Multi-INSERT failed: (2014) Commands out of sync; you can't run this command now." I looked it up on Google and it was saying I should use multi_query. I replaced the query with multi_query and still no luck and no change in error. So I changed it back. I do stuff like this a lot in my coding and never came across this error. Should I be using multi_query? I never used it before, if so - how should I be using it? This is what I am trying to get to happen: I get the question for the poll and the unique id. With the unique id I can find out what poll options goes with it. That is all I want to do and I cannot get the poll options to show.
  19. Hi all, If any one could help that would be very much appreciated, I'm updating a clients site including a registration page, when the user submits the registration page hangs on a white page, i've looked at the code for hours but cannot see any errors that pop out, i even added error code which didn't pick up anything either. I've attched both the register page and the register submit page register.php register-submit.php
  20. Hello — This is probably one of the most common mysqli errors out there, but it has appeared on my webpage. The problem is on line 10. This file is used as a global functions file - so I can essentially use db_query(INSERT INTO...) in a different page and have the function run. For security reasons I have removed the actual usernames and such from the code, and it is pasted below. Any help would be greatly appreciated. <?php // Function to connect to the database. function db_connect() { $dbc = mysqli_connect('host','user','********','db'); } // Function to run database queries. function db_query($q) { global $dbc; $dbq = mysqli_query($dbc, $q); // ERROR OCCURS HERE if(!$dbq) { return false; } else { $r = mysqli_store_result($link); } } ?>
  21. here's the link: http://www.superdupersites.com/strange view the source, hit ctrl+f, type "page 2", and hit enter twice. it will show the table with the words "Page 2!" in it, and the table cell is aligned to be "center", but on the display, it shows it aligned to the left... i designed this site, and i seriously have no idea why this is happening... it's got me bugged too. any help would be greatly appreciated
  22. Hello Everyone. Till now I used to work on XAMPP and WAMP but today I tried installing Apache,PHP,and MySQL seperately(MAnually). For that I downloaded Apache(httpd-2.0.64-win32-x86-openssl-0.9.8o.msi), PHP(php-5.3.17-Win32-VC9-x86.msi) MySQL(mysql-5.5.28-win32.msi). First I installed Apache.Everything went right and on opening http://localhost it said that apache is correctly installed on your pc. Then I installed PHP.While installing,it asked for httpd.conf file so I provided it and everything went fine. Then I created a file named phpinfo.php in htdocs folder and wrote the following code in it <?php phpinfo(); ?> But when I opened the url http://localhost/phpinfo.php it is showing the following error. Please hefp me out.Unable to solve it.
  23. Hi PHP Freaks, I have written a php email form and then this code behind it. When I run it comes up with the error page however all inputs are filled in and valid. Here is my code: <?php //variables from form $firstname = ucwords(strtolower($_POST['firstname'])); $lastname = ucwords(strtolower($_POST['lastname'])); $client_email_address = $_POST['email_address']; $subject = $_POST['subject']; $message = wordwrap($_POST['message'], 150, '<br />'); $fullname = $firstname.' '.$lastname; //error pages $email_successful_page = 'mail_successful.php'; //create mail_successful.php; $email_failed_page = 'delivery_failed.php'; //create delivery_failed.php; //create emailform.php (and in it the ability to read the error from this script and tell the user //set date date_default_timezone_set('Australia/NSW'); //email 1 is sent to the scd admin email $email_1_recipient_address = 'joshua.paduch@gmail.com'; //'systemadministrator@shellharbourcitydental.com.au'; $email_1_subject = 'Email sent to '.$dentist_name.' from '.$client_email.' regarding '.$subject; $email_1_message = '<html>\n\t<body>\n\t\t<img src=\"emailheader.jpg\" width="" height="" style="float:center;"/>\n\t\t'; $email_1_message .= '\n\t\t<h1>Hi System Administrator, </h1>'; $email_1_message .= '\n\t\t<br /><p>For records, </p>'; //$email_1_message .= ''; //$email_1_message .= ''; $email_1_headers = "From: autoresponder@shellharbourcitydental.com.au \r\n"; $email_1_headers .= "Reply-To: donotreply@shellharbourcitydental.com.au \r\n"; $email_1_headers .= "X-Mailer: PHP/".phpversion()." \r\n"; $email_1_headers .= "To: joshua.paduch@gmail.com \r\n"; $email_1_headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $email_1_headers .= "MIME-Version: 1.0 \r\n"; //$email_1_headers .= " \r\n"; //email 2 is sent to the intended dentist / practitioner $email_2_recipient_address = 'joshua.paduch@gmail.com'; //'info@shellharbourcitydental.com.au'; $email_2_subject = $subject; $email_2_message = 'message'; //$email_2_message .= ''; //$email_2_message .= ''; $email_2_headers = "From: autoresponder@shellharbourcitydental.com.au \r\n"; $email_2_headers .= "Reply-To: donotreply@shellharbourcitydental.com.au \r\n"; $email_2_headers .= "X-Mailer: PHP/".phpversion()." \r\n"; $email_2_headers .= "To: joshua.paduch@gmail.com \r\n"; $email_2_headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $email_2_headers .= "MIME-Version: 1.0 \r\n"; //$email_2_headers .= " \r\n"; //email 3 is a confirmation email sent to the client $email_3_recipient_address = $client_email_address; $email_3_subject = 'Confirmation Email Regarding: '.$subject; $email_3_message = 'message'; //$email_3_message .= ''; //$email_3_message .= ''; $email_3_headers = "From: autoresponder@shellharbourcitydental.com.au \r\n"; $email_3_headers .= "Reply-To: donotreply@shellharbourcitydental.com.au \r\n"; $email_3_headers .= "X-Mailer: PHP/".phpversion()." \r\n"; $email_3_headers .= "To: ".$client_email." \r\n"; $email_3_headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $email_3_headers .= "MIME-Version: 1.0 \r\n"; //$email_3_headers .= " \r\n"; //form validation function function form_validation($var1,$var2,$var3,$var4,$var5){ if(isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['email_address']) && isset($_POST['subject']) && isset($_POST['message'])){ if(strlen($var1) < 1){ return false; $error = "firstname"; } elseif(strlen($var2) < 1){ return false; $error = "lastname"; } elseif(!filter_var($var3, FILTER_VALIDATE_EMAIL)){ return false; $error = "invalid email address"; } elseif(strlen($var4) < 1){ return false; $error = "subject"; } elseif(strlen($var5) < 1){ return false; $error = "message"; } else{ return true; } } else{ return false; } } //emailing function function email($email_1_var_1,$email_1_var_2,$email_1_var_3,$email_1_var_4,$email_2_var_1,$email_2_var_2,$email_2_var_3,$email_2_var_4,$email_3_var_1,$email_3_var_2,$email_3_var_3,$email_3_var_4){ if(!mail($email_1_var_1,$email_1_var_2,$email_1_var_3,$email_1_var_4)){ $email_error = "email 1 error"; } if(!mail($email_2_var_1,$email_2_var_2,$email_2_var_3,$email_2_var_4)){ $email_error = "email 2 error"; } if(!mail($email_3_var_1,$email_3_var_2,$email_3_var_3,$email_3_var_4)){ $email_error = "email 3 error"; } } //if form validation fails - redirect to error page - mail if(!form_validation($firstname,$lastname,$email_address,$subject,$message)){ header('Location: '.$email_failed_page.'?error='.$error); } else{ if(!email($email_1_recipient_address,$email_1_subject,$email_1_message,$email_1_headers,$email_2_recipient_address,$email_2_subject,$email_2_message,$email_2_headers,$email_3_recipient_address,$email_3_subject,$email_3_message,$email_3_headers)){ header('Location: '.$email_failed_page.'?email_error='.$email_error); } else{ header('Location: '.$email_succesful_page); } } Any advice is welcome. Thanks everyone, Timothy
  24. Hi PHP Freaks, I am currently having trouble with my mailing script. When I load it in the browser it comes up with the following error: 500 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@domain-name.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. There is no errors in the error_log and in the email failure email sent to my webmaster email it says it contained no recipient address but I have set that in the code. Here is the Code HTML Form: <form method="post" action="mail.php"> <label for="firstname">Firstname:</label> <input type="text" name="firstname" id="firstname" value="" /> <label for="lastname">Lastname:</label> <input type="text" name="lastname" id="lastname" value="" /> <label for="email_address">Email Address:</label> <input type="text" name="email_address" id="email_address" value="" /> <label for="subject">Subject:</label> <select name="subject" id="subject"> <option name="request_appointment" id="request_appointment" value="Request an Appointment">Request an Appointment</option> <option name="request_callback" id="request_callback" value="Request a Call-Back">Request a Call-Back</option> <option name="question" id="question" value="I Have a Question">I Have a Question</option> <option name="emergency" id="emergency" value="Emergency">Emergency (Call 0422 036 768)</option> <option name="other" id="other" value="Other">Other</option> </select><br /> <label for="message">Message:</label> <textarea name="message" id="message" cols="45" rows="10"></textarea> <button type="submit" value="submit"><span>Submit</span></button> </form> PHP Scripting <?php //declare variables $email_successful_page = 'mail_successful.php'; //create mail_successful.php; $email_failed_page = 'delivery_failed.php'; //create delivery_failed.php; //create emailform.php (and in it the ability to read the error from this script and tell the user //declare email variables $firstname = ucwords(strtolower($_REQUEST['firstname'])); $lastname = ucwords(strtolower($_REQUEST['lastname'])); $subject = $_POST['subject']; $message = wordwrap($_POST['message'], 150, '<br />'); $client_name = $firstname." ".$lastname; $dentist_name = $_REQUEST['dentist']; $dentist_email = $dentist_name.'@domain-name.com.au'; $client_email = $_POST['email_address']; //date date_default_timezone_set('Australia/NSW'); global $email_1_recipient_address, $email_1_subject, $email_1_message, $email_1_headers, $email_2_recipient_address, $email_2_subject, $email_2_message, $email_2_headers, $email_3_recipient_address, $email_3_subject, $email_3_message, $email_3_headers; //email 1 is sent to the scd admin email $email_1_recipient_address = 'systemadministrator@domain-name.com.au'; $email_1_subject = 'Email sent to '.$dentist_name.' from '.$client_email.' regarding '.$subject; $email_1_message = '<html>\n\t<body>\n\t\t<img src=\"emailheader.jpg\" width="" height="" style="float:center;"/>\n\t\t'; $email_1_message .= '\n\t\t<h1>Hi System Administrator, </h1>'; $email_1_message .= '\n\t\t<br /><p>For records, </p>'; $email_1_message .= ''; $email_1_message .= ''; $email_1_headers = "From: autoresponder@domain-name.com.au \r\n"; $email_1_headers .= "Reply-To: donotreply@domain-name.com.au \r\n"; $email_1_headers .= "X-Mailer: PHP/".phpversion()." \r\n"; $email_1_headers .= "To: joshua.paduch@gmail.com \r\n"; $email_1_headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $email_1_headers .= "MIME-Version: 1.0 \r\n"; //$email_1_headers .= " \r\n"; //email 2 is sent to the intended dentist / practitioner $email_2_recipient_address = 'info@domain-name.com.au'; $email_2_subject = $subject; $email_2_message = 'message'; $email_2_message .= ''; $email_2_message .= ''; $email_2_headers = "From: autoresponder@domain-name.com.au \r\n"; $email_2_headers .= "Reply-To: donotreply@domain-name.com.au \r\n"; $email_2_headers .= "X-Mailer: PHP/".phpversion()." \r\n"; $email_2_headers .= "To: joshua.paduch@gmail.com \r\n"; $email_2_headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $email_2_headers .= "MIME-Version: 1.0 \r\n"; //$email_2_headers .= " \r\n"; //email 3 is a confirmation email sent to the client $email_3_recipient_address = $client_email; $email_3_subject = 'Confirmation Email Regarding: '.$subject; $email_3_message = 'message'; $email_3_message .= ''; $email_3_message .= ''; $email_3_headers = "From: autoresponder@domain-name.com.au \r\n"; $email_3_headers .= "Reply-To: donotreply@domain-name.com.au \r\n"; $email_3_headers .= "X-Mailer: PHP/".phpversion()." \r\n"; $email_3_headers .= "To: ".$client_email." \r\n"; $email_3_headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $email_3_headers .= "MIME-Version: 1.0 \r\n"; //$email_3_headers .= " \r\n"; //validate inputs function form_validation(){ function email_address_validation(){ //Validates & Sanitizes the email address if(!filter_var($client_email, FILTER_VALIDATE_EMAIL) && strlen($client_email) < 1){ global $error; global $error_page; $error = "Email Address was empty or had a invalid value."; $error_page = "email address error"; return true; } else{ return false; } } function firstname_validation(){ if(strlen($firstname) > 0){ global $error; global $error_page; $error = "Firstname was empty or had a invalid value."; $error_page = "firstname error"; return true; } else{ return false; } } function lastname_validation(){ if(strlen($lastname) > 0){ global $error; global $error_page; $error = "Lastname was empty or had a invalid value."; $error_page = "lastname error"; return true; } else{ return false; } } function subject_validation(){ if(!isset($subject)){ global $error; global $error_page; $error = "Subject was empty or had a invalid value."; $error_page = "subject error"; return true; } else{ return false; } } function message_validation(){ if(!isset($message)){ global $error; global $error_page; $error = "Message was empty or had a invalid value."; $error_page = "message content error"; return true; } else{ return false; } } //call to above validation function to be executed when form_validation is called global $email_address_validation, $firstname_validation, $lastname_validation, $subject_validation, $message_validation; $email_address_validation = email_address_validation(); $firstname_validation = firstname_validation(); $lastname_validation = lastname_validation(); $subject_validation = subject_validation(); $message_validation = message_validation(); if(!isset($error) || $email_address_validation == false || $firstname_validation == false || $lastname_validation == false || $subject_validation == false || $message_validation == false){ return true; } else{ return false; } } $form_validation = form_validation(); //if the form validation returns false - break the code - write the error and contact form to page if($form_validation != true){ header($email_failed_page); break; //check to see this breaks the entire script not just the if loop } //declare email functions function send_emails(){ /* mail($email_1_recipient_address, $email_1_subject, $email_1_message, $email_1_headers); mail($email_2_recipient_address, $email_2_subject, $email_2_message, $email_2_headers); mail($email_3_recipient_address, $email_3_subject, $email_3_message, $email_3_headers); */ if(mail($email_1_recipient_address, $email_1_subject, $email_1_message, $email_1_headers) && mail($email_2_recipient_address, $email_2_subject, $email_2_message, $email_2_headers) && mail($email_3_recipient_address, $email_3_subject, $email_3_message, $email_3_headers)){ header($email_sucessful_page); } else{ header($email_failed_page.'?error='.urlencode(htmlentities($error_page))); //add in read error from $_GET } } $send_emails = send_emails(); if(!$send_emails){ header($email_failed_page.'?error='.urlencode(htmlentities($error_page))); } else{ header($email_sucessful_page); } ?> Any ideas or comments are welcome. Thanks in advance guys, Timothy Call Send SMS Add to Skype You'll need Skype CreditFree via Skype
  25. Hello, I can't use CURL, $ch = curl_init(); I get the error I've used phpinfo() and found the php.ini directory, Loaded Configuration File D:\wamp\bin\apache\apache2.2.22\bin\php.ini I've then edited the php.ini file from that directory and removed the semi-colon in-front of extension=php_curl.dll Restarted Apache but am still receiving the error. I'm using Wamp and I know there's another php.ini file in the D:\wamp\bin\php directory, so I've uncommented that line from that file too, restarted Apache and still receive the error. I don't know where to go from here, can anyone advise me please?
×
×
  • 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.