Jump to content

ballouta

Members
  • Posts

    625
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    California
  • Age
    34

ballouta's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Hello I spent literally 5 hours creating the following regex for a friend of mine! (?s)(?=Configuration)(.*?)(?>onal\)\:) The regex is supposed to capture several lines from a static content that starts with the word Configuration and ends with the word (optional): This content has sometimes a new blank line and sometimes two empty lines. Is it possible you kindly assist me in modifying the above regex so it extracts all the text needed, at the same time it ignores all new/blank lines? Text Sample: Hello Configuration There is something here s bbye optional): Hoping for this output: Hello Configuration There is something here s bbye optional): We are using the function reg_match. Thank you
  2. ballouta

    Contact Form

    Hello, I have this contact form CSS code, I a tryin to edit it to make its direction from right to left AND place the titles (Name-Email etc..) on the right instead of the left. and the input fields on the left. but it is not working. Original CSS is: .input_fields { /* Form field style */ color: #000000; width: 350px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; padding: 5px; margin: 0px 0px 5px 75px; background-color: #EEE; border: 1px; border-color:#CCC; border-style:solid; display: inline; } .input_fields:hover { background-color: #CCC; border: 1px; border-style:solid } /* Form field style */ .input_button { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-top: 10px; margin-left: 130px; padding: 10px 20px 10px 20px; background-color: #990007; border: 0px; display: inline; clear: both; } /* Button style */ .input_button:hover { background-color: #333; border: 0px;} /* Button style */ .fb_titles { width: 55px; float: left; text-align: left; } and here is the online link: http://www.thinkpositive-lb.org/ar/contact.php a strange thing is that the text sometims appear correctly on the right (name-email...) then it jumps to the left! Many thanks
  3. hello How do i make bullets exactly under the text before it? here's an example of bullets needed to be taken to the left: http://www.arabbev.org/about_us.php Thank you
  4. thank you gnawz I will remove it and try to login If i use the md5 function to encrypt a new password, for example pass123, am i able to store the hased value in the DB and login using pass123?
  5. yes this is what i was looking for md5. how i can decrypt the password is there a function? thanks
  6. thanks where is the encryption code? and how do I reverse it so i know what was my old password? or at least add a new username and password? Thank you
  7. Hello, I have a table called 'admin' stores two usernames and passwords. The user name is clear where the password is a long string smthg like this: s094fhdg2984032 The login form is like nay login code, it is posted the a file called 'session.php' this file code is: <?php include("database.php"); $uname=addslashes($_POST['username']); $password=addslashes($_POST['password']); if($uname=='' && $password==''){ $msg="Please enter your username and password"; header("Location: ../index.php?msg=$msg"); exit; } $sqlStat="SELECT * FROM admin"; $sqlRes=mysql_query($sqlStat); while($row=mysql_fetch_array($sqlRes)){ $un=stripslashes($row['username']); $pd=stripslashes($row['password']); $hpd=md5($password); if($uname==$un && $hpd==$pd){ $id=stripslashes($row['id']); $time=time(); setcookie("arabbev_001",$id,0,'/'); $sqlStat1="INSERT INTO session VALUES('','$id','$time')"; $sqlRes1=mysql_query($sqlStat1); header("Location: ../main.php"); exit; } } $msg="Invalid username or password"; header("Location: ../index.php?msg=$msg"); exit; ?> if the login was sucesfull, it should go to main.php which begins with: <?php include("common/database.php"); require('common/check_session_main.php'); ?> I don't know what is the username to login, so i inserted in the admin table: username: ballouta password: pass123 but it didn't work!! May you explain please what does session.php make and how it works? How i can login? Many thanks
  8. Hello I have a PHP attach form, i need to disable the Submit button after it is clicked once, is this possible? thank you
  9. I will make this modification and test my code. In this time , i would like to know the best and good way to loop over the messages found in my inbox. In my code, i use a for loop, but I don't think it is a good way of programming in this issue! 1. I want to loop over the messages (prefer anthor way) 2. Fetch and copy the attched files to a specific Folder (this piece of code is working) 3. Delete this message after copying its attachment file. Thanks alot
  10. Hello i have this code, it is all working but the From email address is not showing, instead it is showing the sender's name! Online Demo! http://www.motif-services.com/hc.php the Problem here: Header From : Mohammad Daouk $SaveFileDirectory = "/home/motifser/public_html/malek/"; function WriteToFile($file,$contents) { // IF the contents is empty lets just make it one space if ($contents=='' || empty($contents)) $contents = " "; // $file is the full path to the file $fh = fopen($file, "w") or die("Could not open file!"); fwrite($fh, $contents) or die("Could not write to file"); fclose($fh); } //check for new messages $mailbox = imap_open("{localhost:143/notls}INBOX", "chehab@motif-services.com", "123") or die("Can't connect: " . imap_last_error());; // Check messages $check = imap_check($mailbox); // viewing number of messages in inbox $chec = imap_mailboxmsginfo($mailbox); //echo "Number of Messages: " . $chec->Nmsgs . "<br />\n"; //$cont=$chec->Nmsgs; $headers = @imap_headers($mailbox) or die("Couldn't get emails"); $numEmails = sizeof($headers); echo "You have $numEmails messages in your mailbox <br><br><br>"; for($j = $numEmails; $j >=1; $j--) { $mailHeader = @imap_headerinfo($mailbox, $j); $from = $mailHeader->fromaddress; $subject = strip_tags($mailHeader->subject); $date = $mailHeader->date; //echo "Email from $from, subject $subject, date $date<br>"; if ($check->Nmsgs=='0') { echo "There are no messages that need to be downloaded"; } else { $emailIndex = $j; echo "Processing email " . $emailIndex . "<br>"; $header = imap_header($mailbox, $emailIndex); print("<PRE>"); print("Header Date : " . $date . "<BR>"); //print("Header To : " . $header->to) . "<BR>"; print("Header From : " . $from . "<BR>"); //print("Header cc : " . $header->cc . "<BR>"); print("Header ReplyTo : " . $from . "<BR>"); print("Header Subject : " . $subject . "<BR></PRE>"); /* Lets find the email body */ $struct = imap_fetchstructure($mailbox, $emailIndex); $parts = $struct->parts; $i = 0; if (!$parts) { /* Simple message, only 1 piece */ $attachment = array(); /* No attachments */ $Email_Comments = imap_body($mailbox, $emailIndex); } else { /* Complicated message, multiple parts */ $endwhile = false; $stack = array(); /* Stack while parsing message */ $Email_Comments = ""; /* Content of message */ $attachment = array(); /* Attachments */ while (!$endwhile) { if (!$parts[$i]) { if (count($stack) > 0) { $parts = $stack[count($stack)-1]["p"]; $i = $stack[count($stack)-1]["i"] + 1; array_pop($stack); } else { $endwhile = true; } } if (!$endwhile) { /* Create message part first (example '1.2.3') */ $partstring = ""; foreach ($stack as $s) { $partstring .= ($s["i"]+1) . "."; } $partstring .= ($i+1); if (strtoupper($parts[$i]->disposition) == "ATTACHMENT") { /* Attachment */ $attachment[] = array("filename" => $parts[$i]->parameters[0]->value, "filedata" => imap_fetchbody($mailbox, $emailIndex, $partstring)); } elseif (strtoupper($parts[$i]->subtype) == "PLAIN") { /* Message */ $Email_Comments .= imap_fetchbody($mailbox, $emailIndex, $partstring); echo "Email Body: $Email_Comments <br/><br/>"; $daouk=$Email_Comments; // my code $emailIndex +=1; } } if ($parts[$i]->parts) { $stack[] = array("p" => $parts, "i" => $i); $parts = $parts[$i]->parts; $i = 0; } else { $i++; } } /* while */ } /* complicated message */ foreach ($attachment as $attach) { WriteToFile($SaveFileDirectory . $attach['filename'], imap_base64($attach['filedata'])); echo "Attachment found: " . $attach['filename'] . "<br><hr>"; } } // end else //imap_delete($mailbox, $j); //imap_expunge($mailbox); } // end for
  11. hi thebadbad your right, no need to check if the file exists or not. As for replacing filectime () with filemtime(), I got the same error But your code is better and short, even though i still have a problem. I wrote: <?php if ($handle = opendir('malek')) { while (false != ($file=readdir($handle))) { $info = pathinfo($file); echo "$info['extension']"; echo "$info['filename']"; } } ?> I got this error: http://www.motif-services.com/date2.php Kindly fix it for me.
  12. Hi Skot, i tried your code line, i got the same error: As for jamieh code, as shown in the example, I added that if (if (file_exists($file)) ) and it works, but doesn't show all files modification date!! very strange why? http://www.motif-services.com/date.php <?php if ($handle = opendir('malek')) { while (false != ($file=readdir($handle))) { if ( ($file != ".") && ($file != "..") ) { $array = explode( '.' , $file ); echo "FILENAME:" . $array[0]; echo "<br>"; echo "EXTENSION:". $array[1]; if (file_exists($file)) {echo "<br> was last changed: " . date("F d Y H:i:s.", filectime($file)); } echo "<br><br><br>"; } } } ?>
×
×
  • 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.