ryantroop 177 Practically a Master Poster

You will need a for loop and an understanding of modulus, and a little bit of good old fashioned logic.

Good luck!

ryantroop 177 Practically a Master Poster

Uhhh... This is PHP. Nothing looks wrong with the query.

What other PHP script do you have to execute and prepare the statement?

ryantroop 177 Practically a Master Poster

remove the space in the delimiter (right now you have ", " so change it to ",") and you should be good to go.

ryantroop 177 Practically a Master Poster

The purpose was to encourage him to try on his own, giving a place to start.

I admit, I answered on my phone and didn't think to look what forum I was in... But answering this kind of question by doing the work for him hardly teaches anything. :/

Also... I do not believe your solution is at all correct to answer his problem. You may want to reread his request.

ryantroop 177 Practically a Master Poster

a function that outputs all the words ending in a "s", in a sentence sent to it as a parameter.

Done!!

No... Seriously. Why not try first, then get some feedback?

If you are in a computer science course, I hope you know what a function is. At that, you should know the parameter is what is passed into the function.

You will likely be returning an array of strings which, depending on the language you are using, can be as simple as a regex, quite ironically, as complex as a regex

ryantroop 177 Practically a Master Poster

If you have the skills for the job and you match the company culture, I don't think you have anything to worry about.

Just remember the company has to fit you just as much as you fit it. If they pass you over for being a woman or older, you probably didn't want to work there anyway.

On the plus side, pretty much every company is looking for female programmers so they don't look like Facebook or Google right now :D

ryantroop 177 Practically a Master Poster

Fyi, you can spoof origination. It's only a stop gap. If you are worried about data, encrypt it. If you can't, let the big boys take care of it for you and use alternative methods. Most cc processors will allow everything from repeat billing to single small payments through their API, and they take care of everything you don't want any business with.

ryantroop 177 Practically a Master Poster

That's a bit of security through obscurity.

To what end are you planning on doing this?

