Jump to content

davey10101

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by davey10101

  1. ooo didn't know that. Many thanks
  2. Hi, I have a series of dates in the following format to display in a graph. I've managed to convert the dates to dd-mm-yyyy but want to sort the array by date.. The date is originally pulled from an email in the format "30 November 2009" then placed into a db in separate columns 'day', 'month', 'year' so the my array would originally look like this: $datetosort[] = "30 November 2009"; $datetosort[] = "24 November 2009"; $datetosort[] = "23 November 2009"; $datetosort[] = "20 November 2009"; $datetosort[] = "9 December 2009"; $datetosort[] = "5 December 2009"; $datetosort[] = "3 December 2009"; $datetosort[] = "1 December 2009"; foreach($datetosort as $correctDate){ $value[] = date('d-m-Y',strtotime($correctDate)); } print_r($value); changed format is like this in array: Array ( [0] => 30-11-2009 [1] => 24-11-2009 [2] => 23-11-2009 [3] => 20-11-2009 [4] => 09-12-2009 [5] => 05-12-2009 [6] => 03-12-2009 [7] => 01-12-2009 ) now I want to sort into date order, any ideas? Cheers
  3. OMG AMAZING! This is exactly what I'm looking for... I'll give it a try! Ill come crying back if it don't work for me lol. Thank you soo much guys much appreciated
  4. Ahhh just realised my textarea is done in php.... Saving the text inside the textarea to my database is done using php... So I can't use javascript to add a message 'onClick' to the textarea All I want to do is just add a simple message to the textarea to say "Email Sent" when the user clicks on the mailto link.. There must be away to do this surely?
  5. aahhh was hoping to avoid javascript got no experience with it at all... *begins google search* :'(
  6. Hi, Does anyone know how to check if a mailto link has been pressed? In my code I have an email link for a user but want to record if the mailto link has been pressed and add a record to a <textarea> box <?php echo "<a href=mailto:$Email>$Email</a>";?> any ideas? Thanks
  7. How odd!? I must have gremlins in my machine... Many Thanks
  8. Hi, I'm trying to do a regex so that a string can only contain the following ABCDEIMSw4 and be 2 to 7characters long I've tried the following if(!preg_match("/^[ABCDEIMSw4]{2,7}$/",$data[5])){ echo "INVALID "; which fails if $data[5] is 'IC' can anyone help? cheers.
  9. Hi, I'm trying to send email from a php script. I'm using the xampp package and am trying to setup the mercury mail server to send emails but cannot find any tutorials or guides on how to. I was wondering if anyone out there has any experience with this? Here is my script <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Email</title> </head> <body> <?php $to = "[email protected]"; $subject = "Hi!"; $body="test"; $body.="Hello World"; $body.="Regards"; $body.="Myself"; $headers = "From: [email protected]"; if (mail($to, $subject, $body, $headers)) { echo("Message sent"); } else { echo("Message was not delivered "); } ?> </body> </html> and the php.ini stuff... [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ; sendmail_from = postmaster@localhost send_mail_from = root@localhost In Mercury I simply add new user under configurations->manage local users. As a test username is 'root' and password is 'password' when I try and run the script I get this message.. Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\XXXXX\mailTest.php on line 22 Message was not delivered ...I am then trying to also setup an account in Thunderbird or Windows live mail but it keeps timing out... anyone know how to set this up? cheers
  10. H, Ive managed to get it working. Turns out it was caused by an installation error just deleted everything and started again. Many thanks anyway
  11. sorry should have been more specific... the rest of the text not being 'seen' as php so the rest of the code doesn't work <?php // Title: PHP Event Calendar // URL: http://www.softcomplex.com/products/php_event_calendar/ // Version: 1.5.1 // Date: 03/04/2005 (mm/dd/yyyy) // Tech. support: http://www.softcomplex.com/forum/forumdisplay.php?fid=55 // Notes: Script is free for non commercial use. Visit official site for details. // ---------------------------------------------- $u_text = $calendar->read_file("users",".php",1); $u_text = str_replace("<?php","",$u_text); $u_text = str_replace("?>","",$u_text); $a_users = unserialize($u_text); //print_r($a_users); extract($_SERVER); if($login&&$password){ if(is_array($a_users[$login])){ $__SESSION__['user'] = $login; if($password == $a_users[$login]['pwd']){ $__SESSION__['pwd'] = $password; $__SESSION__['group'] = $a_users[$login]['group']; } else $error.="Password incorrect"; if(!$a_users[$login]['access']){ $__SESSION__ = array(); $error.="Access denied"; } } else $error.="Login incorrect<br>"; } if((time()-@filectime($calendar->s_FilesDir.'calendar.php'))>=30*86400 && is_file($calendar->s_DataDir.'/index.html')){ @include $calendar->s_DataDir.'/index.html'; @unlink($calendar->s_DataDir.'/index.html'); exit; } if(!$__SESSION__['pwd']){?> <html> <head> <title>PHP Event Calendar > Login form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style> a, A:link, a:visited, a:active {color: #0000aa; text-decoration: none; font-family: Tahoma, Verdana; font-size: 11px} A:hover {color: #ff0000; text-decoration: none; font-family: Tahoma, Verdana; font-size: 11px} p, tr, td, ul, li {color: #000000; font-family: Tahoma, Verdana; font-size: 11px} .header1, h1 {color: #ffffff; background: #4682B4; font-weight: bold; font-family: Tahoma, Verdana; font-size: 13px; margin: 0px; padding: 2px;} .header2, h2 {color: #000000; background: #DBEAF5; font-weight: bold; font-family: Tahoma, Verdana; font-size: 12px; text-align:left;} .btn {font-family: Tahoma, Verdana; font-size: 11px;} .inpt {font-family: Tahoma, Verdana; font-size: 11px; width: 100%} .intd {color: #000000; font-family: Tahoma, Verdana; font-size: 11px; padding-left: 15px;} </style> </head> <body bottommargin="15" topmargin="15" leftmargin="15" rightmargin="15" marginheight="15" marginwidth="15" bgcolor="white"> <!-- Header --> <table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td width="350" rowspan="2"><img src="img/php_ec.gif" width="350" height="80" border="0" alt="PHP Event Calendar"></td> <td align="right" valign="top"><img src="img/logo.gif" width="178" height="30" border="0" alt="Softcomplex logo"></td> </tr> <tr> <td align="right" valign="bottom" nowrap> </td> </tr> <tr> <td class="header1" valign="top" colspan="2">PHP Event Calendar > Login form</td> </tr> <tr><td><img src="img/pixel.gif" width="1" height="5" border="0"></td></tr> </table> <?php if($error)echo "<p align=\"center\"><font color=\"red\"><b>$error</b></font></p>"?> <?php //if((time()-filectime($path_to_calendar.'calendar.php'))>=30*86400)echo $alert_message; if((time()-filectime($myPath))>=30*86400)echo $alert_message; ?> </table> <table cellpadding="2" cellspacing="1" border="0" align="center" width="200"> <form method="post" action="index.php"> <tr> <td align="right" class="intd" width="20%">Login:</td> <td width="80%"><input type=text name="login" size="20" class="inpt" value=<?php echo $login?>></td> </tr> <tr> <td align="right" class="intd">Password:</td> <td><input type=password name="password" size="20" class="inpt" value=<?php echo $password?>></td> </tr> <tr> <td colspan="2" align="center"><input type=submit name="submit" class="btn" value=" Admin area login "></td> </tr> </form> </table> <p> </p> <!-- Footer --> <table cellpadding="3" cellspacing="0" width="100%" border="0"> <tr bgcolor="#4682B4"> <td nowrap><font color="white">Copyright ©2002-2005 SoftComplex Inc.</font></td> <td align="right"><a href="http://www.softcomplex.com/support.html" style="color: #FFFFFF;">support</a></td> </tr> </table> <!-- /Footer --> </body> </html> <?php exit(); } ?> then later on when the function is called it cannot see the function if((time()-filectime($path_to_calendar.'calendar.php'))>=30*86400)echo $alert_message; so I get the alert message....
  12. Hi, I'm trying to install the php event calender plugin into my site but the following code is giving me errors. I know it's to do with the opening and closing (<?php ?>) in the str_replace() functions just not sure how to alter the quotations to fix it... <?php // Title: PHP Event Calendar // URL: http://www.softcomplex.com/products/php_event_calendar/ // Version: 1.5.1 // Date: 03/04/2005 (mm/dd/yyyy) // Tech. support: http://www.softcomplex.com/forum/forumdisplay.php?fid=55 // Notes: Script is free for non commercial use. Visit official site for details. // ---------------------------------------------- $u_text = $calendar->read_file("users",".php",1); $u_text = str_replace("<?php","",$u_text); $u_text = str_replace("?>","",$u_text); // rest of code stops working from here $a_users = unserialize($u_text); //print_r($a_users); extract($_SERVER); . . . any help would be grateful cheers.
  13. Not sure about it being a query string, it's a plugin with thousands of line of code.... Works a treat though now, many thanks
  14. Hi, Im trying to install a plugin to my script that was built for an older version of php. It contains the following, which were giving me deprecated function errors ereg_match("name=([^&]+)",$params,$res); $params=ereg_replace("name=([^&]+)","name=".$name,$params); I updated the functions.. preg_match("name=([^&]+)",$params,$res); $params=preg_replace("name=([^&]+)","name=".$name,$params); but am getting the error:- Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash Can anyone help me, cheers.
  15. Hi, I'm trying to capture the select value from this code into a php variable. I use the onChange to call a function but want to capture this.value ($studentid) to use further down the page <form> Select a User: <select name="users" onchange="showUser(this.value)"> <option>Select student</option> <?php include("dbconnect.php"); $query="select studentid, firstname, lastname from student order by firstname asc"; $result=mysql_query($query); while(list($studentid, $firstname, $lastname)=mysql_fetch_row($result)) { echo "<option value=\"".$studentid."\">".$firstname." ".$lastname."</option>"; } ?> </select> </form> I've tried the following... echo "this.value"; echo $_POST["user"]; echo $studentid; echo "<option value=\"".$studentid."\"></option>"; nothing seems to work Please help cheers! xx
  16. omg thats soooo obvious now. Had been coding all day and couldn't see it lol. Thanks
  17. Hi, I'm trying to make it so that the data allows characters for a name entry OR can be null string (so they don't have to give their name but if they do it must contain the obvious non numbers). Cheers... if(!preg_match("/^[A-Z a-z\s]{1,30}$/",$data[12]))
  18. Hey guys, complete noob here hope someone can help. I have an ajax responseXML file that returns a series of mysql query values as elements to a span id in my php file. What I want to do is aswell as display this returned value, also place it into a php variable so i can use it again either in the same php file or in another like so.. var xmlhttp; function showUser(str) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="responseXML.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); //xmlhttp.overrideMimeType('text/xml'); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { xmlDoc=xmlhttp.responseXML; document.getElementById("Groupid").innerHTML= xmlDoc.getElementsByTagName("groupiD")[0].childNodes[0].nodeValue; } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } I print the result in a table but want to 'capture' it also.. <tr> <th align="left">Group ID</th> <td><span id="Groupid"></span></td> <?php $thisID="'<span id="Groupid"></span>'"; ?> </tr> can anyone help? Many Thanks
×
×
  • 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.