PHP - Need To Change My Code , But Dont Know Where To Start !
ok , i made a friends thing and its to hard to work with so i need to change it to where it has it own table ... i had it in an array in a table with other things , and now its hard to get it from the array so i want to make it simpler ... so here is my code and what i want to do , i need help and thank you in advance
here is my part 1 of my adding people as friends. Code: [Select] <?php if ($_POST["request"] == "requestFriendship") { $mem1 = preg_replace('#[^0-9]#i', '', $_POST['mem1']); $mem2 = preg_replace('#[^0-9]#i', '', $_POST['mem2']); // if (!$mem1 || !$mem2 || !$thisWipit) { echo 'Error: Missing data'; exit(); } // if ($mem1 == $mem2) { echo 'Error: You cannot add yourself as a friend'; exit(); } $sql_frnd_arry_mem1 = mysql_query("SELECT friend_array FROM myMembers WHERE id='$mem1' LIMIT 1"); while($row=mysql_fetch_array($sql_frnd_arry_mem1)) { $frnd_arry_mem1 = $row["friend_array"]; } $frndArryMem1 = explode(",", $frnd_arry_mem1); if (in_array($mem2, $frndArryMem1)) { echo 'This member is already your Friend'; exit(); } $sql = mysql_query("SELECT id FROM friends_requests WHERE mem1='$mem1' AND mem2='$mem2' Limit 1"); $numRows = mysql_num_rows($sql); if ($numRows > 0) { echo '<img src="images/round_error.png" width="20" height="20" alt="Error" /> You have a Friend request pending for this member. Please be patient.'; exit(); } $sql = mysql_query("SELECT id FROM friends_requests WHERE mem1='$mem2' AND mem2='$mem1' Limit 1"); $numRows = mysql_num_rows($sql); if ($numRows > 0) { echo '<img src="images/round_error.png" width="20" height="20" alt="Error" /> This user has requested you as a Friend already! Check your Requests on your profile.'; exit(); } $sql = mysql_query("INSERT INTO friends_requests (mem1, mem2, timedate) VALUES('$mem1','$mem2',now())") or die (mysql_error("Friend Request Insertion Error")); //$sql = mysql_query("INSERT INTO pms (to, from, time, sub, msg) VALUES('$mem2','XXXXX',now(),'New Friend Request','You have a new Friend Request waiting for approval.<br /><br />Navigate to your profile and check your friend requests. <br /><br />Thank you.')") or die (mysql_error("Friend Request PM Insertion Error")); //$id = mysql_insert_id(); echo '<img src="images/round_success.png" width="20" height="20" alt="Success" /> Friend request sent successfully. This member must approve the request.'; exit(); } ?>Now i need to change my code to where it inserts all this info and stuff not as an array and , in another table which is called "friends" my table is set up like this Code: [Select] -- Table structure for table `friends` CREATE TABLE IF NOT EXISTS `friends` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mem_1` int(11) NOT NULL, `mem_2` int(11) NOT NULL, `date` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; So please if im not clear enough i will post more details Similar TutorialsHi everyone (sorry for my bad english),
I have several pages on my site using the exact same code at the very top, which works fine except for one page: <?php include_once("../members/dbinfo.php"); The top of dbinfo looks like this: <?php session_start(); And then the connection strings for the database However it is giving me this error on this one page: Quote Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\WebSites\premierathome_com\products\FrenchTalkingDictionary.php:1) in C:\Inetpub\WebSites\premierathome_com\members\dbinfo.php on line 1 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\WebSites\premierathome_com\products\FrenchTalkingDictionary.php:1) in C:\Inetpub\WebSites\premierathome_com\members\dbinfo.php on line 1 Now the session does actually start and doesn't prevent anything from working, I just get those messages. I'm at a loss as to why a different page with the exact same code, save for searching the database for a different product version would have this problem. I have had this code in place as well which works fine on other pages but doesn't help my problem at all: if(!isset($_SESSION['OK'])){ session_start(); } OK being a variable I set up during log in. I'm at a loss, is anyone able to help me out with this? I am using the ReactPHP event loop with periodic timer. The code works but the browser always shows that the activity is going on (the circle on the chrome tab is always running, refer the link to image below) and it runs only once. Is it possible to get rid of the running circle and still the periodic loop should run in loop at given intervals to execute the code within the loop. Please advise. Circle on the tab Below is my code, Note: **getAll($temp) is a function with parameter in another .php file. I have got the file as include in my current .php file.
$Loop=React\EventLoop\Factory::create(); $Loop->addPeriodicTimer(5, function(React\EventLoop\TimerInterface $timer) use(&$temp, $Loop, &$Total) { try{ $Total = getAll($temp); echo"<script>document.getElementById('Overall').innerText=".$Total."</script>"; }catch (Exception $e){ echo "Error in Loop"; throw $e; } }); I recently put together a form for a client - I am not a programmer (designer) but it worked really until we tried to put the name of a city. It wouldn't take abbreviations that the post office uses
I need to do one of two things - allow it to take abbreviations or take off the requirement that the field has to be filled out.
HELP
Here is the code.
<li class='field_block' id='field_3_div'><div class='col_label'> Hi, I'm trying to change the password after logging in to web site. Following is the code that change the password. However, the password is not changing in the table. Please let me know if I'm making any error in below code. Thanks. Code: [Select] <?php $password=mysql_real_escape_string($_POST['newpassword']); $password2=mysql_real_escape_string($_POST['confirmnewpassword']); if ( strlen($password) < 5 or strlen($password) > 12 ){ echo "Password must be more than 5 char legth and maximum 12 char lenght<BR>"; } if ( $password <> $password2 ){ echo "Both passwords are not matching"; } if($password == $password2){ if(mysql_query("update users set password='$password' where empid='$_SESSION[login]'")){ echo "<font face='Verdana' size='2' ><center>Thanks <br> Your password changed successfully. Please keep changing your password every 2 monthsfor better security</font></center>"; } } hi folks I have a problem with the code to change the password, it shows the message all time when I send the form: old password dont match! <?php session_start(); $user = $_SESSION['first_name']; if ($user) { //user is logged in if ($_POST['submit']) { //check fields $oldpassword = md5($_POST['oldpassword']); $newpassword = md5($_POST['newpassword']); $repeatnewpassword = md5($_POST['repeatnewpassword']); //check password against db //connect db $connect = mysql_connect("*******","****","****") or die(""); mysql_select_db("****") or die(""); $queryget = mysql_query("SELECT password FROM users WHERE username='$user'") or die("Query didnt work !!!"); $row = mysql_fetch_assoc($queryget); $oldpassworddb = $row['password']; //check password if ($oldpassword==$oldpassworddb) { //check to new password if ($newpassword==$repeatnewpassword) { //success //change password in db $querychange = mysql_query("UPDATE users SET password='$newpassword' WHERE username='$user'") or die (""); session_destroy(); die("YOUR PASSWORD HAS BEEN CHANGED.<a href='login_form.html'>RETURN</a> TO THE LOGIN PAGE"); } else die("new password dont match"); } else die("old password dont match"); } else { echo" <form action='changepassword.php' method='POST'> Old password: <input type='text' name='oldpassword'><br/> New password: <input type='password' name='newpassword'><br/> Repeat new password: <input type='password' name='repeatnewpassword'><br/> <input type='submit' name='submit' value='change password'> </form>"; } } else echo("YOU MUST BE LOGGED IN!!!!.<br><a href='login_form.html'>RETURN</a> TO THE LOGIN PAGE"); ?> please help thanks! Hello!
I'm hoping this makes sense.
Basically I have this code:
What it does
1) Looks at the XML
2) Looks for the PIN number in the URL, then finds it in the XML
3) Returns values for the PIN number (which is a profile) allowing me to do echo statements like name, tools, description, etc.
<?php if (!empty($_GET['pin'])) { $feedURL = 'http://www.inveroak.co.uk/readerimages/livepanel/91255.xml'; $showOpsWithNoPics = false; try { $xml = simplexml_load_file($feedURL . '?' . time()); $readers = $xml->xpath('/ReaderDetails/Reader[Pin="' . $_GET['pin'] . '"]'); foreach ($readers as $reader) { if ($reader->Picture == 'None' && $showOpsWithNoPics == false) { $picture = ''; } elseif ($reader->Picture == 'None' && $showOpsWithNoPics == true) { $picture = 'images/defaultpic.jpg'; } else { $picture = $reader->Picture; } if ($picture != '') { $name = $reader->Name; $pin = $reader->Pin; $status = $reader->Status; $description = $reader->Description; $arr_skills = ''; $arr_subjects = ''; foreach ($reader->Categories->Category as $Category) { foreach ($Category->Skill as $Skill) { switch ($Category['name']) { case 'Skills': $arr_skills .= "<li>$Skill</li>"; break; case 'Subjects': $arr_subjects .= "<li>$Skill</li>"; break; } } } $arr_shift = ''; $hourWidth = 20; $PreviousDate = ""; foreach ($reader->Rota->Shift as $Shift) { $Date = $Shift['Date']; $Day = date("l", strtotime($Date)); $Start = $Shift['Start']; $Stop = $Shift['Stop']; if($Stop == '23:59:59' || $Stop == '00:00:00' ){$Stop = '24:00:00';} $Left = date("H",strtotime($Date.' '.$Start)) * $hourWidth; $Width = (round(abs(strtotime($Date.' '.$Stop) - strtotime($Date.' '.$Start)) / 60,2)/60)*$hourWidth; $compare = strcmp ($PreviousDate, $Date); if ($compare != 0) { if ($PreviousDate != '') { //this is not the first loop so close off the previous dayrow and hours divs $arr_shift.= '</div></div>'; } //create a new day row $arr_shift .= '<div class="dayrow">'; $arr_shift .= '<div class="day">'.$Day.'</div>'; $arr_shift .= '<div class="hours">'; } //add the shift object $arr_shift .= '<div class="shift" title="'. substr($Start,0,5).'-'.substr($Stop,0,5) .'" style="left:'.$Left.'px; width:'.$Width.'px; opacity: 1;"></div>'; //set previouse date to the current shift's date so that we can check if we need to create a new day row next loop $PreviousDate = $Date; } //now we have finshed looping the shifts, either close the last div or display a message to show //we have no schedule for the op if ($Date != "") { $arr_shift.= '</div></div>'; } else { $arr_shift.= 'We are sorry but they have not scheduled their hours this week. Email for further details.'; } } } } catch (Exception $e) { echo 'cannot display operator profile'; } } ?>What I am want to achieve 1) Looks at the XML 2) Looks for a set PIN number in the CODE, then finds it in the XML 3) Returns values for the PIN number (which is a profile). Hey all. I am new to this forum and to PHP as a whole. I though I would try to make a login system using php and mysql. The login and register forms work great but I cannot seem to fully figure out how to let a user change their password. My code partially works. When the user types the correct old password and when the two new password forms confirm, the password changes and the database is updated and the user is taken to a page that tells him that his password was successfully changed. However, the problem is when the old password he types is different than the one in the database, the page that states password successfully changed also appears but the password is not changed in the database. The problem is thus with the SELECT statement. Can anyone please help me find whats wrong. It has been tormenting for a few hours now. Thank you in advance. . I used md5 encryption for the passwords. Here is the section of code that comes after the script makes sure that none of the forms are empty and that the passwords confirm . //Create SELECT query to verify that the old password is correct $qry="SELECT * FROM members WHERE login='" . $_SESSION['SESS_USERNAME'] . "' AND passwd='".md5($_POST['opassword'])."'"; $result = mysql_query($qry); if($result) { //Create UPDATE query to replace old password with new password $updatepasswd="Update members set passwd='".md5($_POST['npassword'])."' where login='" . $_SESSION['SESS_USERNAME'] . "' AND passwd='".md5($_POST['opassword'])."'"; $update = mysql_query($updatepasswd); //Check whether the query was successful or not if($update) { header("location: changepasswordsuccess.php"); exit(); } else { die("Query failed"); } } else { header("location: passwordchange-failed.php"); } hello everyone, i try to make a registration script and change password script with PIN as security code, registration script was working perfect, but change password script didn't work. here i give a full code for you to review. here link to file Test.7z I hope someone can help and give me information what i'am missing. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=346762.0 Howdy everyone, please i need help changing a php coded form from a checkbox to a select menu. Here's the form. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" > <table class="dtable2"> <tr><th colspan="5">Enter a domain name:</th></tr> <tr><td colspan="5"><center>www.<input name="domain" type="text" size="35" /></center></td></tr> <tr><th colspan="5">Select an extension:</th></tr> <tr> <?php $i = 0; foreach ($this->serverList as $value) { if ($value['check'] == true) $checked=" checked "; else $checked = " "; echo '<td><input type="checkbox" name="top_'.$value['top'].'"'.$checked.'/>.'.$value['top'].'</td>'; $i++; if ($i > 4) { $i = 0; echo '</tr><tr>'; } } ?> </tr> </table> <center><input type="submit" name="submitBtn" class="sbtn" value="Check" /></center> </form> <?php I'll really appreciate your help. I have a PHP script that uploads images to a folder on my server (attachments folder). Currently the folder sits within my webroot and is publicly accessible (I have to use chmod 777 due to permissions issue). So, I created the "attachments" folder outside of my webroot (so that it is not publicly accessible), but I do not know how to set the path in the PHP code to upload it to that "attachments" folder outside of the webroot. As you see in the snippet of PHP code below, the code currently uploads the the "attachments" folder within the www (webroot) directory. How do I make it upload to the "attachments" folder OUTSIDE of the www (webroot) directory? foreach($files[$form] as $file){ $str = $file[1]; if (eval("if($str){return true;}")) { $_values[$file[0]] = $_FILES[$file[0]]["name"]; $dirs = explode("/","attachments//"); $cur_dir ="."; foreach($dirs as $dir){ $cur_dir = $cur_dir."/".$dir; if (!@opendir($cur_dir)) { mkdir($cur_dir, 0777);}} $_values[$file[0]."_real-name"] = "attachments/".date("YmdHis")."_".$_FILES[$file[0]]["name"]."_secure"; copy($_FILES[$file[0]]["tmp_name"],$_values[$file[0]."_real-name"]); @unlink($_FILES[$file[0]]["tmp_name"]); }else{ $flag=true; if ($_isdisplay) { //$ExtFltr = $file[2]; //$FileSize = $file[4]; if (!eval("if($file[2]){return true;}")){echo $file[3];} if (!eval("if($file[4]){return true;}")){echo $file[5];} $_ErrorList[] = $file[0]; } } } I am new to PHP and learning as I go I am stuck with a piece of code that I am trying to change. I have a php application that has tickboxes in and some are checked as standard. I want to change the tick box setting to be unchecked as standard. Here is the code. <label><input type="checkbox" name="notify" value="1" <?php echo (!isset($_SESSION['as_notify']) || !empty($_SESSION['as_notify'])) ? 'checked="checked"' : ''; ?> /> <?php echo $hesklang['seno']; ?></label><br /> I have tried everything I know but since I do not know that much I have been unable to change the standard. I am sure it is something small that I am overlooking. Anyone out there know what I am doing wrong? Thanks in advance for any help you can provide on this. Bob G. BACKGROUND: I have an app that is hosted on Host Monster and its script includes a Class that is supposed to send MIME emails with or without attachments using only MIME types text, html, and image. It was working fine. I hadn't worked with or on it for about two months then found, last week, that it would no longer send emails even though the script runs without any Warnings. I've worked on this for several days now and I'm stuck. EXPECTED BEHAVIOR: When the script runs, it should send a simple text only email to a given email address and an more complex email that requires html and an in-line image in the body and an attachment with the same image. The image type is jpeg. ACTUAL BEHAVIOR: The script runs to completion with no Warning but sends neither of the two emails. CODE: Attached and cc'd below is a script which mimics the code in my app and the actual behavior described above but only for the simple email mentioned above. To simplify debug I've commented out that part of the script that should send out the more complex email mentioned above. Note: You can run the script by going to http://www.unitresearch03.com/Admin/SendUserEmailHM01.php Note: Line 6 can be changed to your own email address for testing BEGIN CODE: Code: [Select] <?php //TOP LINE CODE ////SIMPLE MIME EMAIL CODE - NO ATTACHMENTS ////////////////////////////////////////////// $mail = new mime_mail ; $mail->from = "ragsr@ix.netcom.com" ; $mail->to = "ragsr@ix.netcom.com" ; $mail->subject = "SIMPLE MIME EMAIL - NO ATTACHMENTS" ; $mail->body = "SIMPLE MIME EMAIL BODY" ; $mail->send() ; ////END OF SIMPLE MIME EMAIL CODE //////////////////////////////////////////////////////// ////START MIME EMAIL CODE - ALLOWS ATTACHEMENTS ///////////////////////////////////////////////// //SIMPLE SEND EMAIL PG.448 PHP REFERENCE PLUS ATTACHMENT EXAMPLE FROM SAME PAGE //include "mime_mail.inc"; //THIS CAUSED A WARNING AND, APPARENTLY, IS NOT REQUIRED. CODE OK W/O IT //READ FILE $filename="/home1/unitcons/public_html/unitresearch03/TCStripComposition-27Cb.jpg" ; $content_type="image/jpeg" ; //OPEN, EXTRACT DATA, THEN CLOSE FILE $fd=fopen($filename, "r") ; $data=fread($fd, filesize($filename)) ; fclose($fd) ; $fileX="/home1/unitcons/public_html/unitresearch03TCStripComposition-27Cb.jpg" ; $ftype=filetype ($filename) ; $fsize=filesize($filename) ; //echo "FILE TYPE :"."$ftype"."<br>" ; //echo "FD FILE TYPE :"."$fdltype"."<br>" ; //echo "DATA :"."$data"." END DATA"."<br>" ; //echo "FSIZE :"."$fsize"."<br>" ; //echo "FDSIZE :"."$fsize"."<br>" ; //echo "FD :"."$fd"."<br>" ; //CREATE OBJECT INSTANCE $mail = new mime_mail ; //SET ALL DATA SLOTS $mail->from = "thromptmweeklycs@unitresearch03.com" ; $mail->to = "ragsr@ix.netcom.com" ; $mail->subject = "XXXThrompTM Weekly Comic Strip - Week of 6/20/201" ; $mail->body = "<html>Hope you enjoy your ThrompTM today! <br> <br> <br> <img src=http://www.unitresearch03.com/TCStripComposition-27Cb.jpg height='197' width='500' > </html>"; //DEFINE ATTACHMENT $name = $fileX ; $message = $data ; //ADD ATTACHEMENT //$mail->add_attachment ($data, $filename, $content_type) ; //SEND EMAIL //$mail->send() ; ////EBD SEND EMAIL WITH ATTACHMENT ////MIME CLASS class mime_mail { var $parts; var $to; var $from; var $headers; var $subject; var $body ; /* * void mime_mail() * class constructor */ function mime_mail () { $this->parts = array() ; $this->to = "" ; $this->from = "" ; $this->subject = "" ; $this->body = "" ; $this->headers = "" ; } /* * void add_attachement (string message, [string name], [string ctype]) * Add an attachment to the mail object */ function add_attachment ($message, $name = "", $ctype = "text/html jpeg" ) //function add_attachment ($data, $fileX, $content_type ) { echo "CTYPE IN AA :"."$ctype"."<br>" ; //echo "MESSAGE IN AA :"."$message"."<br>" ; echo "ENCODE IN AA: "."$encode"."<br>" ; echo "NAME IN AA :"."$name"."<br>" ; //echo "DATA IN AA :"."$data"."<br>" ; $partsd = $this->parts[] = array ( "ctype" => $ctype, "message" => $message, "encode" => $encode, "name" => $name, ); echo ("ARRAY#1 CTYPE :"."$partsd[ctype]"."<br>") ; //echo ("ARRAY#2 MESSAGE :"."$partsd[message]"."<br>") ; echo ("ARRAY#3 ENCODE :"."$partsd[encode]"."<br>") ; echo ("ARRAY#4 NAME :"."$partsd[name]"."<br>") ; //echo ("ARRAY#5 DATA :"."$partsd[data]"."<br>") ; $sizeX=sizeof($this->parts) ; echo "SIZE OF ARRAY IN ADD ATTACHMENT:"."$sizeX"."<br>" ; } /* * void build_message (array part= * Build message parts of an multipart mail */ function build_message ($part ) { $message = $part[ "message"]; //echo "MESSAGE IN BUILD:"."$message"."<br>" ; $message = chunk_split(base64_encode($message)) ; //echo "MESSAGE :"."$message"."<br>" ; $encoding = "base64" ; $partctype = $part["ctype"] ; $partname = $part["name"] ; echo "PART CTYPE :"."$partctype"."<br>" ; echo "PART NAME :"."$partname"."<br>" ; return "Content-Type: ".$part["ctype"]. ($part["name"]?" ; name =\"". $part["name"]. "\"":""). "\nContent-Transfer-Encoding: $encoding\n\n$message\n" ; } /* * void build_multipart() * Build a multipart mail */ function build_multipart() { $boundary = "b".md5(uniqid(time())) ; $multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary" ; //$sizeX=sizeof($this->parts) ; //echo "SIZE OF ARRAY :"."$sizeX"."<br>" ; for ($i = sizeof($this->parts)-1; $i >= 0; $i--) { $multipart .= "\n".$this->build_message($this->parts[$i])."--$boundary" ; //echo "MULTIPART :"."$multipart"."<br>" ; } return $multipart.= "--\n" ; } /* * string get_mail() * returns the constructed mail */ function get_mail($complete = true) { $complete = true ; echo "COMPLETE :"."$complete"."<br>" ; ////STAEMENT ADDED TO FORCE IF ($COMPLETE) {} BELOW TO RUN //echo "MESSAGE IN GET MAIL:"."$message"."<br>" ; $mime = "" ; if (!empty($this->from)) $mime .= "From: ".$this->from. "\n" ; echo "MIME 1:"."$mime"."<br>"; if (!empty($this->headers)) $mime .= $this->headers. "\n" ; echo "MIME 2:"."$mime"."<br>"; if ($complete) { echo "MIME 3:"."$mime"."<br>"; if (!empty($this->to)) { $mime .= "To: $this->to\n" ; echo "MIME 4:"."$mime"."<br>"; } if (!empty($this->subject)) { $mime .= "Subject: $this->subject\n" ; echo "MIME 5:"."$mime"."<br>"; } } if (!empty($this->body)) $this->add_attachment($this->body, "", "text/html"); echo "MIME 55:"."$mime"."<br>"; $mime .= "MIME-Version: 1.0\n".$this->build_multipart() ; echo "MIME 6:"."$mime"."<br>"; return $mime; } /* * void send() * Send the mail (last class-function to be called) */ //function send ($message, $data, $fileX, $content_type) function send () { //$bodyY=$this->body ; //echo "BODYY :"."$bodyY"."<br>" ; $mime=$this->get_mail () ; echo "MIME 7:"."$mime"."<br>" ; mail($this->to, $this->subject, "" , $mime) ; //mail($this->to, $this->subject, $this->body, $mime) ; } } ; ////END OF MIME CLASS CODE ///////////////////////////////////////////////////////////////// ?>END CODE: I have a search function in php where the text characters are matched to characters in a tables field--- works perfectly.... I need to make the input box have a droplist of words from database, this is also easy for me to do. the problem here is there is no definitive value! the options list always outputs a blank in the url--- its supposed to search a matching value and then output the matching value to url... Here is the droplist code: $output['RATESTITLE']='<input class="inputbox" type="text" size="24px" name="ratestitle" value="'.$sch->filter['ratestitle'].'" onfocus="if (this.value ==\''.$output['LANGUAGE_SEARCH_RATESTITLE'].'\') {this.value = \'\'}" />'; this outputs a input text box--- i want to have a droplist of options to populate this text box... If you must know this is the third day im at it... maybe some wiz kid out their can help me figure out whats going on here. What suppose to happen is a random site suppose to load into a iframe When the frameset code below is inside the <body> tags only the menubar shows up and not the iframe with a random site. Now when i take the code and put it oustide the <body> tag the menubar goes away and only the iframe with a random site is shown . The goal of course is to get the menubar to be visible and to have a iframe with a random site loaded into it. For some reason i can only get one of the two the happen. I do hope i explained this well enough Code: [Select] <frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3"> <frame src="explore.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset>-------------------------------------------------------------------------------------------------- Code: [Select] <?php /** * @author Brent Moeller * @copyright 2011 */ include ('functions.php'); db_connect(); $result = mysql_query("SELECT * FROM slinks where approval='1' ORDER BY RAND() LIMIT 1") or die(mysql_error()); ?> <html> <head> <title>DizzyUrl Discovery Engine</title> <link rel="stylesheet" type="text/css" href="mouseovertabs.css" /> <script src="mouseovertabs.js" type="text/javascript"> /*********************************************** * Mouseover Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more ***********************************************/ </script> </head> <body> <frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3"> <frame src="explore.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset> <div id="mytabsmenu" class="tabsmenuclass"> <ul> <li><a href="http://www.javascriptkit.com" rel="gotsubmenu[selected]">JavaScript Kit</a></li> <li><a href="http://www.cssdrive.com" rel="gotsubmenu">CSS Drive</a></li> <li><a href="http://www.codingforums.com">No Sub Menu</a></li> </ul> </div> <div id="mysubmenuarea" class="tabsmenucontentclass"> <!--1st link within submenu container should point to the external submenu contents file--> <a href="submenucontents.htm" style="visibility:hidden">Sub Menu contents</a> </div> <script type="text/javascript"> //mouseovertabsmenu.init("tabs_container_id", "submenu_container_id", "bool_hidecontentsmouseout") mouseovertabsmenu.init("mytabsmenu", "mysubmenuarea", true) </script> <noframes> <p>This Browser does not support Frames.</p> </noframes> </body> </html> ok say I have a file that has something like 123456 abcde 654321 edcba in a file.. how would I go about having the script pull "123456" and make it a variable in the script.. and "abcde" a variable? and then "654321" a variable but is set in an array so that 123456 and 654321 are both the same variable but like $variable[0] and abcde and edcba would be $variable[1] what do I have to do? hi, im getting the error Quote Fatal error: Call to undefined function notification() in C:\xampp\htdocs\xampp\index.php on line 21 after including the functions.php file i wrote. It does include it but the data isnt being recognised from it. If i copy/paste the notification() function into index.php it works. Can someone tell me why so i can fix it? why this simple code only works on chrome??
function mostrarOcultar(obj) { document.getElementById('seguro').style.visibility = (obj.checked) ? 'hidden' : 'visible'; } Hi. im baffled on this. boss wants a traffic feed for the office so im using SimplePie to grab rss feeds and the google maps traffic overlay as a view of the roads. The trouble is when i do it via xampp locally it looks fine, but when i load into onto our local webserver (ubuntu 18.04 with apache) it only shows a small line and cant figure out why? any help is appreciated. The attached images are how my local xampp sees it and the other is via the ubuntu 18.04 with apache, php & mysql installed My Code is below <?php // Include the SimplePie library require_once('php/autoloader.php'); // Because we're using multiple feeds, let's just set the headers here. header('Content-type:text/html; charset=utf-8'); // These are the feeds we want to use $feeds = array( 'http://m.highwaysengland.co.uk/feeds/rss/AllEvents.xml', 'https://traffic.wales/feeds/incidents-events/rss.xml', 'https://traffic.wales/feeds/roadworks/rss.xml', 'https://trafficscotland.org/rss/feeds/currentincidents.aspx', 'https://trafficscotland.org/rss/feeds/roadworks.aspx' ); // This array will hold the items we'll be grabbing. $first_items = array(); // Let's go through the array, feed by feed, and store the items we want. foreach ($feeds as $url) { // Use the long syntax $feed = new SimplePie(); $feed->set_feed_url($url); $feed->init(); // How many items per feed should we try to grab? $items_per_feed = 5; // As long as we're not trying to grab more items than the feed has, go through them one by one and add them to the array. for ($x = 0; $x < $feed->get_item_quantity($items_per_feed); $x++) { $first_items[] = $feed->get_item($x); } // We're done with this feed, so let's release some memory. unset($feed); } // We need to sort the items by date with a user-defined sorting function. Since usort() won't accept "SimplePie::sort_items", we need to wrap it in a new function. function sort_items($a, $b) { return SimplePie::sort_items($a, $b); } // Now we can sort $first_items with our custom sorting function. usort($first_items, "sort_items"); // Begin the (X)HTML page. ?> <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Traffic Layer</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> <style type="text/css"> body { height: 100%; font:12px/1.4em Verdana, sans-serif; color:#333; background-color:#fff; } a { color:#326EA1; text-decoration:underline; padding:0 1px; } a:hover { background-color:#333; color:#fff; text-decoration:none; } div.header { border-bottom:1px solid #999; } div.item { padding-left:5px; border-bottom:1px solid #999; } div#site { padding:5px 0; width:300px; } /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; } footnote, p{ color:red; font:9px/1.4em Verdana, sans-serif; font-weight:bold; } </style> </head> <body> <!-- NEW --> <div class="row"> <div class="col-md-2"> <!-- BOF Simple Pie News Feed Info --> <div id="site"> <?php foreach($first_items as $item): $feed = $item->get_feed(); ?> <div class="chunk"> <h6><b><?php echo html_entity_decode($item->get_title(), ENT_QUOTES, 'UTF-8'); ?></a></b></h6> <?php echo $item->get_content(); ?> <?php if ($enclosure = $item->get_enclosure()): ?> <div> <?php echo $enclosure->native_embed(array( )); ?> </div> <?php endif; ?> <p class="footnote">Source: <?php echo $feed->get_title(); ?></a> | <?php echo $item->get_date('j M Y | g:i a'); ?></p> </div> <?php endforeach; ?> </div> <!-- EOF Simple Pie News Feed Info --> </div> <div class="col-md-10"> <!-- BOF Map Info --> <div id="map"></div> <script> function initMap() { var map = new google.maps.Map(document.getElementById('map'), { zoom: 7.4, center: {lat: 53.8059821, lng: -1.6057714} }); var trafficLayer = new google.maps.TrafficLayer(); trafficLayer.setMap(map); } </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=<My Google API Key>&callback=initMap"> </script> <!-- EOF Map Info --></div> </div> <!--OEF Test --> </script> </body> </html>
|