-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] AJAX populating form fields from Select Drop Down
MadTechie replied to ncosgrove's topic in Javascript Help
I just ran a test, it seams you reverted back already, so i can't say for sure why it failed, but i did messup a line (see update) function stateChanged() { if (xmlhttp.readyState==4) { var mySplitResult = xmlhttp.responseText.split("|"); //updated document.getElementById("product_description2").value=mySplitResult[0]; document.getElementById("id_product2").value=mySplitResult[1]; } } -
your probably need to update that code.. that one section of code, once the code below "logincheck.php" i can't find on the site and it redirects you to login.php (that i can't find).. I'm starting to wonder if its a session problem at all, yes your using deprecated code and you say thats the problem but i'm not so sure!
-
[SOLVED] AJAX populating form fields from Select Drop Down
MadTechie replied to ncosgrove's topic in Javascript Help
this is down to the function stateChanged i pulled this from your example site function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("product_description2").value=xmlhttp.responseText; } } What you "could do" is the following function stateChanged() { if (xmlhttp.readyState==4) { var mySplitResult = responseText.split("|"); document.getElementById("product_description2").value=mySplitResult[0]; document.getElementById("id_product2").value=mySplitResult[1]; } } and in the PHP update while($row = mysql_fetch_array($result)) { echo $row['description']; } to while($row = mysql_fetch_array($result)) { echo $row['description']; echo "|"; echo $row['id']; } -
http://snaps.php.net/win32/PECL_5_0/php_ssh2.dll don't forget its dependency OpenSSL http://www.libssh2.org/
-
Your code should be like this $query = mysql_query("SELECT u.username FROM ".TBL_USERS." u INNER JOIN ".TBL_ACTIVE_USERS." a ON a.username=u.username WHERE a.timestamp < (NOW() - INTERVAL 5 MINUTE) AND u.username= '$b->username'")or die(mysql_error()); if (mysql_num_rows($query) > 0) { $status = "<font color=\"#04db04\">Online</font><br />"; }else{ $status = "<font color=\"#FF0000\">Offline<br /></font>"; } echo" <tr> <td><img src='include/avatar/" . $value[$x]['username'] . "/" . $value[$x]['avatar'] . "' width='80' height='80' /></td> <td>" . $value[$x]['username'] . "</td> <td>" . $value[$x]['email'] . "</td> <td>" . $value[$x]['sex'] . "</td> <td>" . $value[$x]['month'] . " " . $value[$x]['day'] . ", " . $value[$x]['year'] . "</td> <td>" . $value[$x]['signupdate'] . "</td> <td>" . $status . "</td></tr>";
-
Okay so sessions work fine, but not in your script (which i have just noted you have posted some code), your sessions are using an old DEPRECATED style try this <?php session_start(); if(!isset($_SESSION['loginid']) { $_SESSION['loginmsg'] ="Please Login to view Members Area"; header("Location: login.php "); exit; } ?>
-
<td>" . $status = "<font color=\"#04db04\">Online</font><br /> to <td>" . $status = "<font color=\"#04db04\">Online</font><br />";
-
What part you stuck on ?
-
Kinda need some more info, Try a simple script like this and see if it works <?php session_start(); if(!empty($_SESSION['counter'])) { $_SESSION['counter']++; }else{ $_SESSION['counter']=1; } echo $_SESSION['counter']; ?>
-
If you wish to remove the MD5 (NOT recommened) then your need to remove it from ALL points where its used ie Signup & Login but your also need to reset ALL current passwords MasterACE14 code is valid and will work here a slightly more complete code (untested) <?php $user = "Bob"; $newpass = "hello"; $Q = sprintf("SELECT ID,email FROM members WHERE name='%s' LIMIT 1", mysql_real_escape_string($user)); $result= mysql_query($Q) or die($Q.mysql_error()); $row = mysql_fetch_array($result); mail($row['email'], 'password change', "Your new password ".$newpass); // mail it to them $newpass = md5($newpass); $Q = sprintf("UPDATE members SET password='%s' WHERE = id = %d",$newpass,$row['id']); mysql_query($Q) or die($Q.mysql_error()); // update pass in database to new one ?>
-
your need to change the password, then send them the new one.. thats the whole point of ONE WAY encryption
-
ok this removes embed and script //simple $content = preg_replace('%<(script|embed)[^>]*>(.*?)</\1>%s', '\2', $content ); //try this $remove = array('script','embed'); $remove = implode("|", $remove); $content = preg_replace('%<('.$remove.')[^>]*>(.*?)</\1>%s', '\2', $content );
-
lol i do it the other way if (filesize($file) < (750*1024)){
-
use htmlspecialchars ie $content = htmlspecialchars($content, ENT_QUOTES); or even try this $content = 'my <b>message</b><script>alert("test")</script> <embed>source</embed>'; $content = preg_replace('%<([^>]*)>(.*?)</\1>%sim', '\2', $content); $content = htmlspecialchars($content, ENT_QUOTES); echo $content;
-
Humm, are sockets installed and working ? check phpinfo(); for
-
I assume you want to remove the script, try this (remove) $content = preg_replace('%<script.*?>.*?</script>%sim', '', $content ); keep the script but kill the tags $content = preg_replace('%<script.*?>(.*?)</script>%s', '\1', $content );
-
where cities.name='$row[location]' should be where cities.name IN ($row[location]) BUT $row[location] would need to be either 'cityname' or 'city1','city2','city3','city4','city5' IF $row[location] is either cityname or city1,city2,city3,city4,city5 you could use $row['location'] = "'".str_replace(",","','",$row['location'])."'"; to make it fix (this probably isn't the best route but with the data supplied it should work
-
you don't use a size in the filesize() function, it returns a size, which is in bytes so 512000 = 500k
-
Building recordsets & queries local or remote w/ dw cs4
MadTechie replied to artworthy's topic in PHP Coding Help
install WAMP or XAMP, re-create your server on your localhost (export/import), as for DW CS4 (i also have it but only for playing with designs, personally i don't use it for PHP (but i'll admit i did start out with it) -
whats wrong with it as it stands ? if you need the array then your need it, but is it needed on everypage ?
-
Heres a basic example <?php require_once('../class.phpmailer.php'); require_once('../class.pop3.php'); // required for POP before SMTP $pop = new POP3(); $pop->Authorise('pop3.yourdomain.com', 110, 30, 'username', 'password', 1); $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch $mail->IsSMTP(); try { $mail->SMTPDebug = 2; $mail->Host = 'pop3.yourdomain.com'; $mail->AddReplyTo('name@yourdomain.com', 'First Last'); $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); $mail->SetFrom('name@yourdomain.com', 'First Last'); $mail->AddReplyTo('name@yourdomain.com', 'First Last'); $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically $mail->MsgHTML(file_get_contents('contents.html')); $mail->AddAttachment('images/phpmailer.gif'); // attachment $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment $mail->Send(); echo "Message Sent OK\n"; } catch (phpmailerException $e) { echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e->getMessage(); //Boring error messages from anything else! } ?> But your need to get the data from the database and rebuild the example or update phpmailer to allow raw data files
-
if(is_numeric($Num)) $List[$Num]=substr($DataItem,$FirstPound+1); to if(is_numeric($Num)) $List[$Num]=str_replace('^7777777','',substr($DataItem,$FirstPound+1));
-
Your need to add the fields to the table first Find the code that inserts into the online_users table and post that here
-
Your need to add UserName or UserID, then insert the UserName on logon
-
kinda need to know whats in the 'online_users' table, if you have usernames then a simple loop would work ie $sql3="SELECT * FROM $tbl_name"; $result3=mysql_query($sql3); //start add $users = array(); while($rows = mysql_fetch_array($result3)) { $users[] = $rows['user']; } var_dump($users); //output //end add $count_user_online=mysql_num_rows($result3);