premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
<?php /*#1 - <a href="normal/8.jpg" title="image title"><img src="thumbs/8.jpg" border="0" align="middle" alt="image" style="border: 2 solid #000000" width="130" height="160"></a> #2 - <a href="/pics_content/7591/05.jpg"><img src="/pics_thumbs/7591/05_tn.jpg" width="140" height="140" border="2" alt="image" title="image"></a> so from #1 i want 'normal/8.jpg' and 'thumbs/8.jpg' from #2 i want '/pics_content/7591/05.jpg' and '/pics_thumbs/7591/05_tn.jpg'*/ $string = '<a href="normal/8.jpg" title="image title"><img src="thumbs/8.jpg" border="0" align="middle" alt="image" style="border: 2 solid #000000" width="130" height="160"></a>'; $string .= '<a href="/pics_content/7591/05.jpg"><img src="/pics_thumbs/7591/05_tn.jpg" width="140" height="140" border="2" alt="image" title="image"></a>'; $strings = split("</a>", $string); array_pop($strings);// the last one is not needed. foreach ($strings as $string) { preg_match_all('/href="([^"]+).*src="([^"]+)/i', $string, $matches[]); } print_r($matches); die(); ?> Should work, may not be the exact way you want it, but I am not sure if it can be done without splitting the strings into an array...
-
Any susbstitute for Header Location using cron job
premiso replied to leo_maverick's topic in PHP Coding Help
How is the cronjob being ran? With PHP CLI? If so I doubt PHP CLI uses the header function. If on Linux you would probably need to use the LYNX browser in your cron job execution part for it to actually re-direct. -
The point was in the mail function, you were using $to_email, and in your variable declaration you were using $to_mail, since $to_mail is not the same as $to_email you needed to switch one. I chose to switch the $to_mail, to be $to_email. Look at the line below the // it is not $to_email.
-
<?php $filename = "file.txt"; #Must CHMOD to 666 $text = $_POST['action']; # Form must use POST. if it uses GET, use the line below: #$text = $_GET['theformfieldname']; #POST is the preferred method $fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents if ($fp) { fwrite ($fp, $text); stripslashes($text); fclose ($fp); header('Location http://www.example.com/otherotherpage.php'); } else { header('Location http://www.example.com/otherpage.php'); } ?> Not within the echo, replace the echo code with it.
-
What is the mysql_error that is being returned?
-
It also depends on how your mind works and your work ethic. There are alot of people on these forums that "Try" to learn php, but every little error they never try to debug/figure out on their own. For me, I started HTML/JS at 13, by 15 I knew "PHP", by 17 I knew .NET SQL (C# VB), C++, Java and OOP Programming in all. I self taught my self everything by just looking at examples etc, then in College they tried to "teach" it to me but I knew more than the professors did at that point and it was just for me to get a degree. So really it depends on how motivated you are, what you already know, and how your brain thinks. I can take someone elses code and figure out how it works, depending on the size, in less than a week. If I have questions I google it and eventually find the answer. I have always been one to find the answers myself cause then I remember it later down the line. But as ginger said, it is impossible for else to tell you cause everyone is different. And if all you did in C was a little bit of Homework, chances are the learning curve for you will be pretty steep.
-
Please use the [ code] [ /code] (without the space in those tags) to post code in. //$to_mail = "blaaah@hotmail.com"; change this to $to_email $to_email = "blaaah@hotmail.com"; $subject = "Register"; $firstname.=$_POST['firstname']."\n" ; $lastname.=$_POST['lastname']."\n" ; $gender.=$_POST['gender']."\n" ; $dob.=$_POST['dob']."\n" ; $dancename.=$_POST['dancename']."\n" ; $crewname.=$_POST['crewname']."\n" ; $suburb.=$_POST['suburb']."\n" ; $dancestle.=$_POST['dancestle'] ."\n" ; $from_email.=$_POST['from_email'] ."\n" ; $experience.=$_POST['experience'] ."\n" ;
-
Why are you including the URL? <?php include ("/admin/scripts/audit.php"); ?> Should work given that is the right spot in the file structure. If that does not work try this: <?php include ($_SERVER['DOCUMENT_ROOT'] . "/admin/scripts/audit.php"); ?> Including it as a webpage, the webpage does not know it is being included, so it is set to audit.php. The above will set it to the page it is included on.
-
??? If you want to help solve this issue I would post the top part of the file that include audit.php
-
Post some code that includes audit.php
-
Yea, I saw my mistake after the time ran out to edit. But I did not offer up a recursive solution, " If you do not want to make it recursive, this should work." Either way that post is very misleading, as he had the static usage right and I mis-read the php page thinking that it was referring to the lower example as appose to the upper one when it said this would not work. But yea, thanks for pointing it out to him.
-
Frames are outdated. Redesign the site with CSS 2.0 and make it much more appealing =) My 2 cents. *shivers at the use of frames*
-
Brian brings up a great point, Function variables are local to that function. After looking up static You need to make the function recursive for it to work. If you do not want to make it recursive, this should work. <?php function myfuction(){ global $a; ++$a; if($a == 1){ echo "this function has been loaded " .$a. " time<br />"; } else { echo "this function has been loaded " .$a ." time(s)<br />"; } } $a=0; for($i = 0; $i <= 8; ++$i){ myfuction(); } ?> That should get you the desired result.
-
if($a == 1){ echo "this function has been loaded " .$a. " time<br />"; } else { echo "this function has been loaded " .$a ." time(s)<br />"; } = sets the value to 1 which returns true, == checks if the value is equaled to one.
-
You hit the nail on the head. $server is defined in a function and is not considered a global. Any item defined in a function for it to be used elsewhere needs to be defined a global variable, or assigned to a session variable. Which ever you choose, I would use the session, globals are just messy. But that is just me. The same will be true for tld and comnet inside the function.
-
<?php $url = 'products.php?dealer_id='. $leftrow['dealer_id'] . "&category_id=" . $leftrow['category_id']; ?> Corrected. YOu were missing ' after _id= and had an extra .' after the category_id which was not necessary.
-
$server is not being defined, hence the :43.
-
<?php $error = isset($_GET['error'])?$_GET['error']:0; switch($error) { Try using that instead. That way you know if there is not an error it will not run any of the switches.
-
[SOLVED] colllecting unknown varial names and changing them
premiso replied to shadiadiph's topic in PHP Coding Help
Honestly, this was solved 3-4 posts ago. I was just re-iterating that point. -
lol, spoken like a true designer. It does not bug me cause the end result is the proper result. As long as it functions right, who cares if it looks nice lmao!
-
<?php if(isset($_POST['paypal'])){ header("Location: " . $config_basedir . "orderform.php"); }elseif(isset($_POST['credit'])){ header("Location: " . $config_basedir . "billingInfo.php"); } else{ require("header.php"); ?> <form action="" method="post" enctype="application/x-www-form-urlencoded"> Try that.
-
The short answer, you cannot. The issue is with the CSS and just how to page loads with order of operations. Why does the loading matter anyhow? It is best not to get to anal about CSS etc. If you load it in firefox you will notice it loads "right".
-
Why not just check if page is equaled to about before you check if college isset?
-
http://corz.org/serv/tricks/htaccess2.php Exactly what do you want to do/how do you want to rewrite them? You need to give us more information on exactly what you want.