Rewrites are good for looking professional. There is little security to it. It's basically a redirect. Even if I show you that you are posting to mysuperlockeddownphpscrupt.php you won't be able to do much to it if I code proactively (rejecting requests that don't originate from your server, making sure you sanitize data, prepare SQL, etc...). The only other way you can get burned besides SQL injection attacks that is within your control is to keep your passwords locked up and strong. If someone gets root access, all the .htaccess hackery in the world won't help you.

ryantroop 177 Practically a Master Poster

The other issue- we solve many questions but they never get marked solved. Once the user implements the answer, what motivation do they have to mark it and pay for it?

ddanbe commented: You got a good point there. +0
Mya:) commented: yeah! and it's real fustrating when i try to help someone and find that it's actualy been solved :( +0
ryantroop 177 Practically a Master Poster

I do not believe SERVER_NAME includes the protocol (so, no, it should not show http://http://)

ryantroop 177 Practically a Master Poster

I believe you are looking for:
$_SERVER['SERVER_NAME']

DOCUMENT_ROOT will give you a local path on the host machine, which will begin with a drive letter and not a protocol (like http/s).

DOCUMENT_ROOT is more appropriate when doing includes where you will be traversing a file system, not when making calls over a network.

in reality, depending on how you have configured your server, you probably don't need $_SERVER['SERVER_NAME'] and you can probably use a relative path instead.

ryantroop 177 Practically a Master Poster

First, even though this is a student account you should probably get in the habit of not posting your connection data for databases (or any password, really).

The error you are getting is most likely caused by a missing module for PHP/MySQL.

So, the first question is - do you have access to this box? Do you have permissions to install files / software?

If not, you may need to ask your teacher / sysadmin what database connection drivers you have available. Since you're on windows, you may have to use ODBC instead of the MySQL driver, in which case you may have a lot more work ahead of you :-/

If you do have access, and can restart, this may be of help to you:
http://stackoverflow.com/a/17638233

TL;DR:
Download this: http://www.dll-files.com/dllindex/dll-files.shtml?libmysql
Install it here: C:\windows\system32.
Restart Apache

ryantroop 177 Practically a Master Poster

As I understand it, the ECMAScript that is the backbone of JavaScript is pretty standard among most major browsers. The type of scoping youre talking about should be pretty consistent from IE8+ (probably IE6 and 7), as well as all other flavors you will encounter.

The only way you will know for sure if you are having issues is to come across them. For the most part, Mozilla has been good about providing shims to "fix" broken code in older browsers, so when you come across something "broken" just google it and you will most likely find your solution.

ryantroop 177 Practically a Master Poster

Try this..

function seo_title(cIncoming)
{
  var cNew = "";
  cNew = cIncoming.replace(/[!@#$%^&*()_+=,\.<>\/\\\[\]\{\}]/g , ""); //build a regex for unwanted chars add whatever else you need...
  cNew = cNew.replace(/ /g, "-");
  return cNew;
}

the above is not tested. The Regex is probably off due to escaping issues, but see what you get :-P

ryantroop 177 Practically a Master Poster

What URL are you using to access this page?

ryantroop 177 Practically a Master Poster

the "placeholder" attribute (while not supported in all browsers) is a fancy way of giving a "hint" to the user as to what is supposed to go into the field. A place holder is usually something like "First Name" or "Phone Number" so when the user clicks the field, they know what they are supposed to type there. The value there ("First Name", etc..) is not the actual value of the field. If you want a default value passed in, you will need to set the value of the input, but then your placeholder would not be visibile unless the value is empty.

If you you want the GET to be passed to the form, instead of:
placeholder="<?echo ($_GET['message']);?>"
use
value="<?echo ($_GET['message']);?>"

Hope that helps!

Ryan

ms061210 commented: Yes. It helps. A lot :) Thank you so much :) +1
ryantroop 177 Practically a Master Poster

ahh my mistake I misread your question.

Yes, you can have both in the same file. PHP is quite good at this.

You simply need to check the $_POST vars coming at the top of the file, and process things as needed.

You can check
isset($_POST)

and that will let you know if something is coming in for an update, otherwise you can run the script normally.

so..

if (isset($_POST) && $_POST['search'] != '')
{
  //run update sql
}
else
{
  //show form? do whatever...
}

//you can even do the rest of the page here, and still show the page after the update :)
ryantroop 177 Practically a Master Poster

empty is a function to check the state of a variable.

you can use it as such:

<?php
 if (empty($_SESSION['MM_Username']))
   {
     echo ("<h4>please log in before adding to BASKET</h4>");
   }
</php>

see: http://php.net/manual/en/function.empty.php

however, most people use isset() instead of empty, as it checks for a variable being NULL as well.

<?php
  if (!isset($_SESSION['MM_Username']))
    {
      //do stuff
    }
</php>

see: http://www.php.net/manual/en/function.isset.php

notice the ! before the function? that means NOT, so the line reads "if variable $_SESSION['MM_Username'] is NOT set then do stuff".

good luck,

Ryan

ryantroop 177 Practically a Master Poster

You are doing nothing wrong.

As long as you understand what the redirect is doing (basically clearing your GET/POST stack), you're fine :)

He suggested doing a POST (instead of a GET, which uses the URL), as it allows for more flexibility, and the ability to do a bit more behind the scenes without cluttering up a URL.

Generally, you use the URL (or, GET) when you want to allow linking. So, a specific product can be:

https://www.mycoolsite.com/products?ProdID=121

however, lets say you keep up with this, and you decide to keep using GET (or the URL) for adding stuff...

https://www.mycoolsite.com/products?ProdID=121&AddOns=1,2,3,5,6,9,10,11&ReferalSite=foo123&SomeOtherParam=areallylongurlencodedstringwith%20forspacesorpossibly+forspaceandalotofotherweirdstuff

that URL is far from pretty and annoying to remember. Sure, you can learn about URL rewrites and all the good stuff that makes a site scalable with a data driven back end, but that comes with practice and learning about how the technologies work. You could also "hide" a lot of that and make a POST through a form, and use hidden fields as necessary, etc...

In short - there is more than one way of doing things. Some are just more "right" for the job than others.

To repeat - you are doing nothing wrong.

All of us have our own idea of good development. In this particular case, I would side with diafol and actually store a user's activty in a database to keep track. It's much safer if the data is potentially going to give you money, and when you are dealing …

ryantroop 177 Practically a Master Poster

Fair. But what if other params on the stack are also being tested. You have now blown away the stack. It's not that his script is wrong, its that he didn't understand the method of gets and posts. I would discourage a redirect, as it would just lead to further confusion and frustration down the line (unless that is a desired behavior.)

ryantroop 177 Practically a Master Poster

Heh.. welcome to the world of "stored" values and URL management.

Since you are doing a GET (or a POST), the value gets stored in the URL. When you refresh the page, you are basically resending the URL with the parameters still in place.

So, your session variable (where you "store" the value) is simply doing what you are asking it to - the $_GET is set, so update the session variable by +1.

Tada!

The solution to your problem? Don't refresh. :-/

Or, you can play with URL rewrites, but then you are sort of defeating the use of "GET" as a way to keep a "trail" to a location...

There is nothing wrong with your code. Instead of refreshing, get rid of the the ?add=1 in the URL and hit enter.

Keep in mind, if you did this with a "POST" you would get a message telling you that you are "resending" data. It would not in any way solve your problem.

Hope that helps,

Ryan

ryantroop 177 Practically a Master Poster

By the sound of it... you seem to know the answer...

Yes. Use an HTML table.

Use CSS to style it.

If you really want to do something off the wall wonky, you can use DIVs and all the other HTML dohickeys and make it look all pretty....

Maybe ask something a little more specific so we can help a little more?

ryantroop 177 Practically a Master Poster
select 
  e.employee_id --get the ids
from 
  employees e --from employees table aliased as e
where
 ( --begin sub query...
   select 
     count(*) --get the total number of rows
   from 
     employees f --from employees table aliased as f
   where 
     f.employee_id < e.employee_id -- where.. I believe this will return n-1 results where n is the total rows.
 ) < 5; -- where the values of the subquery are less than 5

Essentially, you're asking for all rows, but only give you the first 5. This is, I believe, a terrible query.. if I understand it right, it's hitting the same table 5 or 6 times for something that is much simpler to do as a straight up query... the only reason I can see doing this at all is if you have a TON of users and over time something has messed with the index... but even then you could just do:

 select employee_id from employees limit 0, 5; (in MySQL)
 select top 5 employee_id from employees (in MSSQL)

And quite frankly... if something's wrong with your indexing or ordering, you have bigger issues...

without your data, and being lazy to not build a fake table and trying it, it's difficult to see exactly what it is returning. If you have direct access to the SQL Server, you can always try to see if you can check the execution plan and try to figure it out that way. Lastly, you can always run a sub query yourself …

ryantroop 177 Practically a Master Poster

My take in a nut shell:

There are certain camps in programming -- those who like complete control, and those who don't mind trusting others to do some of the annoying work.

C/C++ --> Meant to be compiled. You are forced to do memory management. It runs very close to the hardware level, which means it doesn't have a whole lot of overhead when executing. In general, web sites wont use it unless it's a web service or custom server that uses C/C++ as a back end (which is what PHP was meant to do).

JAVA/C# --> Memory management done for you. After that, JAVA requires a VM to run, and has a lot of other issues that programmers tend to dislike. It's also not very secure. C# is very closely tied to Microsoft, so some people dislike it for that alone (and .NET). They are used to develop anything from stand alone apps to web tools, though it's not commonly front-facing any longer (JAVA used to be, but I haven't seen it on the web in a while, now...)

Perl --> I don't know much about it other than I don't want to learn it because that means I have to read it. It's old.

PHP --> Dynamic web scripting / software development. In its current state, it can tackle just about everything from socket programming to massive data management. While it can be compiled, it's generally not used in such a manner. It's a server side web programming …

ryantroop 177 Practically a Master Poster

Yes, it's simple if you are only targetting CSS3 compatable browsers, which IE9 is definitely not :-/

Soon, transitions will become common place, but not until windows 7 has gone byebye.. in an age where XP is still extremely common, it may be some time.

If you have this as part of your core functionality, Im afraid many would consider the site unusable if they do not have a compatible browser.

Granted, that's mainly IE users - but that's also likely to be a large portion of your potential user base...

<M/> commented: ;) +8
ryantroop 177 Practically a Master Poster

:-/

assuming you have connected to the database correctly...

$result = mysql_query("select * from table1 where id=$_POST[ID]");
while ($data = mysql_fetch_array($result))
{
    foreach($data as $k=>$v)
        echo ($k . " = " . $v);
}

or.. something to that effect... but since we are all moving to mysqli, this is already horridly outdated.

Check out http://www.php.net/manual/en/mysqli.quickstart.statements.php

To expand...

When you query with php, you are asking for a "result" object (or, to be syntactically correct, a resource). You then need to iterate through the object/array/resource/whatever in order to actually get your data.

ryantroop 177 Practically a Master Poster

There is no single answer for this...

It all depends on what you are doing...

If you are making a web-app that is hosted on the device: use JAVA for android, but you will then need to port over to iOS and C/C#

If you are doing a web-app, performance wise php/asp will probably be around the same, depending on the host. I would argue a slight edge to PHP over ASP. JAVA would, in my experience and opinion, be very slow for this application.

PHP requires that you know security on your own, and know how to interact with other technologies. It is fragile if built fragile, but very very powerful and secure if you know how to keep it that way.

I would assume the same for ASP, I am not too familliar with it other than it is proprietary from MicroSoft (or was... or something?)

JAVA takes a lot of the guess work about keeping things secure "out" but would require a few basic security measures, such as escaping strings for databases, etc...

All in all, the answer comes down to... it depends. What are you most comfortable with? Are there any open source tools written that helps you get a jump start? If so, what language are those in?

ryantroop 177 Practically a Master Poster
-------------------
|     padding     |
|                 |
|                 |
|                 |
-------------------
margin

Padding moves items inside the element away from the border of the element.
Margin moves items away from other items.

ryantroop 177 Practically a Master Poster

not to be a jerk... but...

http://www.w3schools.com/php/php_mysql_intro.asp

you're asking for a web app to be made for you... people get paid for that. If you wish to do it on your own, there are resources to help you.

ryantroop 177 Practically a Master Poster

I think that this is a fundamental misunderstanding of PHP and how it works.

When you "view source" on a web page created with PHP, you won't see any PHP code, but instead you will see the HTML that is rendered from the PHP.

The ONLY way to view PHP code is to have the file on your computer and opening it with a text/code editor of your choice. Yes, this includes notepad or whatever you like.

By the time a PHP page reaches the browser, it has already been "executed" and therefore is no longer viewable.

Does that help?

ryantroop 177 Practically a Master Poster

Javascript is based on ECMAScript, which is then intepreted in a "sandbox" which is controlled by a browser to interpret the script. Javascript exists solely as a client side language, which means it requires a browser to function. This is, of course, ignoring server side javascript, which is (for the sake of this discussion) going to be ignored since it is a special use case, and not typical of the use of javascript on the web.

JAVA is a language that was developed by SUN Microsystems (yeah?). It runs off a "virtual machine", which is on a users machine, and interprets the code into byte-code for the machine it is instaleld on. JAVA comes with a bunch of stuff that makes development "easier" or "faster" if you know how to use them. JAVA can be run on any computer that has JAVA installed (the VM), but it is version dependent.

TL:DR; Javascript is a web language. JAVA is a stand-alone language, which can be integrated with browsers, run as a stand alone application, or run as a unifying programming tool, as long as the system running it has the VM instsalled.

That said, I dont like JAVA. C/C++/Python ftw! :)

