PHP - Need An Advice On How To Continue !
hello
i need someone to take a look on this , General comments on the code process and how should i continue !!! [attachment deleted by admin] Similar TutorialsHelp...I almost had this but I included the password field in my form now it is not working. What was happening before I had all the tested members added to the Welcome page at once. When I put in the password field it is not welcoming anyone so sessions is not operating. // Get the user session id variable into a local php variable for easier use in scripting $id = $_SESSION['id']; // Now let's initialize vars to be printed to page in the HTML section so our script does not return errors // they must be initialized in some server environments $firstname = ''; $lastname = ''; $country = ''; $email = ''; //Formulate Query //This is the best way to perform an SQL query $query = "SELECT id, firstname FROM `Members` WHERE id='$id'"; $result = mysql_query($query); //Check result //This shows the actual query sent to MySQL and the error. Useful for debugging. if(!$result){ $message = 'Invalid query:' . mysql_error() . "\n"; $message .= 'Whole query:' . $query; die($message); } //Use result //Attempting to print $result won't allow access to information in the resource //One of the mysql result functions must be used //See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while($row=mysql_fetch_assoc($result)){ echo "Welcome, {$row[firstname]}"; } //Free the resources associated with the result set mysql_free_result($result); At one point it when it was including everyone all at once it was able to view the private pages but the new update password takes me back to square one. It was showing a error message with SQL " after the WHERE clause where I had the id={$_SESSION['id']} so I just tested to see how the codes id='$id' would work and it does not have the echo Welcome, firstname. these codes are very tricky. hi i am stuck in a loop please can someone check what is miss. I wants to quit from loop and go to next title if that tile is found but cant figure out how should i go. my code: $feed_url = "http://www.myfeed.com/feed/"; $xml = simplexml_load_file($feed_url); foreach ($xml->channel->item as $item) { $ns_content = $item->children('http://purl.org/rss/1.0/modules/content/'); $title = $item->title; // opening file which contain titles already $content = file('file.txt'); foreach ($content as $aline) { if (strstr($title, $aline)) { $found = true; } } // i dont wants to print that $title which is already in file.txt so loop continue. if($found) { continue; } echo $title . "<br>" ; } Problem is with that continue statement if a title is matched from file.txt it will display me nothing, i only wants to skip that title and echo other titles. thanks for any help im building a form in php and is their away to have a submit or continue button on the same page so if ya want to fill in more it will go to the next page if not it will e-mail the info By calling function two will it break the loop?; or do i have to echo what is returned? Code: [Select] functione one() { $getids = mysql_query("SELECT * FROM table"); while($row=mysql_fetch_assoc($getids); { $this->two(); } } function two() { return 'break;'; } I have spent the last few days going over Zend framework 2, and I am finding it extremely complex. Not saying it shouldn't be, but it seems to solve problems I never have come across (so to speak) .
For instance:
Routing is super complex. I usually use torophp - which is simple & gets the job done.
Dependency injection - example of problem I have never come across.
My motivations for learning zend, are -
1. To write modular reuseable code.
2. Learn advanced / modern PHP , as far as frameworks are concerned I just know codeigniter.
3. A framework with good long term support.
Is there some other framework that is easier to learn ? and that would satisfy my requirements ?
I have been programming in PHP for the last 2-3 years btw, so I know my way around
Thanks
Edited by nik_jain, 31 August 2014 - 09:56 AM. This topic has been remastered in brilliant HD quality in JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=356870.0 i'm need to retrieve a session after i've collected the data and went to PayPal (...urk...) i think i'm starting off correctly... but how the hell do i get the session name on the other side? Code: [Select] $uuid = uniqid(); session_name = $uuid; session_start(); // do some stuff // go to PayPal // come back from PayPal ....um... now i'm lost! how do i get the $uuid here?? once i come back from PayPal... this is where i get lost. how do i load a UUID-based session if i can't get the $uuid? and if there's a better way, by all means let me know! someone said i could pass the $uuid through PayPal, but i'm not seeing how yet... TIA gang! WR! I am getting the following error when using composer: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? Just started. I am pretty sure composer.json wasn't changed. journalctl doesn't show anything. Maybe Doctrine related, however, nothing seems to help.
Any ideas? [michael@devserver www]$ php -v PHP 7.3.4 (cli) (built: Apr 2 2019 13:48:50) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies with DBG v9.1.9, (C) 2000,2018, by Dmitri Dmitrienko [michael@devserver www]$ composer -V Composer version 1.4.2 2017-05-17 08:17:52 [michael@devserver www]$ yum info composer Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.us.oneandone.net * epel: mirror.rnet.missouri.edu * extras: mirror.us.oneandone.net * remi-php73: mirror.bebout.net * remi-safe: mirror.bebout.net * updates: mirror.us.oneandone.net Installed Packages Name : composer Arch : noarch Version : 1.8.4 Release : 1.el7 Size : 1.8 M Repo : installed From repo : epel Summary : Dependency Manager for PHP URL : https://getcomposer.org/ License : MIT Description : Composer helps you declare, manage and install dependencies of PHP projects, : ensuring you have the right stack everywhere. : : Documentation: https://getcomposer.org/doc/ [michael@devserver www]$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) [ErrorException] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]... [michael@devserver www]$
In short i want to use the following code below, when someone selects there option and submits it, it would bring up details from the database on this user from the selected table, can you explain what it would be called doing this so i can look it up, Sorry to be a pain, Cheers. Code: [Select] <select name="target2" id="target2"> <option value=""></option> <?php $sql = "SELECT player_id, friend_id, name, is_active FROM contacts as c JOIN players as p ON c.friend_id = p.id WHERE c.player_id = $playerID AND is_active = 1 ORDER BY name ASC"; $que = mysql_query($sql) or die(mysql_error()); while($list = mysql_fetch_array($que)) { ?> <option value="<?php echo $list['friend_id'] ?>"><?php echo $list['name'] ?></option> <?php } ?> </select> Hi all, I am looking as a pet project to develop a review site, with the info stored in a database by id and the information grabbed bet get id and then displayed on a dynamic page, eg review.php?id=1 My question is this, if i throw keywords into the mix for each review, will search engines cache a review like this? Or would I need static pages for google etc to find the info? Thanks Hi, basically i have data in my database i want to represent as cash, i currently put the dollar sign infront of each echo which is fine, but how would i go about adding , to the php code itself as you cannot do this from the sql database.. Right now I have a SESSION so when users flip though pages they carry their info with them, what I'm trying to do now is that userhome.php can't be accesses unless the user just was succesful in cracking there system.. game I'm creating for those of you helping and following me while I do this! it's a virutal hacking simulation and where I'm now is that the user's passwordcracker was compared to the target systems 'systemkey' and either granted him access or didn't, if it did it displayed a progress bar then fowarded to userhome.php where the target users info will lay, right now though if I just type in userhome.php i get there without haveing the crack it.... any ideas? Hello, can someone please advice me on what scripts I will need to accomplish the following. I want users to be able to login to their personal page, on there will be items such as pdf files, jpeg files etc, that they will be able to download. Are there any free scripts out there that can do this, that anyone knows of? I don't mind paying if its a cheapish script for one of you to make for me, but money is a bit tight at the moment so a free script would be my 1st choice... Thanks for all your help So here's my problem I'm not sure how to approach this: I have a table with user_items which are stored together separated by commas. Code: [Select] 13,12,11,9,27,15,16,22,21,23,24,26,29,30,31,32,33 Now, I have a script where the user is in a trade and I want to verify the item they are trying to trade, but is there an alternative other than grabbing all of that users' items and checking that one item with all of the records? I've tried using Code: [Select] SELECT * FROM MYTABLE WHERE user_item_id IN(33) As an example to see if it will pull the rows with that ID. It didn't seem to work, am I doing it wrong? if so, forgive me. Any suggestions/help? The main problem is I don't want to have to explode that data and use a foreach to check that one item against all of that users items, as they could have well over 500. for those of you who don't know i am creating a piece of forum software called ASF. Ive done it by myself so far but as it grows i find it harder to write the code and keep organised. my code is a mess and things arent done the way they should be. So if anyone can give me advice or wants to help i could post some of the files for download. Even if you just want to have a look and let me know waht you think. Thanks Carl http://www.thevault.cz.cc Hello world,
Im a development fan,but not a coder.
Im planning to hire a developer for a project but i want some advice from experts first.
My project is a market place where sellers and stores could place their ads, I want it very very custom,so here are the questions.
1. Do i use php from scratch or maybe a CMS?
2.Is there a possibly to develop a custom cms to admin this project if it has been developed on php or i have to learn to code by the way?
3.how i can detail exactly what i want to the coder,is there a glossary or something like that for the modules?
this is the question that came up now,but fell free of give me all advice you think i might know.
Thanks.
Yup, the nice person left some friendly messages just to prove it. Now i need to recover. I have back up code and DB. But I need to establish what kind of hack it was and how to improve things. The big tell tale, is that all the javascript is gone off the pages. Yet the js tools ( jquery etc ) all all still there.
They also got past the login page as well.
The site was built with CodeIgniter so I had invested my trust in the framework as I will never assume I know more than the CI guys on security.
any ideas jump to mind as to what kind of hack it was and therefore what obvious things I can do to avoid it again ?
Many Thanks !!
Hello everyone. I have been told that PHP, javascript and html would be needed for this. So I am here to explain and ask your advice. Since being severely disabled in a car accident, I am trying to make use of what I have left. I would like to use my knowledge and try to help those who want to get back to work. I will give my time for free but the cost of using council premises must be paid for, albeit heavily subsedised by the benefits department. I will need a single page. It will need a datepicker (so I am told) where students can see what days are available and then select their chosen dates and complete their details. Then, the system will make some calculations and send me an email with the details that I can add to official paperwork and email on, to the student, the benefits department and the local council. I would also like to be able to "log in" to the page, to put the details in myself and still to send me the email with the details, as before. Should I explain everything I am trying to achieve, in one post, or can someone advise me as to which parts need which code and make separate posts in the corresponding threads? I am trying to study as much as possible and am finding this forum a great help. But, a little help or guidance in the right direction would be great. Thank you, in advance, for your help Chapter 2 homework is coded. It works and that is the main thing, but I dont just want the grade, I want want to learn php and be proficent at it. Is there anything that looks wrong, Variable names, lack off comments, things out of place. All advice is welcome.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "html://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Temperature Conversion</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <h1>Fahrenheit to Celsius Conversions</h1> <article> <?php $degFahrenheit = 0; function degreeConverter ($degFahrenheit) { //Function converts F* to C* $degCelsius = (($degFahrenheit - 32) * 5/9); $returnCelsius = round ($degCelsius, 1); return $returnCelsius; } do {//begining of loop $convertCelsius = degreeConverter($degFahrenheit); echo "<p>$degFahrenheit degrees Fahrenheit = $convertCelsius degrees Celsius.</p>"; ++degFahrenheit; } while ($degFahrenheit <= 100);//end of loop ?> </article> </body> </html> I am working on adding security to my code. This is new to me and I am confused at which one to use. The numbers, email and pswd are all explanatory its the text fields that are confusing me. So I have a variety of text fields where the user can input what they want. I want to be able to add in a variety of characters but want it to be secure as well. I want to be able to use the "&" so I think I want Quote FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP All the text fields will be used for descriptions or notes. Also, how secure, if at all, is this function? It was a very earlier attempt at security function check_input($data) { $data = trim($data); $data = htmlspecialchars($data); return $data; } |