trq
-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Posts posted by trq
-
-
You need to assign it within the construct. (I assume your using php4)
[code]
include 'class.c.inc';
class A
{
var $b;
function A() {
$this->b = new C();
}
.
.
.
}
[/code] -
Php runs on the server so cannot mix with java[b]script[/b] (client-side) as you have descibed. You will need to have the javascript code request your php script from the server, or maybe look into using ajax.
-
Not unless you tell us what you meen by [i]isn't working[/i].
Are you getting any errors? What are they? -
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Is the $argv an associative array as well?[/quote]
No. -
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]no luk is it anythig to do with md5?[/quote]
Could be a number of things. You might need to manually view the differences and see.
[code]
<?php
$pass = md5("PUTYOURPASSHERE");
$user = "PUTUSERNAMEHERE";
$result = mysql_query("SELECT `password` FROM band WHERE `username` = '$user'";
if ($result) {
$row = mysql_fetech_assoc($result);
echo "password from db = {$row['password']}</ br>";
echo "md5'd password given = $pass</br >";
}
?>
[/code] -
You probably shouldn't let a user know which of there username or password failed, this can open up security holes. Without it, we can also get this all done in one query and therefore less work on the database.
[code]
<?php
session_start();
include 'db.php';
if (!empty($POST['username']) && !empty($_POST['userpass'])) {
$user = trim($_POST['username']);
$pass = md5(trim($_POST['password']));
} else {
$error = "Invalid Username or Password combo!";
include 'login.html';exit();
}
$sql = "SELECT * FROM band WHERE username = '$user' AND `password` = '$pass'";
$result = mysql_query($sql) or die(mysql_error());
if ($result) {
$user = mysql_fetch_assoc($result);
$_SESSION['userid'] = $user['id'];
$_SESSION['username'] = $user['username'];
$_SESSION['email']= $user['email'];
$_SESSION['prov'] = $user['prov'];
$_SESSION['name'] = $user['name'];
$_SESSION['style'] = $user['style'];
$_SESSION['hist'] = $user['hist'];
$_SESSION['infl'] = $user['infl'];
$_SESSION['open'] = $user['open'];
$_SESSION['photo'] = $user['photo'];
$_SESSION['webs'] = $user['webs'];
} else {
$error = "Invalid Username or Password combo!";
include 'login.html';exit();
}
?>
[/code]
Also... do you really need all that stuff in a session? -
[code]
<?php
ob_start();
var_dump($_POST);
$var = ob_get_contents();
ob_end_clean();
?>
[/code]
The output of var_dump($_POST) is now in $var. -
Any output. eg, call to echo, html, whitespace will send headers. Check you have no white spce before your opening <?php tags.
-
Look up the $_SERVER array. In particular $_SERVER['PHP_SELF'].
-
Did you read the sticky thread at the top of this forum?
-
Well really, the only thing wrong with your code is there is no error checking. Try...
[code]
$sql = "SELECT * FROM band WHERE username='$user'";
if ($result = mysql_query($sql)) {
$user = mysql_fetch_assoc($result);
if (md5($pass) != $user['password']) {
$error = "Invalid password. Try again.";
} else {
echo "success";
}
} else {
echo mysql_error();
}
[/code] -
Where do you define $pass ?
-
What does doesn't work meen? Please describe your problem.
-
Not in php. Ruby can do this...
[code]
a,b = 1,2
[/code]
Cool huh? But yeah... not php. -
Explicitly name the fields your inserting into and this problem should become clear, or go away. eg..
[code]
INSERT INTO tbl (fld1,fld2,fl3) VALUES ('$v1','$v2','$v3');
[/code]
Is the field your trying to insert $studentid into and auto increment field? -
Php and Perl both run on the server not the client.
-
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]and returninig errors.[/quote]
What errors? -
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]How do you hack the template?[/quote]
Surely its covered in the manual? -
[a href=\"http://www.phpclasses.org/browse/package/951.html\" target=\"_blank\"]A bbcode class[/a].
-
Most likely your query isn't stisfied. Maybe something like this would be more effective.
[code]
mysql_query("
SELECT * FROM $usertable
WHERE ($metode = '%$search%' OR '%$search2%')
OR ($metode2 = '%$search%' OR '%$search2%')
");
[/code] -
Maybe...?
[code]
$i = 0;
while ($my_token) {
$tmp[$i] = $my_token;
if ($my_token == 'string') {
$previous = $tmp[$i-1];
}
$i++;
}
[/code]
A bit messy but hey... -
To be honest, I dont think you could justify the switch. If they already have time invested in there current environment, php really has nothing more to offer over .NET. (ps ASP.NET is either developed in C# or VB.NET)
If the reason for your argument is simply to win a developement contract, then im sorry to say, but I really believe youv'e an uphill battle on your hands.
The only real benifit I could see is the openess of php and the systems it will run on. If these guys are even remotely interested in open source technoligies, this may be your best angle. Be warned though... alot of bigger companies are still very scared of committing to open source, and this approuch may also do more harm than good.
Just my 2 cents. -
I would think that most authentication systems use sessions, but really, there isn't a great deal of difference. As long as your checking the values in the cookie against a database or some other data store on the server.
-
Have you tried reading the [a href=\"http://dev.mysql.com/doc/refman/5.0/en/adding-users.html?ff=nopfpls\" target=\"_blank\"]manual[/a]?
What's the "@" operator?
in PHP Coding Help
Posted