Also, wikipedia is your friend.

ryantroop 177 Practically a Master Poster

in php, you would use echo.

<?php

$myVar = "A String";

echo ($myVar);

?>

there are others... it all sort of depends on what you are trying to do.

If you want users to input data and put it on the screen, there are many ways to do that... it all sort of depends on what you want as a finished product, but they all generally follow this scenario..

1) send data with get or post (using a form or ajax call).
2) process the data.
3) spit something out (even if it's the same data that was sent in, or nothing.)

For example...
a php file called "myphp.php"...

<?php

if (isset($_GET['text']))
{
    if ($_GET['text'] != "whatever")
    {
        echo ($_GET['text']);
    }
}

?>

You could use an HTML form to send your data...

<html>
<head><title>test</title></head>
<body>
<form method="GET" action="myphp.php" target="_blank">
<input type="text" name="text" />
<input type="submit" value="Submit" />
</form>
</body>
</html>

Now, that whole "open in a new screen" thing..

since your form is targetting "_blank" it will open in a new window (unless you have an iframe called "_blank"... but then you have different issues).

I think that's what youre asking...

Hope that helps,

Ryan

ryantroop 177 Practically a Master Poster

Great! Mark it solved and happy coding :)

ryantroop 177 Practically a Master Poster

XMLHttpRequest is case sensitive.

