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. Daily WALKIN... PROVAB is Hiring @ Bangalore... PHP Developers with PHP5/ Codeigniter/ Zend/ Magento/ CakePHP/ Opencart/ Prestashop (1.6 to 8Yrs)... 40 Positions... Education- Any, Please refer friends... Ramesh, 080-40593555, +91-8050006446 ramesh.provab@gmail.com PROVAB, NG Complex, 30th Cross Road, Jayanagar 4th T Block, Tilak Nagar, Bangalore
  2. Hey guys. I am Looking for some help here, dunno where else to ask, but im sure someone will know where my problem is. I got this wordpress theme and cant work out whats wrong with the display image. on front end i can set the image as main image heres the php of it <?php ini_set( 'display_errors', 0 ); require( '../../../../wp-load.php' ); if (!is_user_logged_in()) { die(); } $attachmentid = (int)$_GET['id']; if ($attachmentid == 0) { die(); } global $current_user; get_currentuserinfo(); $userid = $current_user->ID; $post = get_post($attachmentid); $photo = $post->post_title; $post_parent = get_post($post->post_parent); $upload_folder = get_post_meta($post_parent->ID, "upload_folder", true); $author_id = $post_parent->post_author; //if the current user is the one who added the post if ($author_id == $userid || current_user_can('level_10')) { update_post_meta($post->post_parent, "main_image_id", $upload_folder."/".$photo); echo _d('Default image has been set',779)."<br />"._d('Refresh the page to see it change',780); } ?> and im not quite sure whats happening here, im a total ROOKIE at php as a matter of fact so yeah... the second part... the loop where its supposed call for the image, i cant really find it in all those files... maybe if somebody explains to me what happens in the last 4 liines i might figure out whats wrong?
  3. How can i add total of user's following me? The code I currently have displays ALL the user's following me, instead of saying *numbers of user's following me* <?php $friends = Friends::getFriendsForUser($data->id); if (count($friends) > 0) { $db = DB::getInstance(); foreach($friends as $friend_id) { $friend = $db->query('SELECT name, username FROM users WHERE id = ?', array($friend_id)); if ($friend->count() == 1) { echo '<table> <tr> <td><img src="images/avatar.png"></td> <td><a href="profile.php?user='.escape($friend->first()->username).'">'.$friend->first()->name.'</a></td> </tr> </table>'; } } } else { echo 'Not following anyone.'; } ?>
  4. I have been working on a code for a blog from scratch and now I have gotten the code to not throw errors but it is also not returning results. In this blog post I have created tags that can be attached to each blog post for easy reference. I have created a count of the tags on the right hand side which gives the name and a count for how many blog post use that tag. It is a link that you can click and the next step that I am having an issue with is just showing those blog post associated with that tag. I have written the code and as of right now is throwing no errors so I cannot look up how to fix it even though I have been working on it for hours. Here is the call that I am using once you click the link to pull up the results. blog_tags.php <?php include "includes.php"; $blogPosts = GetTaggedBlogPosts($_GET['tagId'], $DBH); foreach ($blogPosts as $post) { echo "<div class='post'>"; echo "<h2>" . $post->title . "</h2>"; $body = substr($post->post, 0, 300); echo "<p>" . nl2br($body) . "... <a href='post_view.php?id=" . $post->id . "'>View Full Post</a><br /></p>"; echo "<span class='footer'><strong>Posted By:</strong> " . $post->author . " <strong>Posted On:</strong> " . $post->datePosted . " <strong>Tags:</strong> " . $post->tags . "</span><br />"; echo "</div>"; } ?> Next is the function for displaying the link and counting the tags includes.php function getTagCount($DBH) { //Make the connection and grab all the tag's TAG TABLE HAS TWO FIELDS id and name $stmt = $DBH->query("SELECT * FROM tags"); $stmt->execute(); //For each row pulled do the following foreach ($stmt->fetchAll() as $row){ //set the tagId and tagName to the id and name fields from the tags table $tagId = $row['id']; $tagName = ucfirst($row['name']); //Next grab the list of used tags BLOG_POST_TAGS TABLE HAS TWO FILEDS blog_post_id and tag_id $stmt2 = $DBH->query("SELECT count(*) FROM blog_post_tags WHERE tag_id = " . $tagId); $stmt2->execute(); $tagCount = $stmt2->fetchColumn(); //Print the following list echo '<li><a href="blog_tags.php?tagId=' . $tagId . '"title="' . $tagName . '">' . $tagName . '(' . $tagCount . ')</a></li></form>'; //End of loop - start again } } This next part is the function used to pull and display the blog post. includes.php function GetTaggedBlogPosts($postTags, $DBH) { $stmt = $DBH->prepare("SELECT blog_post_id FROM blog_post_tags WHERE tag_id = :postTagId"); $stmt->bindParam(":postTagId", $postTags, PDO::PARAM_INT); $stmt->execute(); if(!empty($stmt)) { $blogstmt = $DBH->prepare("SELECT * FROM blog_post WHERE id = :blog_id ORDER BY id DESC"); $blogstmt->bindParam(":blog_id", $stmt, PDO::PARAM_INT); $blogstmt->execute(); } else { echo "Something went wrong....Please contact the administrator so that we can fix this issue."; } $postArray = array(); $result = $blogstmt->fetchAll(PDO::FETCH_ASSOC); foreach($result as $row){ $myPost = new BlogPost($row["id"], $row['title'], $row['post'], $row['author_id'], $row['date_posted'], $DBH); array_push($postArray, $myPost); } return $postArray; } Any ideas why it is not displaying?
  5. Hey everyone, I'm trying to send a JSON array to an API via HTTP POST, get a response and print it. I tried using cURL to do so, but it doesn't seem to work. I simply get zero response, a blank page. My request: <?php $data = array( "login" => "myLogin", "password" => "myPassword", "id" => "12345", "tag" => "test" ); $json_data = json_encode($data); $ch = curl_init('URL/api/mylogin'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($json_data)) ); $output = curl_exec($ch); $result = json_decode($output); echo $result; ?> The response I should be getting: {"status": 200, "message": "OK", "login_key": "abcdefh532h235yh"} any idea why I'm not getting any response? (this works ok when I manually test it using a test REST client) Thanks, Rani
  6. Hello I was wondering how could i autofill a form based on a drop down list using raw php and mysql . I know that the connection to database would have to be established but what next ? Any Pointers would be helpful Also check the attached photo to maybe understand more than I'm explaining
  7. I have created a class to build up the content in my page. I want to use this a broad as possible. Where I run into, is how to enclose certain content within (for example) a div, without the need for calling a closing tag. Below is a section of my class, which does the following: __construct -> Creates the "<article>" section (closed when ->Display() is called). This to keep each section in their own <article> tag AddHeader -> creates the header within the <article> AddContent -> creates the div in which all the content should be kept. Display -> closes the <div> and </article> and allows it to be echo'd. What I don't want is to keep calling the AddContent for every piece of content, but would like to add the content via various options like 'AddGraph', 'AddTable', which will be added to the content section. Also besides the header, potential tabs could be added, so adding the <div> after the header tag is not an option. Any good suggestions and/or source which would help me further? With kind regards Ralf <?php class PageContent { var $content; function __construct($class= NULL) { $this->content = "\n<article". (!empty($class) ? " class='". $class ."'" : "") .">\n"; //$this->content = "\n<div". (!empty($class) ? ' class=\"$class\"' : '') .">\n"; } function AddHeader($naam, $class= NULL){ $this->content .= "<header><h3". (!empty($class) ? " class='". $class ."'" : "") .">". $naam ."</h3></header>\n"; } function AddContent($class= NULL){ $this->content .= "<div". (!empty($class) ? " class='". $class ."'" : "") .">\n"; } function Display() { $this->content .= "<div class='clear'></div>\n"; $this->content .= "</div>\n"; $this->content .= "</article>\n"; return $this->content; } } ?>
  8. Hi there I am new to php. I manage 4 website for my company and I have a problem with a php page that has javascript in it The same page is on 3 of my websites and on 2 of them they display correctly. One the main website it does not work and I am at a loss to what is wrong. The person that created this page is no longer at the company and with my little knowledge I dont know where to start looking for the error. The websites are build in wordpress. Here is the working page http://regenesys.in/video/ Her eis the page that is not working correctly - http://regenesys.co.za/video/ (note that clicking on the 'Leadership Conversations', 'Media' and 'forums' does not load the other youtube videos as it does on the first site) I would really appreciate any help! Mari
  9. whwn i tried to print $_GET array it does not print anything while i am sending p_id through URL.Why it is so...... <?php $conn=mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("regis")or die(mysql_error()); $query=mysql_query("SELECT * FROM admin_page")or die(mysql_error()); //$row=mysql_fetch_array($query); echo "<table width='500' cellspacing='0' cellpadding='0' border='0'>"; echo "<tr align='centre' colspan='1' rowspan='1'><th>p_name</th><th>p_link</th><th>p_content</th></tr>"; while($row=mysql_fetch_array($query)){ $p_id=$row['p_id']; echo "<tr><td>"; $link=$row['p_name']; print "<a href=".'show_page.php?p_id=$p_id'.">" .$row['p_name'] . "</a><br>"; echo "</td><td>"; echo $row['p_link']; echo "</td></tr>"; } echo "<tr><td>"; echo "</table>"; print_r($_GET); ?>
  10. im trying to get my trim function to work is this right, im pretty new to this so sorry if its a stupid question. <tr> <td>Name:</td><td> <input type="text" name="name"><?trim($str);?></td> <td><span class="error">* <?php if (isset($errors['name'])) echo $errors['name']; ?></span></td> </tr> and im getting an error like this Undefined variable: str
  11. hi i was just wondering how i would stop spaces at the start of a field ive looked all over and i cant find anything. what i need is to stop people from putting spaces at the beginning e.g. an error will occur if i type ' Dave'
  12. hi once again im in need of help what i need is a double column one with a drop down box called type of business and one hidden one with the id, to me it would seem easier to simply code all of the options in html but the options for type of columns has been coded onto the website, i got a code sent over to me but errors are occurring so just wondering if anybody has any ideas. <td>Type of Business:</td> <select name="typeofbusiness" id="typeofbusiness"> <?php $count = count($_SESSION['typeofbusiness']); for ($i = 0; $i < $count; $i++) { if($_SESSION['id'][$i]!=$_SESSION['Id']){ ?> <option value="<?php echo $_SESSION['id'][$i];?>" <?php if (isset($_REQUEST['typeofbusiness'])&&$_REQUEST['typeofbusiness']==$_SESSION['id'][$i]) { echo'selected="selected"'; }?>><?php echo $_SESSION['typeofbusiness'][$i];?></option> <?php } } ?> ( ! ) Notice: Undefined variable: _SESSION in C:\wamp\www\AddLeads\addeadstemplate.php on line 248 Call Stack # Time Memory Function Location 1 0.0000 186688 {main}( ) ..\addeadstemplate.php:0 any help will be greatly appreciated.
  13. I have received an error when I run this code: Parse error: syntax error, unexpected 'while' (T_WHILE) in C:\wamp\www\SearchEngine\search.php on line 50 Code: <?php //php code goes here include 'connect.php'; // for database connection $query = $_GET['q'] // query ?> <html> <head> <title> Brandon's Search Engine </title> <style type="text/css"> #search-result { font-size: 22; margin: 5px; padding: 2px; } #search-result:hover { border-color: red; } </style> </head> <body> <form method="GET" action="search.php"> <table> <tr> <td> <h2> Brandon's Search Engine </h2> </td> </tr> <tr> <td> <input type="text" value="<?php echo $_GET['q']; ?>" name="q" size="80" name="q"/> <input type="submit" value="Search" /> </td> </tr> <tr> <td> <?php //SQL query $stmt = "SELECT * FROM web WHERE title LIKE '%$query%' OR link LIKE '%$query%'"; $result = mysql_query($stmt); $number_of_result = mysql_num_rows($result); if($number_of_result < 1) echo "No result found. Please try with other keyword."; else ( //results found here and display them while($row = mysql_fetch_assoc($result)) ( $title = $row["title"]; $link = $row["link"]; echo "<div id='search-result'>"; echo "<div id='title'" . $title . "</div>"; echo "<br />"; echo "<div id='link'" . $link . "</div>"; echo "</div>"; ) ) ?> </td> </tr> </table> </form> </body> </html> Thanks.
  14. Hello, Is it possible to know from which page I was redirected to current page. Say in a.php there is a link to b.php and when b.php is loaded can I decide whether I was called from a.php or not. Thanks & Regards, Samir
  15. Below is PHP using CURL with JSON to POST data to the MemberClicks API. I keep getting a 413 error when trying to process the page. I've tried a few things, but none seem to work. So far I don't get and syntax errors just on the 413. <?php if (!empty($_POST['userid']) && !empty($_POST['username']) && $_POST['data']=="Update") { $dateATOM = date(DATE_ATOM); $groupid = "12345"; $org = "ABCco"; $userid = $_POST['userid']; $username = $_POST['username']; $contactname = $_POST['contactname']; $email = $_POST['email']; $firstname = $_POST['firstname']; $middlename = $_POST['middlename']; $lastname = $_POST['lastname']; $businessaddress1 = $_POST['businessaddress1']; $businessaddress2 = $_POST['businessaddress2']; $businesscity = $_POST['businesscity']; $businessstate = $_POST['businessstate']; $businessinternationalstate = $_POST['businessinternationalstate']; $businesscountry = $_POST['businesscountry']; $businesszip = $_POST['businesszip']; $companyname = $_POST['companyname']; $title = $_POST['title']; $businessphone = $_POST['businessphone']; $mobilephone = $_POST['mobilephone']; $extension = $_POST['extension']; $fax = $_POST['fax']; $url = $_POST['url']; // Establish $url = 'https://####.memberclicks.net/services/auth'; $data = 'apiKey=123&username=user&password=pass'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $httpHeaders[] = "Accept: application/json"; curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders); curl_close($ch); $token = $jsonResult->token; // end --> $raw_json ='{"userId": "'.$userid.'","groupId":"'.$groupid.'","orgId":"'.$org.'","contactName": "'.$contactname.'","userName": "'.$username.'","attribute":[{"userId": "'.$userid.'","attId":"528954","attTypeId":"10", "attData": "'.$username.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"528955","attTypeId":"16", "attData": "'.$contactname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"528950","attTypeId":"1", "attData": "'.$email.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529209","attTypeId":"2", "attData": "'.$firstname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529210","attTypeId":"7", "attData": "'.$middlename.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529211","attTypeId":"3", "attData": "'.$lastname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529213","attTypeId":"28", "attData": "'.$businessaddress1.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529214","attTypeId":"29", "attData": "'.$businessaddress2.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529215","attTypeId":"30", "attData": "'.$businesscity.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529216","attTypeId":"31", "attData": "'.$businessstate.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529240","attTypeId":"7", "attDate": "'.$businessinternationalstate.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529217","attTypeId":"33", "attData": "'.$businesscountry.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529218","attTypeId":"32", "attData": "'.$businesszip.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529219","attTypeId":"7", "attData": "'.$companyname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529220","attTypeId":"7", "attData": "'.$title.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529221","attTypeId":"5", "attData": "'.$businessphone.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529244", "attData": "'.$mobilephone.'","attTypeId":"5","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529222","attName":"Extension", "attData": "'.$extension.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529223","attTypeId":"14", "attData": "'.$fax.'","lastModify": "'.$dateATOM.'"}, {"userId": "'.$userid.'","attId":"529228","attTypeId":"15", "attData": "'.$url.'","lastModify": "'.$dateATOM.'"}]}'; $json = json_decode($raw_json); $url2 = 'https://####.memberclicks.net/services/user/'.$userid.'/?includeAtts=true'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url2); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_POST, true); $httpHeaders[] = "Accept: application/json"; $httpHeaders[] = "Authorization: ".$token; curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders ); curl_setopt($ch, CURLOPT_FAILONERROR, true); $results = curl_exec($ch); if (curl_errno($ch)) { echo "<h2>Yes</h2>"; print "<strong>".curl_getinfo( $ch, CURLINFO_HTTP_CODE )."</strong><br><br>"; print "<strong>".curl_error($ch)."</strong><br><br>"; echo "<hr><p>".var_dump($json)."</p>"; } else { echo "<h2>No</h2>"; print curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close($ch); echo "<hr><p>".var_dump($json)."</p>"; //print curl_error($ch); //echo "<p>".$raw_json."</p>"; //header("location: getAll.php?error=Something Happened!"); } return $results; } else { header("location: getAll.php?error=Nothing Happened!"); } ?>
  16. Hi The following php code is to update values and pass it to the database . The problem is it's not updating the $lastlogin value and I can't see anything wrong with it, can anybody tell me what I'm doing wrong. Any help would be appreciated. public function login($postArray) { $jsonArr = array("status" => "unknown"); $username = $postArray['username']; $pass = sha1($postArray['password']); $ip = $_SERVER['REMOTE_ADDR']; $date = gmdate("Y-m-d H:i:s"); //login time $rowsNum = self::$dbConnection->rows_num("SELECT * FROM `users` WHERE `username`='$username' AND `password`='$pass'"); //successfully logged in if($rowsNum == 1) { //update the record self::$dbConnection->exec_query("UPDATE `users` SET `cur_ip`='$ip', `last_login`='$date' WHERE `username`='$username', `password`='$pass'"); //pull the information from the database $f = self::$dbConnection->query("SELECT * FROM `users` WHERE `username`='$username' AND `password`='$pass'"); $userid = $f['id']; $lastlogin = $f['last_login']; //set the login session $dataArray = array("userid" => $userid, "username" => $username, "lastlogin" => $lastlogin); //set status $jsonArr['status'] = "login_success"; $jsonArr['userdata'] = $dataArray; } else { //set status $jsonArr['status'] = "login_fail"; } return $jsonArr; }
  17. Hello, I've been struggling with an issue for a few days now and I was hoping someone could help. I bought a php script that allows me to create paypal adaptive payments. It works great, it's all set up. My only issue is that I can't find the proper place to set my code so that it will make an update call to my php database. The problem with that is I'm not sure how to set up paypal url forwarding to forward them to a webpage where the php code could run, so I either have to give them what they paid for BEFORE they pay and cancel the sale if they choose not to continue on with the transaction(which is my current problem) -OR- Call the code to update my database after I receive the transaction complete from POST data (which is what I would like to do.) I have 3 scripts. Buy.php which handles the actual transaction Paypal_API script which has the method definitions within it, and an IPN script which has the IPN listener within. Which three of these scripts should I place the code to update my database? I've tried placing it inside all three at various places, it doesn't seem to work in the IPN script at all, and the other two scripts give me the first problem I mentioned. Any help would be greatly appreciated and you might just win the "internets".
  18. I am in the process of converting a widget plugin where the user inputs the settings via the widget page to where the user inputs the settings via an admin page. Everything is working fine, apart from the dropdown option. This is the settings field callback with the dropdown: <?php public function socialiconsselect_callback() { printf( '<select id="socialiconsselect" name="social_contact_display_options[socialiconsselect]" />', $options = array('Light', 'Dark', 'Modern Flat', 'Cute', 'Shaded', 'Simple Flat', 'Circle', 'Vintage', 'Retro', 'Retro 2', 'Wooden', 'CSS and HTML5 set 1', 'CSS and HTML5 set 2') foreach ($options as $option) { '<option value="' . $option . '" id="' . $option . '"', $socialiconsselect == $option ? ' selected="socialiconsselect"' : '', '>', $option, '</option>', } '</select>', isset( $this->options['socialiconsselect'] ) ? esc_attr( $this->options['socialiconsselect']) : '' ); } Can anyone see what I have done wrong? Put this through PHPStorm and corrected the syntax errors it stated, which gave me this: public function socialiconsselect_callback() { printf( '<select id="socialiconsselect" name="social_contact_display_options[socialiconsselect]" />', ($options = array('Light', 'Dark', 'Modern Flat', 'Cute', 'Shaded', 'Simple Flat', 'Circle', 'Vintage', 'Retro', 'Retro 2', 'Wooden', 'CSS and HTML5 set 1', 'CSS and HTML5 set 2'))); foreach ($options as $option) { '<option value="' . $option . '" id="' . $option . '"'; $socialiconsselect == $option ? ' selected="socialiconsselect"' : ''; '>'; $option; '</option>'; } '</select>'; isset( $this->options['socialiconsselect'] ) ? esc_attr( $this->options['socialiconsselect']) : '' ; } The page now loads, but still does not show any options in the dropdown..
  19. Hi, I have a problem with importing .csv file. The content of file have some rows with invalid culomn number. Can I skip rows with this error? My code is: <?php $addauto = 1; $delimiter = ';'; $csoport_kod = new mysqli('localhost', 'root', '', '2012'); $csoport_kod->query("DELETE FROM gf1"); $i=1; if (($handle = fopen("ftp://2012.com/gf1.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 10000, $delimiter)) !== FALSE) { foreach($data as $i => $content) { $data[$i] = $csoport_kod->real_escape_string($content); } $csoport_kod->query ("INSERT ignore INTO gf1 VALUES('" . implode("','", $data) . "');"); } fclose($handle); } echo 'OK' ?> THX!
  20. when click on the add new button table , label , textboxes(html form) , all apear same as above...view in photo
  21. Hey All, I have built a website using PHP and MySQL where users have to log in to use the site. I'm now trying to create a page on the site where logged in users can change their password if they need/want to. I thought this would be fairly easy and straight forward but I'm having a ton of issues. I've never been formally trained in PHP and MySQL, I've just picked up stuff along the way throughout the years so when I get into advanced stuff I start to struggle. I'm using MD5 hashing for the passwords right now. I already know this isn't the most secure method but since I'm familiar with it I'm just going to go with it for now. I'll worry about changing the hashing later. Anyway, the PHP code lives on the same page as the form. The HTML portion of the form has the following fields: Current Password (id="cur_password") New Password (id="password1") Confirm New Password (id="password2") Within the script I'm trying to verify that the Current Password and the password in the database match, but because of the MD5 I'm not exactly sure how to do this. Here is what I have so far: $sql = "SELECT * FROM users WHERE username='$log_username'"; $query = mysqli_query($db_conx, $sql); while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { $username = $row[username]; $password = $row[password]; } $cur_password=md5($_POST['cur_password']); $password1=md5($_POST['password1']); $password2=md5($_POST['password2']); if (empty ($_POST['cur_password'])){ echo "Fill out all fields."; } else if ($cur_password != $password) { echo "There was a problem. Wrong Password."; } else if ($passord1 != $password2) { echo "Passords don't match."; } else { $sql = "UPDATE users SET password = MD5('$password1') WHERE username='$log_username' LIMIT 1"; $query = mysqli_query($db_conx, $sql); echo "Success! Password has been changed."; } When I test I keep getting the "Fill out all fields." message even though I submitted the form and none of the fields were blank. If I take the "empty" statement out I just keep getting the "There was a problem. Wrong Password." message which should happen only if the current password typed in and the current password in the database don't match. I know that I'm putting in the correct matching password. Anyway, any help you could give would be greatly appreciated. Thanks so much.
  22. My error codes are not working , i declared them as follow if(isset($_POST['login_submit'])){ $query = mysql_query("SELECT id FROM users WHERE login_email = '". $_POST['login_email'] ."'") or die(mysql_error()); $email_check = mysql_num_rows($query); $email_check_data = mysql_fetch_array($query); if(empty($_POST['login_email']) || empty($_POST['login_password'])){ echo "<div class=\"notification warning\"> Please fill in all the fields below </div>"; } elseif($email_check == 0) { echo "<div class=\"notification error\"> Email address or password . Please check your email! </div>"; is there anything wrong ? If the fields are empty or i input no email or password no erros displayed
  23. I have in promotie.php the next form: <form accept-charset="UTF-8" action="redirect.php"> <input name="code" type="text" id="code" maxlength="15" /> <input type="submit" value="Submit"/> </form> In redirect.php I have this code: <?php header('Location: download.php?code='.$_POST['code']); ?>What I want to do is the next thing: I will create a file code.txt, where I write on each line my promotional codes. Now how can I redirect to promotieerror.php or show a error if the code that was writed by the user doesn't exist in code.txt ? P.S.: I don't want to use MySQL/Databases. Thanks in advance for help.
  24. there is some problem with my code but i couldn't find it.its telling invalid file while i tried with .jpg file which is allowed extension in this file any help is greatly appreciated......... html code: <html> <body> <form action="upload_filee.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html> upload_filee.php: <?php $allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); print_r($_FILES); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png")) //&& ($_FILES["file"]["size"] < 20000000) && in_array($extension, $allowedExts)) { print_r($_FILES); if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } } else { echo "Invalid file"; } ?>
  25. Hello I got a question , Im trying to add balance after each transaction ,what I tried to do is to echo $account Balance and then use function to deduct the row amount Im really confused and can't figure it out how i would i achieve such thing : The code I've used <td>£ <?php echo number_format ($account['balance'] + $row['amount'], 2); ?></td>
×
×
  • 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.