premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
$query = "SELECT * FROM #__content WHERE (catid = '$cat1' AND publish_down < publish_up)"; Should work, given that the publish_down and publish_up is the correct way it should be.
-
[SOLVED] getting a eval() to return a bool resault
premiso replied to M.O.S. Studios's topic in PHP Coding Help
I doubt it is possible unless you use the from the eval page. You may be able to use set_error_handler to handle that error, but I think it will still exit the script either way. If using php5 (I highly doubt this will work with a Try/Catch) but you can try a Try/Catch. But since it is returning a fatal error, I do not think it will work. -
Untested, but I would suggest against eregi as it is being depreciated. <?php $email = "someone@test.com"; $pattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' . '(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i'; $valid = preg_match($pattern, $email); if ($valid == 1) { echo 'Valid email'; }else { echo 'InValid email'; } ?> Pulled from preg_match user comments. That will only solve the issue of a valid email address. To make sure the domain has an mx record you can use checkdnsrr to validate that portion (the host part): <?php function validateEmail($email) { list(,$host) = explode("@", $email); if (empty($host)) return false; if (!checkdnsrr($host, "MX")) return false; $pattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' . '(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i'; return preg_match($pattern, $email); } if (validateEmail('example@sometest.com')) { echo 'Email valid.'; }else { echo 'Email not valid.'; } ?> The code above is untested, so may have issues with syntax, fix those and it should work.
-
Help needed - Fatal error – function not defined
premiso replied to lesterdan's topic in PHP Coding Help
Why not have him debug this. You are just posting random bits of code, not even posting the code in the tags like you have been asked several times before. My bet is, you do not have the functions file being included on user.php given that the error is thrown on line 1, you could not. You have to include the functions file that holds the definitions of the functions before you can use those functions. -
[SOLVED] Curl not retrieving image properly
premiso replied to scottybwoy's topic in PHP Coding Help
file_get_contents is much slower than curl. I would figure out your curl issues if you want speed. -
session_Start cannot be called after output has been sent. Post the code of test2.php as that is where the output is started.
-
[SOLVED] Curl not retrieving image properly
premiso replied to scottybwoy's topic in PHP Coding Help
That unreadable junk is the right stuff. It is the binary of the image. You write that to the file and it should show. Don't print it, as in order for the actual image to display after printing you would have to modify header to the image type. Try writing the $image from the file_get_contents to the file and see if that works. -
MAIL script not working, any help appreciated.
premiso replied to matt.sisto's topic in PHP Coding Help
Which is it buddy? Post or get? Since I do not know which, I will take it you meant POST and not GET <?php require "dbconn2.php"; if (isset($_POST['con_id'])) { $from = $_POST['email']; $sender = $_POST['name']; $message = $_POST['body']; $con_id =$_POST['con_id']; $sql = "SELECT email_address FROM consultant WHERE con_id = '$con_id'"; $result=mysql_query($sql); $to = mysql_result($result, 0, 0); /* Redundant/not needed. $sender = $name; $message = $_GET['body']; $from = $_GET['email'];*/ if (mail($to, $sender, $message, $from) { header ("Location: message.php"); exit(); }else { header ("Location: index.php"); exit(); } } ?> <!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 http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>?Message Consultant</title> </head> <body> Error, no data was submitted. </body> </html> Made some comments and removed/modified the code. Let me know of any questions about it. -
I would tend to use Flash for this, as it is a nice way to go. If you would like to not use flash, AJAX would be another alternative. Ajax Upload with Progress Bar As far as anything being simple, there will not be. You will have to implement etc and it will require some modifications/work.
-
http://www.evolt.org/PHP-Login-System-with-Admin-Features Not exactly what you are looking for, but if you implement you should be able to hack the code to suit your needs. There is not a hardset tutorial or example of exactly what you want (rarely there is). So you have to go and read up on different parts, such as how to send an email to a user. How to create a database with MySQL and how to query that with SQL. The above tutorial should get you rolling on parts of it, but it still expects a basic knowledge of SQL and PHP, which it seems you probably do not have. So I would read up on the basics of PHP and SQL before going much further.
-
[SOLVED] Forum ADMIN and USER issue! Please Help
premiso replied to rEhSi_123's topic in PHP Coding Help
I fail to see where $admin_user_level is being defined. If it is not defined then it will never equal 0 and hence it always defaults to the else statement. -
It uses AJAX/PHP. Google up AJAX PHP Login and you should have some examples.
-
[SOLVED] connecting to mysql gives me an internal error
premiso replied to Yeodan's topic in PHP Coding Help
It is an issue with your webserver. Either look at your http.conf. php.ini or any .htaccess file. -
print "<li><font face=tahoma size=1><a href=\"blogread.php?blog=$field\">$field</a></font></li><br>"; Should work, if not look into using urlencode on $field inside the link. print "<li><font face=tahoma size=1><a href=\"blogread.php?blog=" . urlencode($field) . "\">$field</a></font></li><br>";
-
Show the full code of the index.php page. Chances are there is something in that code causing the problem.
-
You are echoing $page, and when the browser closes it flushes (displays to the screen) the output buffer. To stop/prevent this you need to use ob_end_clean to clear the output buffer that is being held.
-
You implemented the heredoc wrong again. I would suggest reading up on it. $message .= <<<EOMSG <form method="post" action="{$thisfile}"> <input type="text" name="Email" size=10> <input type="submit" name="submit" value="Submit"> </form> EOMSG; Heredoc is very particular on spacing, notice the space between the .= and the <<< ALso notice you have a space after the <<< and before the EOMSG which there should not be. Also the note of the 3 sapces after the ; after the EOMSG, that needs to be removed as well. If you want to use heredoc you have to be precise. For the undefined notice: if (isset($_POST['submit']) && $_POST['submit'] == 'Submit') { $message = ""; if (!isset($_POST['Email']) || $_POST['Email'] =="") $message = '<P>There is a problem with your email address</P>';
-
A correction I noticed: $message .= " <form method=\"post\" action=\" " . $thisfile . "\"> <input type=\"text\" name=\"Email\" size=10> <input type=\"submit\" name=\"submit\" value=\"Submit\"> </form> "; Needed the equals after the dot. Same with the heredoc. $message .= <<< EOMSG <form method="post" action="$thisfile"> <input type="text" name="Email" size=10> <input type="submit" name="submit" value="Submit"> </form> EOMSG;
-
Sessions are stored on a file on the server. It can hold massive amounts of data without worry. Plus it is all text, I take it, and text holds no space at all. You can store it in the session as an array or as individual vars, it is up to you.
-
Put the data into session and check if the session isset if it is put that variable back in the box.
-
[SOLVED] problem with checkdnsrr(); function !!
premiso replied to yami007's topic in PHP Coding Help
$email = "cool_yami_007@hotmail.com"; list($user, $host) = explode("@", $email); if (checkdnsrr($host,"MX")) { -
nl2br() And mysql_real_escape_string() Conflict?
premiso replied to Vermillion's topic in PHP Coding Help
Magic Quotes are most likely on. You should disable them in your php.ini if they are. If they are it will double escape your data, which is not kosher. -
EDIT: Sorry, missed the original question. You can assign a "no-image" picture to it that is a valid image. That way something is displayed. EDIT: EDIT: And if you tried AdRock's code, please explain why that did not solve the issue, if you would like further help.
-
Hmm, that gives me a ton of information. Post your current code, and the "stuff" before the link. Given that you take the original code I posted above it works fine right? So the issue lies with how the data is stored in the string. Do a print_r on the $matches variable, view the source and paste that array here as well. Just to make sure you are echoing $matches[1] and not $matches[0].