line 6 should be:

var AJAX = new XMLHttpRequest();

also, relooking through your code,

you never close your script tag in the body... try this instead:

<head>
<link rel="stylesheet" type="text/css" href="rss.css" media="screen" />
<script language="javascript" src="js/jquery-2.0.1.min.js"></script>
<script language="javascript">
function loadPageContents() {
  var AJAX = new XMLHttpRequest();
  AJAX.open('GET','rss2.php',true);
  AJAX.onreadystatechange = function() {
    if(this.readyState==4 && this.responseText) {
      document.getElementById('RSS_Feed').innerHTML = this.responseText;
      setTimeout(loadPageContents, 5000);
    }
  }
  AJAX.send(null);
}

function body_load()
{
  setTimeout(loadPageContents, 5000);
}

}

</script>
</head>
<body style="margin: 0px;" onload="body_load();">
<div id="RSS_Feed">
</div>
</body>
ryantroop 177 Practically a Master Poster

note... you may need to tweak that code a bit... Im pretty sure that if you don't have a document body at run time, that will error out... so you can either put that code all the way at the bottom of the page, or just make sure the body is available to attach a handler.

ryantroop 177 Practically a Master Poster

Im not very familliar with mootools, so I will explain what I would do in JS and hopefully you can translate it.

an IFrame doesn't have to be visible to load data, and an IFrame has a .onload trigger. So... you can have the default inline style of the iframe to visibility:hidden; (note, not display:none;), and use the iframe's onload to run a function that simply flips the switch (i.e., iframe.style.visibility = ""; )

