HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
Try changing it to this... <!-- EDIT BELOW THIS LINE --> <table align="center"> <tr>'; $data = ssi_recentPosts(); $content .= $data; $content .= '<tr> </table> <!-- EDIT ABOVE THIS LINE --> '; $content .= '</div>'; Regards Huggie
-
If you're using it in a preg_replace() function then you probably want to use file_get_contents()... <?php $mpu = file_get_contents('mputag.php'); ?> <body> <?php $len = (strlen($story) >> 1); echo preg_replace( "/(?<=.{{$len}})\s/s", "<br /><br />".$mpu."<br /><br />", nl2br($story), 1); ?> </body> I don't know how it'll cope with the nested <?php tags Regards Huggie
-
I don't think you have to worry about it too much Regards Huggie
-
By assigning the result of include('mputag.php') to $mpu, you're giving it a value of either true or false (1 or 0) hence the display of the number 1. I'm guessing include isn't actually the function you want. What does this mputag.php file contain and what are you trying to display? Regards Huggie
-
Nope, you're an expert now ;-) Try some of the tutorials here @ PHPFreaks Regards Huggie
-
[SOLVED] Upload file directory setting
HuggieBear replied to emediastudios's topic in PHP Coding Help
You could base in on file extension... <?php // Check the extension is valid if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $_FILES['uploadFile'. $x]['name']){ // Add your adding to db and moving code here } else { // Add your error code here echo "Sorry, file must be of type .jpg .jpeg .gif or .png\n"; } ?> Or there's a slightly more complex method using mime type. Search these forums for that. Regards Huggie -
My guess would be that one of the other fields in the database (other than the id column) is also set to be unique. Regards Huggie
-
Look at imagecreatefromstring() regards Huggie
-
[SOLVED] Upload file directory setting
HuggieBear replied to emediastudios's topic in PHP Coding Help
Replace this in your code $copy = copy($_FILES['uploadFile'. $x]['tmp_name'],$file_name); With this in my code // Set pth to image directory $path = '../images/'; // Move file to new location move_uploaded_file($_FILES['uploadFile'. $x]['tmp_name'], $path . $file_name) It should be that simple. Regards Huggie Edit: I notice you're not stripping the path from the temp name, you'll want to do that too. -
[SOLVED] Upload file directory setting
HuggieBear replied to emediastudios's topic in PHP Coding Help
Firstly add a forward slash to the end of that path, so it reads $path = '../images/'; Regards Huggie -
OK, think about this logically... 1. Present the user with a login form 2. Check the user against the database 3. If the user is verified then create a session variable with their unique User ID in it, if not then re-present the login form 4. Add a check to the top of each member page to make sure that the session variable exists. If it doesn't redirect to login page, if it does then display content. That's as simple as it gets for logging in. Worry about making functions out of it afterwards, especially if you're struggling with the basic procedural approach. Regards Huggie
-
[SOLVED] Getting the REAL directory?
HuggieBear replied to Nolongerused3921's topic in PHP Coding Help
Try the magic constant __FILE__ Regards Huggie -
Hmmm, don't Server Side Includes use a syntax like this: <!--#include virtual="../file.php" --> But if you're using PHP there shouldn't be a real need to use SSI. Regards Huggie
-
Also make sure you use something like mysql_escape_string() on your data before selecting it. Regards Huggie
-
Mail function work in gmail but not in yahoo
HuggieBear replied to vani sri's topic in PHP Coding Help
Try inserting the 'From:' header. I know Hotmail doesn't like it if it's not included. Regards Huggie -
Change your SQL statement to this... $sql = "SELECT `" . $select . "` FROM `cf_users` WHERE `id` = '" . $where . "' LIMIT 1"; Escaping out of the quoted string to insert your variables makes it a) easier to read and b) quicker to parse. Regards Huggie
-
You're seeing the sql, as that's what you're echoing. If you want the results displayed then you need to echo them... <?php // SQL query for all entries in descending order (Added a limit clause here as I assume you're only expecting 1 result) $sql = "SELECT '$select' FROM `cf_users` WHERE `id`='$where' LIMIT 1"; // Return a result resource (this still isn't in a form you can echo) $rs = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error()); // This is missing, this gets the actual data from the result resource $username = mysql_result($rs,0,0); /* This is changed echo $sql; to this */ echo $username; ?> Regards Huggie
-
That will be due to these lines... $sql = "SELECT '$select' FROM `cf_users` WHERE `id`='$where'"; echo $sql; Notice anything wrong Regards Huggie
-
What happens when you google it? Huggie
-
That could easily (and most likely) be a single string containing newline characters as opposed to an array containing 4 lines. Regards Huggie
-
Is the original source of $companyaddress an array in the first place? Try this and paste the outcome (in code tags). var_dump($companyaddress); Regards Huggie
-
That's what I gave you... 7.16.2 I never mentioned the latest version. Regards Huggie