Jump to content

Search the Community

Showing results for tags 'php'.

  • 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. Hello experts, I have created a dropdown list on each click of drop down another drop down list appears from drop1 database. Below is the code of the same: dropdown1.php <html> <head> <script> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","drop2.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> <select name="users" onchange="showUser(this.value)"> <option value="">Select a plan:</option> <option value="1">Dedicated</option> <option value="2">VPS</option> </select> </form> <br> <div id="txtHint"><b>Person info will be listed here.</b></div> </body> </html> drop2.php: The above code works perfectly fine for shown the proper dropdown. Now i want to insert the second dropdown value in another database. And i am quite stuck in that.
  2. Hey there Wanted to ask a question with my SMTP setting not authenticating I get an error like this : PHP Warning: mail(): SMTP server response: 530 SMTP authentication is required. in file.php on line 190 Even tho i provided all the details for the SMTP to authenticate . <?php include '../header.php'; include '../config2.php'; $thankYouPage = '/success.php'; $allowedFields = array( 'login_email', 'login_password', 'confirm', 'first_name', 'last_name', 'address_one', 'address_two', 'town_city', 'county_option', 'post_code', 'phone_number', 'agree', ); $requiredFields = array( 'login_email'=> '*Email address is required.', 'login_password'=> '*Password is required.', 'confirm'=> '*Please confirm your password(required).', 'first_name'=> '*Your First Name is required.', 'last_name'=> '*Your Last Name is required.', 'address_one'=> '*First Line of your address is required.', 'address_two'=> '*Second Line of your address is required.', 'town_city'=> '*Town/City is required.', 'county_option'=> '*County is required.', 'post_code'=> '*Post Code is required.', 'phone_number'=> '*Phone Number is required.', 'agree'=> '*You must agree with our Terms & Conditions .', ); $errors = array(); foreach($requiredFields as $fieldname => $errorMsg) { if(empty($_POST[$fieldname])) { $errors[] = $errorMsg; } } foreach($_POST AS $key => $value) { if(in_array($key, $allowedFields)) { ${$key} = $value; } } if(count($errors) > 0) { $errorString.= '<ul>'; foreach($errors as $error) { $errorString.= "<li>$error</li>"; } $errorString.= '</ul>'; ?> <html> <div id="title"> <div class="inner"> <h1>Account Registration</h1> </div> </div> <div id="content"> <div class="container inner"> </head> <body> <h1>Error Processing Form</h1> <br></br> <h3>Some Information was not Entered,please return to the form and fill it out </h3> <tr></tr> <?php echo $errorString; ?> <p></p> <p><a href="register.php" class="button">Go Back to the Form</a></p> </body> </div> </div> </html> <?php } else { $email = $_POST['login_email']; $pass = SHA1($_POST['login_password']); $confirm = SHA1($_POST['confirm']); $fname = $_POST['first_name']; $lname = $_POST['last_name']; $addressone = $_POST['address_one']; $addresstwo = $_POST['address_two']; $towncity = $_POST['town_city']; $countyoption = $_POST['county_option']; $postcode = $_POST['post_code']; $phone = $_POST['phone_number']; $Activation = md5(uniqid(rand())); $insert = 'INSERT into users( login_email, login_password, confirm, first_name, last_name, address_one, address_two, town_city, county_option, post_code, phone_number, Activation) VALUES("'.$email.'","'.$pass.'","'.$confirm.'","'.$fname.'","'.$lname.'","'.$addressone.'","'.$addresstwo.'","'.$towncity.'","'.$countyoption.'","'.$postcode.'","'.$phone.'","'.$Activation.'")'; $result2 = mysql_query($insert) or die("Failed Inserting your data"); if($result2) { require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; $mail->Host = "smtp.mysettings.com"; // SMTP server $mail->Username = "support@myhost"; // SMTP account username $mail->Password = "password"; // SMTP account password $mail->From = "myhost@myhost.com"; $mail->FromName = "Admin"; $mail->AddAddress($email,$fname." ".$lname); $mail->Subject = "First PHPMailer Message"; $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer."; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } $to = $email; $subject = "Confirmation from Test to $username"; $header = "Test: Account Confirmation from Test"; $message = "Please click the link below to verify and activate your account."; $message .= "http://www.test.com/account/confirm.php?passkey=$activation"; $sentmail = mail($to,$subject,$message,$header); if($sentmail) { echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } } } header( 'Location: /account/success.php' ) ; include '../footer.php'; ?>
  3. I'm trying to set up what I thought would be an easy form with button. I want to get the registration information out of the form when someone fills it out and pays. Instead, clicking the button leads to a mess of bad information at the top of the PayPal page. I think I'm missing something that pulls the data out of the form when someone registers. Looking at some examples online, someone who has done this before could probably fix my code in a few minutes. I thought the HTML skills learned I learned in the mid/late 90s were adequate for this. Sorry for the wall of code, but I provided it below. I've spent hours to get to this point and made a bunch of changes from some other forums and it still drops and error. http://www.lifeatpathway.com/what-s-happening/mukti-5k-registration <form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="mukti5k" id="5k" onsubmit="this.target='paypal'; return UpdateForm(this);" > <table> <tbody> <tr> <td>First name:</td> </tr> <tr> <td><input type="hidden" name="on0" value="First Name" /> <input type="text" name="os0" size="30" /></td> </tr> <tr> <td>Last name:</td> </tr> <tr> <td><input type="hidden" name="on1" value="Last Name" /> <input type="text" name="os1" size="30" /></td> </tr> <tr> <td>Address:</td> </tr> <tr> <td><input type="hidden" name="on2" value="Address" /> <input type="text" name="os2" size="30" /></td> </tr> <tr> <td>City:</td> </tr> <tr> <td><input type="hidden" name="on3" value="City" /> <input type="text" name="os3" size="20" /></td> </tr> <tr> <td>State:</td> </tr> <tr> <td><input type="hidden" name="on3" value="State" /> <input type="text" name="os3" size="2" /></td> </tr> <tr> <td>Zip:</td> </tr> <tr> <td><input type="hidden" name="on3" value="Zip" /> <input type="text" name="os3" size="10" /></td> </tr> <tr> <td>Phone:</td> </tr> <tr> <td><input type="hidden" name="on3" value="Phone" /> <input type="text" name="os3" size="14" /></td> </tr> <tr> <td>Email:</td> </tr> <tr> <td><input type="hidden" name="on3" value="Email" /> <input type="text" name="os3" size="30" /></td> </tr> <tr> <td>Age:</td> </tr> <tr> <td><input type="hidden" name="on3" value="Age" /> <input type="text" name="os3" size="2" /></td> </tr> <tr> <td>Gender:</td> </tr> <tr> <td><input type="radio" name="gender" value="male" /> Male <input type="radio" name="gender" value="female" /> Female</td> </tr> <tr> <td>Race:</td> </tr> <tr> <td><input type="radio" name="race" value="5k" /> Mukti 5K <input type="radio" name="race" value="1m" /> Mukti 1 Mile Fun Walk</td> </tr> <tr> <td><input type="hidden" name="on1" value="Shirt Size" />Shirt Size: </td> </tr> <tr> <td><input type="radio" name="shirt" value="ys" /> Youth Small <input type="radio" name="shirt" value="ym" /> Youth Medium <input type="radio" name="shirt" value="yl" /> Youth Large <br /><input type="radio" name="shirt" value="as" /> Adult Small <input type="radio" name="shirt" value="am" /> Adult Medium <input type="radio" name="shirt" value="al" /> Adult Large <input type="radio" name="shirt" value="axl" /> Adult XL <input type="radio" name="shirt" value="axxl" /> Adult XXL</td> </tr> <tr> <td colspan="2" align="center"> <div> </div> <div><input type="checkbox" name="agree" value="agree_terms" /> By checking this box, I, intending to be legally bound for myself, my heirs, my executors and administrators, waive, release and discharge any and all rights and claims which I may have or which hereafter may arise from all claims of damage, actions, injury or death received in any manner before, during or after participation in the 2014 Pathway Church Mukti 5K and 1 Mile Run/Walk on Saturday, May 10, 2014. I shall abide by all decisions of race officials as final. I also release the sponsoring organizations and individuals from all legal responsibility or liability for the use of any photographs involving me for the purpose of advertising or reporting.</div> </td> </tr> </tbody> </table> <input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" alt="Register Now" align="middle" /> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="business" value="mikejohnston5@gmail.com" /> <input type="hidden" name="return" value="http://www.lifeatpathway.com" /> <input type="hidden" name="currency_code" value="USD" /> <input type="hidden" name="bn" value="PP-ShopCartBF" /></form>
  4. HI I am desperate for some help with my coding I have spent hours trying to work it out and now completely stuck and need it to go live asap. I am new to php and have been asked to create a contact form with a file attachment. The form is sending to the email address but i am getting no information from the fields and no attachement. The HTML for the form is: <form action="contact.php" method="post" name="mainform" enctype="multipart/form-data"> <table width="800" border="0" align="center" cellpadding="5" cellspacing="5"> <tr> <th width="186" align="center" valign="middle">Name</th> <td width="739"><input name="fieldFormName" type="text"></td> </tr> <tr> <tr> <th valign="middle">Email</th> <td><input name="fieldFormEmail" type="text"></td> </tr> <tr> <th valign="middle">phone</th> <td><input name="fieldSubject" type="text" id="fieldSubject"></td> </tr> <tr> <th valign="middle">Covering Letter</th> <td><textarea name="fieldDescription" cols="20" rows="6" id="fieldDescription"></textarea></td> </tr> <tr> <th height="51">Attach Your File:</th> <td><input name="attachment" type="file"></td> </tr> <tr> <td colspan="2" style="text-align:center;"><input type="submit" class="submit" id="submit" value="Send message" /> <input type="reset" name="Reset" value="Reset"></td> </tr> </table> </form> And The Php is in a seperate file and is: <?php error_reporting(E_ALL); ini_set('display_errors','1'); if(!isset($_POST['submit'])) { // Email address verification, do not edit. function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n"); $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $covering_letter = $_POST['covering_letter']; $submit = $_POST['submit']; if(empty($name)) { echo '<div class="error_message">Attention! You must enter your name.</div>'; } elseif(empty($email)) { echo '<div class="error_message">Attention! Please enter a valid email address.</div>'; } elseif(!isEmail($email)) { echo '<div class="error_message">Attention! You have enter an invalid e-mail address, try again.</div>'; } elseif(empty($covering_letter)) { echo '<div class="error_message">Attention! Please enter your message.</div>'; } elseif(!isset($submit) || empty($submit)) { echo '<div class="error_message">Attention! Please enter the verification number.</div>'; } elseif(trim($submit) != '4') { echo '<div class="error_message">Attention! The verification number you entered is incorrect.</div>'; } if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "hello@yourdomain.com"; $address = "stewart@bigscaryvc.co.uk"; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = "You've been contacted by $name."; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = "You have been contacted by $name, the additional message is as follows.\r\n"; $e_content = $covering_letter . '\r\n'; $e_reply = "You can contact $name via email, $email or via phone $phone"; $msg = wordwrap( $e_body . $e_content . $e_reply, 70 ); $headers = "From: $email" . PHP_EOL; $headers .= "Reply-To: $email" . PHP_EOL; $headers .= "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: multipart/form-data; charset=utf-8" . PHP_EOL; $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL; if(mail($address, $e_subject, $msg, $headers)) { // Email has sent successfully, echo a success page. echo "<fieldset>"; echo "<div id='success_page'>"; echo "<h4>Email Sent Successfully</h4>"; echo "<p>Thank you $name, your CV has been submitted to us.</p>"; echo "</div>"; echo "</fieldset>"; } else { echo 'ERROR!'; } } Thankyou for any help you can give me
  5. Hi there, My head is stuck at this moment. I've got a textfile with words. Each word starts at a new line. I want to let the user delete a word(line) from this textfile after a button click. I managed to add the "add word to the list" function, but now i want a delete button variant. There are four files. myscript.js, vulwoorden.txt, word_filter.php and delete.word.php. This is the code for myscript.js: //User can add word to wordfilter $("body").on("click", ".hide_word", function(e){ e.preventDefault(); var word = $(this).data("word"); $.ajax({ url: 'includes/set.word.php', type: 'POST', data: 'word=' + word, success: function (){ }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); $(this).parent().parent().hide('slow', function(){ $(this).remove(); }); }); //User can delete word from wordfilter $("body").on("click", ".delete_word", function(e){ e.preventDefault(); var word = $(this).data("word"); $.ajax({ url: 'includes/delete.word.php', type: 'POST', data: 'word=' + word, success: function (){ }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); $(this).parent().parent().hide('slow', function(){ $(this).remove(); }); }); This is the code for the word_filter page <?php $lines = file('./includes/vulwoorden.txt'); $i=1; echo '<table id="wordlist" class="table">'; foreach ($lines as $line_num) { echo '<tr>' . "<td>" . $line_num . '</td><td>'; echo '<a data-word="' . $line_num . '" class="btn-danger btn-sm delete_word">Verwijder woord</a></td></tr>'; $i++; echo '</table>'; ?> And this is the code for delete.word.php (this code is just a copy from the set.word.php, so this is code to add a word to the textfile. <?php $fn = "vulwoorden.txt"; $file = fopen($fn, "a+"); if(isset($_POST['word']) && trim($_POST['word']) != "" && !is_null($_POST['word'])) { $word = $_POST['word'] . "\r\n"; fwrite($file, $word); } ?> I know how to do it with a form, but i want to do it combined with Ajax, so the users won't have to refresh the page. Thanks in advance!!
  6. I have a database with the table name "Controllers" and the primary ID and other fields. Each time their is an event (alarm) the database creates a new table the name being based on the primary ID from one of the rows from the table "Controllers" to which the event relates to. Thus for example a Table "Alarm212" is created (the 212 is one of the primary ID's in the Table "Controllers") Is it possible and what would such a php statement be so that when viewing the data in the Table "Controllers" on a Web Page the php function is run for a particular row when a button is clicked, which then runs the php based on the "Controllers" primary ID in that particular row so it finds and the appropriate Table and then displays the info from this Table "Alarms212" , etc... New tables, Alarms 213, Alarms 214, are continually being added to the database. Any guidence will be appreciated.
  7. I am using MYSQL ,MYISAM table type and php version 5.4.16 and am doing a fulltext search based on the (product_name) column and i want to randomize the result of rest of the columns but the problem is rand()not giving the random values. I tried something like this: SELECT `product_name`,`main_cat_id`,`sub_cat_id`,`prod_cat_id`,`prod_short_desc`,`com_id`,`product_id`,product_ratings, `min_order_quantity`, `fob`,`country_id`,`company_name`,`attributes`,`attr_values`,`verify`,`image`,product_additionals , MATCH (`product_name`)AGAINST ('"girls top"'IN BOOLEAN MODE) AS relevance, MATCH (`product_name`)AGAINST ('girl* +top*'IN BOOLEAN MODE) AS relevance1 FROM pep_browse_com_prods WHERE (MATCH (`product_name`) AGAINST ('"girls top"'IN BOOLEAN MODE) OR MATCH (`product_name`) AGAINST ('girl* +top*'IN BOOLEAN MODE)) AND STATUS = '0' AND display = '0' ORDER BY relevance DESC,relevance1 DESC,RAND() limit 20; I want to set the relevance first then i want the random values of rest columns.
  8. Hello everyone, I have been searching on internet about using paypal payment for a minicab booking form I havebut I couldnt find anything that I could use. What I have; The visitor comes to website and start completing the form. They get a price on the second page and the third page is the process page. The data goes to database and customer gets an email and the website admin gets the booking form in email. What I want to do; I want to enable paypal payment so visitor can pay for the minicab journey online. I need the get this working in a way that visitor gets the second page and sees the price, clicks Book & Pay by paypal button and visitor is redirected to paypal for payment, after payment, all the data enters the database (The variables are about 10-15) and customer gets the email and also lands on the success page. If the payment is not successfull then nothing goes to data base and visitor does not get email and visitor then is redirected to cancellation page. I hope I could explained, Could anyone help me how to do it or where I can find the information I needed. Regards
  9. I'm currently working on a WordPress website project and I am hoping someone can help me out on this. In the registration page, the data entered is stored into the WordPress database. I've also build a connection to store those data into an external database as well. So basically, If a visitor registers on the site, their data info is stored in the WP and external DB. My question is since the external DB relies on checking to see if the submit button has been pressed, do those data input values need to be escaped to prevent sql injection into the external DB since the data submitted to WordPress has already been sql escaped? Thanks for helping.
  10. Hi , i have a database (dept_db) it contents of 3 tables (web , net , prog) , when i choose Dept like for example i makes Dept to (Web) so the (Web) group appears in the Students that get the inserted data from web table and display it in Students .and when i choose (Net) the Net group appears ,and when i don't choose any group ,i want it to disable the Students Select Tag which function must i use and where and how ! this is a example : http://www.redsn0w.us/2010/03/download-direct-links-jailbreak-guides.html
  11. Hello, I have csv filename with date. Everyday i have same csv file with respective date. I need to read filename (everyday date changes in filename) and do operation. For example, I have file "cells_20140106_165532.csv". I did like this to read it in general: $filename = "cells_".date('Ymd_hmi').".csv"; $file_contents = file_get_contents($filename); $importcsvsql = ""; It is taking current date instead of filename's date. It is generating empty file "cells_20140114_110109.csv" Thanks in advanced.
  12. Hi there, I am having a small problem getting php to work with google maps APIs. Basically, I have an API url where I pull down lat/long coordinates from for 10 houses and then I want these to map out on the google maps. So, I am not sure how to link the 2 together.. Here is what I have so far: <?php // Loading Domus API $url_search = 'http://url/site/go/api/search'; $xml_search = @simplexml_load_file($url_search) or die ("no file loaded") ; //Displaying latitude and longutude $xml_search = json_decode($xml_search); foreach($xml_search->property as $house) { echo $lat = $house->address->latitude , $long = $house->address->longitude; }; ?> and JavaScript bit: var locations = [ ]; var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(-33.92, 151.25), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } Many thanks
  13. I have a website that has two separate databases - customdbase2 and sfdsomni. There are two problems I believe are caused by the system not pulling configs and coupons tables from the correct database: 1. Coupon amount is posted on the form, but the authorize.net transaction is for the non-coupon amount. The coupons table is in the customdbase2 database NOT the sfdsomni database. 2. Email is supposed to be generated (Thanks for signing up kind of thing). The email that goes through is blank. The configs tables contains the email text used to create the body of the message. The configs table is in the customdbase2 database NOT the sfdsomni database. There is a form that uses authorize.net to process a credit card for customers to make purchases. I've tested it and the purchase works and it goes through but it does not apply the coupon to the price and processes the transaction without the coupon. After the transaction goes through, I get the following: Thank you for signing up! You should receive an e-mail confirmation of your purchase soon. You may start right away by logging in here: http://www.x1234.com/driving/. Table 'sfdsomni.configs' doesn't exist Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in/home/content/90/11644390/html/www.x1234.com/includes/config.inc.php on line 296 Table 'sfdsomni.configs' doesn't existTable 'sfdsomni.configs' doesn't existTable 'sfdsomni.coupons' doesn't exist It seems to be asking for the two tables "configs" and "coupons" from the sfdsomni db when it should be getting them from customdbase2. In session.inc.php the database connects to customdbase2 as $sqlbase and sfdsomni as @sqlbase_de. I have looked in buynow.php and it is setting a $global that looks suspicious. <? session_start(); // removed these slashes to turn on https 1-13-2014 1116am if ($_SERVER[HTTPS] != "on") header("Location: https://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]); // turn these off if you want to disable adding the users to the database $adduser_normal = true; $adduser_driversed = true; $root_dir = "./"; require_once($root_dir."includes/config.inc.php"); require_once($root_dir."includes/overall_header.inc.php"); require_once($root_dir."includes/dbconnect.php"); $action = $_REQUEST[action]; if (empty($action)) $action = "showform"; $sqlbase = dbConnect(); $id = mysql_real_escape_string($_REQUEST[id]); if (empty($id)) exit; $sql = "SELECT * FROM packages WHERE packageID='$id'"; $query = mysql_query($sql, $sqlbase); echo mysql_error(); $pkg = mysql_fetch_array($query); if (empty($pkg[packageID])) exit; function create_uid() { global $sqlbase_de; /* THIS IS WHAT I AM SUSPICIOUS OF */ $size = 16; $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; do { do { $id = ""; for($i=0;$i<$size;$i++) { $id = $id . substr($str,mt_rand(0,strlen($str)-1),1); } $row = mysql_fetch_array(mysql_query("SELECT id FROM ac_users WHERE UID='".mysql_real_escape_string($id)."'", $sqlbase_de)); } while ($row); } while(strlen($id) != 16); return $id; } if ($action == "checkcoupon") { $sql = "SELECT * FROM coupons WHERE code='".mysql_real_escape_string($_REQUEST )."' "."AND maxuses > timesused "."AND (expiration > NOW() OR expiration IS NULL)";$query = mysql_query($sql); echo mysql_error();$coup = mysql_fetch_array($query); if ($coup[code=auto:0] && $coup[minpurchase] <= $pkg[price]) {$_SESSION[couponID] = $coup[couponID];$dollaroff = $coup[amount] / $pkg[payments];$pkg[price] = number_format($pkg[price] - $dollaroff, "2", ".", ",");$action = "showform";}elseif ($coup[code=auto:0]){echo "You entered a correct coupon code, however the minimum purchase price for this coupon is ".displayAsCurrency($coup[minpurchase]).". Please try again.";$action = "applycoupon";}else{echo "You entered an invalid coupon code.<br /><br />";$action = "applycoupon";}} if ($_SESSION[couponID]){$sql = "SELECT * FROM coupons WHERE couponID='".mysql_real_escape_string($_SESSION[couponID])."' ";$query = mysql_query($sql); echo mysql_error();$coup = mysql_fetch_array($query);} $authnet_payments = $pkg[payments];$authnet_charge = $pkg[price];$product_title = $pkg[title];$product_desc = $pkg[description]; if ($action == "applycoupon"){?><a href="<?= $_SERVER[php_SELF]; ?>?id=<?= $id; ?>">Back</a> to order form.<br /><br /><form method="POST" action="<?= $_SERVER[php_SELF]; ?>"><input type="hidden" name="action" value="checkcoupon" /><input type="hidden" name="id" value="<?= $id; ?>">Coupon Code: <input type="text" name="code" size="30" value="<?= $_REQUEST[code=auto:0]; ?>" /><br /><br /><input type="submit" value="Apply Coupon" /></form><?} buynow.php config2.inc.php
  14. Hi. Sorry if I've posted in the wrong forum or something - I joined this forum a few seconds ago. I'm trying to create something which displays all of the users in a database table in a drop-down menu. I've tried this code: <?php include 'config.php'; session_start(); $suser = $_SESSION['user']; $con = mysql_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']); mysql_select_db($config['database']); $cpuTable = $config['cpuTable']; $query = mysql_query("SELECT * FROM $cpuTable WHERE suser='$suser'"); while($row = mysql_fetch_assoc($qa)) { $users = $row['username']; echo " <select name='cpuser'> <option value='user'>$users</option> </select>"; } I created two users in the database - "cp_test1" and "cp_test2", tried the code and it outputted this: Instead of listing the users in one drop-down menu, it creates two and lists one in each. Can anyone help? Thanks
  15. Hello, everyone. Can anybody help me, i'm trying to populate an HTML table with numbers in clockwise order, starting from last cell in the table then spiralling to the center. User inputs number of rows and columns, table is generated, but i'm lost at populating cells with numbers in clockwise order. Here's the code so far: <html> <head> <style> table{ border-collapse: collapse; } table, td{ border: 1px solid black; } td{ width: 50px; } tr{ height:50px; } </style> </head> <body> <div id="input"> <form action="table.php" method="post"> Input number of rows :<br> <input type="text" name="row"><br> Input number of columns:<br> <input type="text" name="column"><br> <input type="submit" name="submit" value="Ok"> </form> </div> <div id="output"> <?php $i = 0; $j = 0; echo "<table>"; for ($col = 0; $col < $_POST['column']; $col++) { echo "<tr>"; for ($row = 0; $row < $_POST['row']; $row++) { echo "<td>"; $i++; $array[$j] = $i; echo $array[$j]; $j++; echo "</td>"; } echo "</tr>"; } echo "</table>"; ?> </div> </body> </html> Array is there because i thought i could populate the table in desired order from array. Any suggestions, directions or links will be appreciated. Please help.
  16. I am in need of some help with an existing website. The site was custom built about 4 years ago. It was coded without using any sort of framework. I have had some of these problems for a while and the hosting I was on made it difficult to get work done on it. I have recently migrated to Godaddy so I now have complete access to it. In the text below I have replaced the domain name with junk to avoid this page coming up on any searches. I am experiencing error messages in several areas: 1. When customer buys a product - the page that is output after a sucsessful authorize.net transaction contains the following: Thank you for signing up! You should receive an e-mail confirmation of your purchase soon. You may start right away by logging in here: http://www.^&%$#@.com/driving/. Table 'sfdsomni.configs' doesn't exist Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in/home/content/90/11644390/html/%$#@/includes/config.inc.php on line 296 Table 'sfdsomni.configs' doesn't existTable 'sfdsomni.configs' doesn't existTable 'sfdsomni.coupons' doesn't exist I don't see any table called configs in the sfdsomni database. I am unsure if this is the cause of the error or if it is an error with the parameter for mysql_fetch_array() or both. 2. When a customer signs up, an email is generated (welcome to our company - here is your login info kind of thing). The email that is being sent is blank and seems to have an unknown sender some of the time. There is an email text file that is editable by admins on the back end system - this seems to be fine and has not changed in years. This was a problem on the previous hosting company as well. 3. Some of the products include an online driver education course - I am receiving errors when I sign on to that as a new student: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/90/11644390/html/%$#@/driving/classes/config/courses.conf.php:155) in /home/content/90/11644390/html/%$#@/driving/classes/session.inc.php on line 70 4. As I mentioned in another post (http://forums.phpfreaks.com/topic/284998-how-do-i-keep-form-data-from-disappearing/) - I have a page used for purchases (buynow.php) - there is an "Apply Coupon" entry button on it. The coupon button currently links to another page which processes the coupon then take you back to a now blank (buynow.php). I'd like to add the coupon field to the buynow.php page and have the apply coupon button simply run through the coupon logic (this is already there and working) without leaving the buynow.php page. In other words - if a customer is buying something with a coupon - they fill out all there into (name, address etc.) add the coupon and hit "apply coupon" - when this button is pressed, if the coupon is valid - it adjusts the price. If it is not, it displays the error message without emptying the rest of the fields on the buynow.php page. 5. I would like to get the code documented so I have an idea of what file is calling what other file and where variables are being delcared. I have a feeling that there is a lot of superfluous junk lying around that is confusing me - I'd like to clean it up. Bid requirements: I need this to be a fixed cost bid for each of or a combination of the 5 problems listed, If you are confident that you can fix 1, 2 and 4 for $50 and you have no idea how much 3 will cost, please say so instead of guessing. As for the documentation - for each of the problems and mods I need to know exactly what you changed in what files and I need comments with your name and date in the code for future reference (ie /* changed by john doe on 1/12/2014 to fix apply coupon problem */) For the overall documentation mentioned in item 5 - I am looking for a document that will illustrate the relationship between the files - this can be graphical (I'd prefer it that way). Other work: I have plans to do some additional modifications to the structure of the site to increase usability. I also plan on a graphical face lift as well. I am hoping to find someone I can go back to for these jobs in the near future. I was hoping to take the time to figure these out on my own, but I have too much stuff going on and I don't want to expose my customers to these errors any longer than necessary. I am a novice at php - I feel like I could get a lot further if I could figure out how to turn on some sort of debug feature that would show me whats happening where and when. For right now, I need to get these problems fixed ASAP.
  17. there is a slide show in my web site and it have 2 pages, i want add more pages (or Infinity pages) which code i have to edit ? Thanks slidebar.php
  18. I need some help. Im trying to call a php function in ajax. The data variable needs to be inside the called function. Like: _("statusarea").innerHTML = '<div><?php showBBcodes('+data+'); ?></div>'; But no matter what i do it wont call it and if it does call it it wont show the data.
  19. i have this Logarithm equation ... the one in the red circle is the question ...soo i wanna know how to solve that equation with PHP ?
  20. Hi there, I've posted this at stackoverflow but did not receive any replies so far so I'd like to try here as well. ------ I have an array of variable dimensions and namings. Sometimes associative, sometimes partially. Sometimes just a single array, sometimes multiple dimensions. An example array is this: array(4) { ["name"]=> string(9) "Some Name" ["user"]=> array(2) { ["id"]=> int(1) ["msgs"]=> array(3) { [0]=> string(16) "My first message" [1]=> string(17) "My second message" ["folder"]=> array(2) { ["first"]=> string(13) "Some folder.." [1]=> string(17) "some other stuf.." } } } [0]=> string(17) "More random stuff" ["foo"]=> array(2) { [0]=> string(10) "more stuff" ["bar"]=> string(7) "The end" } } I would like to have a function that goes through every key and value pair and performs a function, without altering the structure of the array. In this case, I want to apply htmlspecialchars() with ENT_QUOTES on every key and value pair in the array while keeping the array itself intact structure wise. I have tried with array_walk_recursive and array_map, neither seem to do the trick. I'm pretty new to PHP but I tried the following function by messing about with how I think it should be done but it's obviously not working private function CreateErrorArray($array, $knownKeys=NULL) { if (is_array($array)) { foreach ($array as $key => $value) { if (is_array($value)) { if (is_null($knownKeys)) { $keys = array($key); $this->response['ERRORARRAY'][$key] = $this->CreateErrorArray($this->RequestClass->error[$key], $keys); } else { $keys = array_push($knownKeys, $key); $this->response['ERRORARRAY'][$key] = $this->CreateErrorArray($this->RequestClass->error[$knownKeys][$key], $keys); } } else { $this->response['ERRORARRAY'][$key] = $value; } } } }
  21. Can anyone enlighten me I just went to php.net and search for mysqli_close says it does not exist?? mysqli_close($db_con); I have been using this to try to close a connection any advice?
  22. the above image is already on the database and i want to display it just like the image below .... can any one give me a little idea on how to get this .... thank you so much ... from PHILIPPINES .. SALAMAT!
  23. Hey guys, I am trying to grab and loop data from my DB with a while loop and extract() function. right now i have something like this: echo '<div>'; // CONTAINER DIV echo '<h2>News about '. $db_name. '</h2>'; $query = 'SELECT * FROM `news_to_people` WHERE `people_db_id` = '.$db_id; $r_query = mysql_query($query); while($rows=mysql_fetch_assoc($r_query)){ extract($rows); $new_q = 'SELECT * FROM `news` WHERE `id` = '.$news_id; $run_q = mysql_query($new_q); $rows = mysql_fetch_assoc($run_q); extract($rows); echo '<ul>'; echo '<l1><a href="article?articleid='.$id.'&name='.$db_name.'">'.$title.'<br></l1>'; echo '</ul>'; } echo '</div>'; // END TO CONTAINER Now here i get the loop to fire correctly and execute. It then loops all 170+ links except in the middle of the loop , there is an error: so this means that i have a failed 2nd query somewhere in that it is skipping inside the while loop. i need to debug and find which query is bringing this error. my question is what is the best way i can write an if statement to see which query is failing or which query is not returning a proper array. also my if the query was failing wouldn't the error be asking for a proper resource ? this means the query is firing correctly and the extract() function is failing to receive all the rows. meaning that one of the rows must be returning empty or zero ? any help is much appreciated.
  24. i know i can just redirect it with jquery ,js - client side, or using php - server side, but what is the fastest way to do that when the page is loading? let say i have users from the us, uk, canada - English language, French, German, Chinese... now where is the best place to detect the ip of the country and then give the user the interface in his language? second question, if the user want to change the language with a language buttons like: English, French, German, Chinese... what is the fastest way to do that again without redirect the page to another page? client side, server side or both. i can track the ip, i can redirect the page in more than one way, but i'm looking for the fastest way and that why I'm asking this.
  25. I have been struggling with this progress bar for a while now I need to know whether it is possible to have a real time progress bar for MySQL insertions since database operations are relatively very fast. I have already browsed a few demonstrations but they all relate to data being sent to a form instead and they all seem to work perfectly. I actually have 4 files and this is implemented based on the tutorial with this link http://www.sitepoint.com/tracking-upload-progress-with-php-and-javascript/ **Form.php** <html> <head> <title>File Upload Progress Bar of MySQL Data</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="bar_blank"> <div id="bar_color"></div> </div> <div id="status"></div> <?php $time_start = microtime(true); $mysqlserver = "localhost"; $user = "root"; $pass = ""; $db = "Profusion"; $link = mysql_connect( "$mysqlserver", $user, $pass ); if ( ! $link ) die( "Couldn't connect to MySQL" ); //print "Successfully connected to server<P>"; mysql_select_db( $db ) or die ( "Couldn't open $db: ".mysql_error() ); //print "Successfully selected database \"$db\"<P>"; $result3=mysql_query("INSERT INTO dest_table.create_info SELECT * from Profusion.source_cdr") or die(mysql_error()); $progress=mysql_affected_rows(); $time_end = microtime(true); $time = $time_end - $time_start; echo "Total time taken :"." ".round($time,6) . " s"; ?> 2nd file style.css #bar_blank { border: solid 1px #000; height: 20px; width: 300px; } #bar_color { background-color: #006666; height: 20px; width: 0px; } #bar_blank, #hidden_iframe { display: none; } 3rd file **script.js** function toggleBarVisibility() { var e = document.getElementById("bar_blank"); e.style.display = (e.style.display == "block") ? "none" : "block"; } function createRequestObject() { var http; if (navigator.appName == "Microsoft Internet Explorer") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { http = new XMLHttpRequest(); } return http; } function sendRequest() { var http = createRequestObject(); http.open("GET", "progress.php"); http.onreadystatechange = function () { handleResponse(http); }; http.send(null); } function handleResponse(http) { var response; if (http.readyState == 4) { response = http.responseText; document.getElementById("bar_color").style.width = response + "%"; document.getElementById("status").innerHTML = response + "%"; if (response < 100) { setTimeout("sendRequest()", 1000); } else { toggleBarVisibility(); document.getElementById("status").innerHTML = "Done."; } } } function startUpload() { toggleBarVisibility(); setTimeout("sendRequest()", 1000); } /* (function () { document.getElementById("myForm").onsubmit = startUpload; })();// i commented this out since this collects information from the form and the last file **progress.php** <?php session_start(); $key = ini_get("session.upload_progress.prefix") . $result3; if (!empty($_SESSION[$key])) { $current = $_SESSION[$key]["bytes_processed"]; $total = $_SESSION[$key]["content_length"]; echo $current < $total ? ceil($current / $total * 100) : 100; } else { echo 100; } I need to show a progress bar as data is inserted into mysql and the total time taken for the query to execute. there are currently 28 rows to be inserted so it's not that big. Everything else seems to work except that the progress bar won't get displayed.
×
×
  • 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.