Without knowing the full order of loading, it's a bit difficult to tell you how to do it... it may be that on your parent page you need a function that does the visibility="" for you, and you have to put the onload on the body of the iframe content using something like...

function doShow()
{
  if (parent.showFunction) { parent.showFunction(); }; 
}

document.body.onload = doShow();

or if you want to be fully compliant you can add the event handler in your flavor of choice...

Hope that helps..

Ryan

ryantroop 177 Practically a Master Poster

depending on your back end... this seems like it's more of a database/sort issue... but if really all you need to do is append +whatever to the url...

function submit()
{
    var mySelectBox = document.getElementById("mySelectBox");
    var myWord = mySelectBox.options[mySelectBox.selectedIndex].text;

    var URL = document.URL;
    if (URL.lastIndexOf("/") != URL.length)  /* this assumes URL ends with "/" */
        URL += "+";

    URL += String(myWord); //cast for sanity


    window.location = URL;  //if this doesn't work try window.location.href = URL (or use both for sanity).
}

so on your "submit" button, your onclick="submit();" alternatively, if you are submitting a form you can do onsubmit="submit();" on the form... so many ways to cook chicken...

if your URL does not end with "/" you can do any number of string surgery operations to figure out if you need to pre-append a "+". For example, you can use URL.lastIndexOf(".com") != URL.length - 4

This is really not the best way to do this, but if it is what's required for your system then it's what you need.

ryantroop 177 Practically a Master Poster

So, the exercise is meant to get you to problem solve. Think about HOW you would go about doing this. What is the process?

What is the minimum number of columns you must have? Obviously it can't be 1 or 2. This about what it would look like to make an X with 3 columns. How tall can you make that? At what point would you add a middle column * to make it an X?

You also need to consider how a prompt will print out data.

As you type, you see letters go from left to right (unless you are using a right to left language. Either way, you can just reverse the process for right to left..)

At the end of each line, you get a newline break. You have now found a repeated process for your for loop.

For each line, you are going to figure out how wide your X will be (or, you will have that as a parameter passed in).

Based on the width of your X, you will need to go back to your original consideration of colums. What will your X be if you had 4 columns? What makes it different? How do you set that difference? Is there a pattern you can exploit?

Something else that will help (which is where the concept of test driven development comes) is to see the results you CAN have, and code to make those... so, I will give you a few ideas for …

ryantroop 177 Practically a Master Poster

this link, and the associated links within, will probably get you off in the right direction.

http://www.w3.org/2010/05/video/mediaevents.html

Ryan

ryantroop 177 Practically a Master Poster

I am not a JAVA developer, but I was asked to post a few simple project ideas taht are a bit cross categorical...

Some ideas I came up with were:

1) A program that searches images (jpegs or otherwise), and categorizes them by either name, pixel count, or even common pixel colors (such as, more than 2000 red pixels, or blue pixels, etc.. based on RGB).

2) A program that creates a MIDI or WAV file that makes tones based on random information, or a set structure of information (such as a name, with each letter corresponding to a frequency)

3) A more in depth program would be for people who like to categorize - my example was a bird watching program, that pulled up a picture of the bird searched, and displayed info about that bird, and possibly linked to similar bird types/families.

4) Java and Android are buddies - why not make an app? Something simple like an app to get your location, and the 3 closest friends from your contacts list.

5) Something as simple as getting OS/Platform(hardware) info and displaying it nicely, and creating a way to traverse files to practice mastery of file structures.

Regardless of what the project is, it doesn't have to be useful - the idea is to see if you can do it. If not, find out why you can't, and learn from the experience! Find something that interests you, and pursue it!

Ryan

JamesCherrill commented: Constructive input, thank you +14
ryantroop 177 Practically a Master Poster

Ahh I misread.

There may be something in another part of you script that states any of the following:

$_SESSION['username'] = '';

if($_SESSION['username'] = ''){}; //notice the missing ==, in this case it will set the variable instead of checking to see if something is there

Im sorry. When I read the initial post, I read it that all of your session variables were being lost.

I still encourage you to exit after a redirect, and doing the redirect after all session variables are in place.

ryantroop 177 Practically a Master Poster

There are also ways to obfuscate the salt, by storing it outside the html/ftp root, and telling php where to look with includes. On top of that, the salt could be appended to the front or back of the password, making it a bit harder to rainbow hack the passwords, even if the salt is known.

Lastly, the way you salt the passwords, and how you salt/hash them is important. It's probably not enough to salt/hash the password once or twice. 10 times, using the right algorithm including the salt in each pass would be sufficient to piss off most hackers.

iamthwee commented: Nice +14
ryantroop 177 Practically a Master Poster

Best way to learn any programming language - find something you are interested in, see what you can do to become involved.

Like photography? Make a program that sorts images by name or, for more fun, common pixel hot spots (like, pictures that have over 2000 pixels that are red or blue, etc...).

Audio or music? Make a script that makes tones out of random information.

Bird watching? Make an applet that displays info based on the bird type, and displays audio/video/images of that type.

You can do whatever you want with any program language. Get involved with something you like, silly or useless, and just see if you can do it. If not, start asking questions about why you failed or what you missed, and you will learn a TON through dialogue. It doesn't have to be overly useful to anyone but yourself.

Stop worrying about the content, and instead work on the concept. Do it to see if it can be done, and push the envelope. Start small, and build. Ask questions. Wash, rinse, repeat.

ryantroop 177 Practically a Master Poster

so by your calling me a "dumb monkey" you went from having someone willing to help, to another person who will just ignore you.

You are what makes the internet rot. I for one will be happy to see you fail.

happygeek commented: well said +11
ryantroop 177 Practically a Master Poster

get rid of the ' ' around $checkUsername

There should only be 1 result if the user/pass combo exists. No one will have the same username, right? So change line 20 to:

if($Username_exists == 1) {
 header("Location: indexma.php");
 exit();//all header redirects need to kill the script or it will continue to run even after a redirect
}
else {
 //echo will not ever be seen, and it should in fact raise an error if something is output before a header change
 header("Location: register.php");
 exit();//same dealy here
}

EDIT: The above is very possible, as well. But I would encourage my changes as well.

ryantroop 177 Practically a Master Poster

If you're going to be salting the password, salt it using a stored global in .htaccess
http://www.besthostratings.com/articles/php-variables-htaccess.html

Or from an include that is stored above http access.

This makes a private salt that can only be accesed with root FTP access.

On top of that, your added "pepper" should be unique for each user, and stored in the database with the login info.

md5 is "useless", sha1 is better, sha256 is there, you might as well use it. (heck, there is even better....)

The real way to totally hash out a password is to do it multiple times, using the new hash created + salt + pepper each time... so, lets say I make my private "salt" as a gloabl var $_SALT

function enc($usr, $pw) {   //take in username and password
 $pass = hash("sha256", $pw.$_SALT);    //make initial hash, using our "secret" salt
 $pepper = hash("sha1", $usr);  //make a "pepper" based on the username (or email)
 for(i=0;i=10;i++){
  $pass = hash("sha256", $pass.$_SALT.$pepper); //10 times, we will hash the string with our current pass value, salt, and pepper.
 }

 return $pass.' '.$pepper;  //our function will return a 64 character hashed password, a blank space, and a 40 character hashed public "pepper"
}

From there, we can explode our two values:

$password_object = enc($username, $password);
list($pw_to_store, $pepper_to_store) = explode(" ", $password_object);

You will now have $pw_to_store containing our 64 character hashed password, $pepper_to_store containing our 40 character hashed "pepper", and our salt remains a "secret" only to us.

It …

broj1 commented: Nice post, I hope it will fire more discussion +4
ryantroop 177 Practically a Master Poster

I would recommend you turn off all your error suppressions (@) and see if you raise any errors...

Line 1 is missing a closing ;

While I can't say it's improper, I have never seen a while loop in PHP using

while($mycontingency):
...
endwhile;

I would encourage you to use

while($mycontingency) {
...
}

EDIT: I just looked on the PHP Manual and while($foo): is totally acceptable, just not very PHP-ish as few statements follow this design. You can happily ignore the above.

line 21 you are basically saying suppress all errors but if there is an error print the error but supress the error. Not sure you are using error suppression correctly...

As to your problem...

I have had problems where queries do not run properly if they are not closed with a semi-colon.

So, try changing it to
mysql_query("DELETE FROM training_tickets WHERE transaction='$transaction' LIMIT 1;") or die ("Could not delete: ".mysql_error());

Lastly, for the sake of "true" RBDM, you should never delete any items from your database. Instead, you should add another column called "deleted" and make it a datetime, and when you run your selects you should check that datetime <= 0, and when you want to delete the item you should set datetime to "now()"

ryantroop 177 Practically a Master Poster

ok.. so if Im following along with you right ->
You're pulling stock numbers from a database.
Those stock numbers are individually posted on your page for ordering purposes.

If that is correct, you have two options.

Do the math in the database
"SELECT col1, col2, (SELECT SUM(col1, col2)) as total FROM mytable WHERE boxcolor='whatever';"

Do the math after the database

while($data = mysql_fetch_object($result)) {
$total = $data->col1 + $data->col2;

}

Is that what you're looking for?

Ryan

logicaweb commented: I right now wanted to write something like this, but you're faster! +0
ryantroop 177 Practically a Master Poster

The first paragraph here will help get you started:
http://docs.python.org/py3k/library/turtle.html

This will help understand triangles:
http://www.freemathhelp.com/feliz-angles-triangle.html

The key part is understanding that all triangles will have a total of 180* as the sum of all angles. That means, given your 3 inputs, if they don't add up to 180* then it's not a triangle.

You have a lot of choices on how to start. A better way for us to help you is to start writing some code, and when you have trouble or get stuck, then ask. Homework is meant for you to learn, not for people on a message board to do it for you.

ryantroop 177 Practically a Master Poster
if(isset($_POST['key']{
$key = $_POST['key'];
$sql = "SELECT * FROM user WHEN name LIKE '{%$key%}'";
....

you probably dont even need the {} and you may want to escape $key before you pop it in your query.