premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
80- <a href='combat.php?area=<?php echo $area; ?>'>Again</a> I believe that is the correct way to echo it out, the other way would have been <?= but if short tags are turned off it would not work. If that does not work, paste more code please.
-
[SOLVED] How to replace a number/section of a string?
premiso replied to virtuexru's topic in PHP Coding Help
preg_replace Would be the easiest. I am not great at regex but it would be something like: <?php $description = "Please call 917-000-0000. Than you."; $replacement = ""; // replace it with nothing $description = preg_replace('/\d/', $replacement, $description); echo $description; ?> I highly doubt that will work, but that is the idea. Just note the above code will not replace the "-" in the number. -
It looks alright to me...are you sure that name is not in the DB? Check by printing out the name that is returned by the DB and the $name being passed to the DB to see what each is. Really this is just a debugging issue. We cannot help you at all cause this is all on your DB and you just need to check the sql statement, check what is being returned from that SQL statement, check what is being put in and verify that it is correct.
-
[SOLVED] PHP click new include (might be javascript)
premiso replied to daveoffy's topic in PHP Coding Help
You would want to use CSS/Javascript for this. Where onClick you hide the login and show the signup. This is pretty easy to do: <script type="text/javascript"> function showHide(hideid, showid) { var hideElement = document.getElementById(hideid); var showElement = document.getElementById(showid); hideElement.style.display = "none"; showElement.style.display = ""; } </script> <div id="loginForm"> <a href="#" onClick="showHide('loginForm', 'registerForm'); return false">Sign Up!</a> </div> <div id="registerForm"> <a href="#" onClick="showHide('registerForm', 'loginForm'); return false">Log In!</a> </div> Simple as that. Since this is not a JS form, I do not gurantee that will work, but that is the gist of it. -
The undefined variable is from $photoarr[0] = $foto; $photorr[1] = $thumbnail; You do not define $foto or $thumbnail anywhere. If you had this: function addBikeCheck() { $foto = ""; $thumbnail = ""; $photoarr = $this->photoProcess($_FILES['foto']['tmp_name'], $_FILES['foto']['type'], $_FILES['foto']['size'], $_FILES['foto']['name']); $photoarr[0] = $foto; $photorr[1] = $thumbnail; Would solve that issue. Not sure where $foto and $thumbnail are suppose to be set, but yea.
-
Why mailto.exe and it is under cgi? I am confused at how this is a PHP issue? If you want to know how to send an email in PHP... mail That is PHP Mail's manual and the function that sends mail, with examples of usage: http://us2.php.net/manual/en/function.mail.php Using that you do not need a DB to send emails, just a form that posts to that page and invokes that function.
-
No clue why 1 would be a problem. You could try adding an alpha character before it and see if it works. IE: a1.jpg b1.jpg or something similiar.
-
I think the location takes you the site without posting. Once that location is read, everything else is ignored I believe.... You need to submit the form to a page on your site then use CURL to do the header stuff and send the request that way.
-
Why ask if you can read that page yourself? Umm yea? That is what it says it does....
-
Maybe if you would space (put each on a different line) out your variable declarations you would see the problem 10000000 times easier. Also please use the [ code] and [ /code] (remove initial space) tags to surround code.
-
<?php for ($i=1; $i<1001; $i++) { if (($i % 100) == 0) { echo 'Do This!'; }else { echo 'Not 100 so do this!'; } } ?> Modulus operator (%) will allow for this.
-
[SOLVED] How to call this with simplexml_load?
premiso replied to Graxeon's topic in PHP Coding Help
<?php $allowed_url = array("8776", //test start "140"); $passed_url = $_GET['url']; //this would be http://www.google.com foreach ($allowed_url as $allowed) { if(stristr($allowed, $passed_url) !== false) { $url='http://www.sqweasel.com/flv_player/data/playerConfigEmbed/'.$allowed . '.xml'; $string = file_get_contents($url); $sxml = new SimpleXmlElement($string); $node = $sxml->_video[0]->attributes()->path; header('Location: '.$node); exit; } } header("Location: http://www.google.com/"); ?> Didn't need the "playerConfig" portion. -
[SOLVED] How to call this with simplexml_load?
premiso replied to Graxeon's topic in PHP Coding Help
<?php $allowed_url = array("8776", //test start "140"); $passed_url = $_GET['url']; //this would be http://www.google.com foreach ($allowed_url as $allowed) { if(stristr($allowed, $passed_url) !== false) { $url='http://www.sqweasel.com/flv_player/data/playerConfigEmbed/'.$allowed . '.xml'; $string = file_get_contents($url); $sxml = new SimpleXmlElement($string); $node = getAttribute("path", $sxml->playerConfig[0]->_video[0]) . "<br />"; header('Location: '.$node); exit; } } header("Location: http://www.google.com/"); function getAttribute($attName, $sxml) { foreach($sxml->attributes() as $a => $b) { if ($a == $attName) return $b; } return false; } ?> Should get you your results. -
I just tried this code <?php if (!isset($_POST['test0'])) { $output = '<form name=test method=post>'; $string = <<<STRING I have a form which has a variable size, depending on the number of rows in a table. For each row there are about ten fields, and I simply show them all for each row. I've recently started having a trouble in that if I create a form with more than 400 elements, then the $_POST variable is truncated at 400. Is this normal? Do I have to limit the size of the $_POST array? Not by MB, which must be trivial for me, but for the number of array elements? STRING; for ($i=0;$i<500;$i++) $output .= '<input type="hidden" name="test' . $i . '" value="' . $i . $string . '" />'; $output .= '<input type="submit" value="submit" /></form>'; echo $output; }else { echo '<pre>' . print_r($_POST, 1) . '</pre>'; } ?> On my server and received 499 elements of the array. Which is correct. I am not sure why your server is chopping it up, but yea. On a side note I believe there is a post_max_size variable in the php.ini file. Maybe try changing that to be larger than it is? My setup is WAMP on Windows using FireFox 3 and yea it worked just fine. I also tested it with 1,000 items, still worked fine.
-
[SOLVED] How to call this with simplexml_load?
premiso replied to Graxeon's topic in PHP Coding Help
<?php $allowed_url = array("8776", //test start "140"); $passed_url = $_GET['url']; //this would be http://www.google.com foreach ($allowed_url as $allowed) { if(stristr($allowed, $passed_url) !== false) { $url='http://www.sqweasel.com/flv_player/data/playerConfigEmbed/'.$_GET['url']; $string = file_get_contents($url); $sxml = new SimpleXmlElement($string); $node = getAttribute("path", $sxml->playerConfig[0]->_video[0]) . "<br />"; header('Location: '.$node); exit; } } header("Location: http://www.google.com/"); function getAttribute($attName, $sxml) { foreach($sxml->attributes() as $a => $b) { if ($a == $attName) return $b; } return false; } ?> I am not sure exactly what you are trying to do with "$node" .... that just confused me. Also you were just getting the url and parsing that. use file_get_contents to get the contents of a URL. And why are you redirecting it? That also confused me....Please enlighten us on what exactly you are trying to do and what is your goal for this script? All that weirdness aside, try what I posted above. I believe that will get you what you want. -
So the future is OOP? I wouldn't say that exactly. I am sure PHP will let you work with it like it always has. OOP just makes certain tasks etc more efficient. It all depends on the script you are working on whether OOP would be the way to go or not.
-
It is, but you need to configure your browser to do this or use cURL to send the fake headers. I believe Firefox allows Referrer spoofing, but not sure. You can find different software that does it online, just google "referrer spoofing".
-
Change the path from just "images" to: /home/a4631774/public_html/images/old270.jpg Full paths are generally better than relative.
-
[SOLVED] How to call this with simplexml_load?
premiso replied to Graxeon's topic in PHP Coding Help
<?php $string = <<<XML <rss version="2.0"> <channel> <title>Desc</title> <link auto="false" guide="false" timer="1s" path="google" /> </channel> </rss> XML; $sxml = new SimpleXmlElement($string); echo getAttribute("path", $sxml->channel[0]->link[0]) . "<br />"; function getAttribute($attName, $sxml) { foreach($sxml->attributes() as $a => $b) { if ($a == "path") return $b; //echo $a,'="',$b,"\"\n"; } return false; } ?> For a tutorial as to say: http://blog.stuartherbert.com/php/2007/01/07/using-simplexml-to-parse-rss-feeds/ -
You would want to use a CRON job for this and check a date/timestamp that you put in the database the day they registered and if it has been 14 days send an email.
-
if (($memberid == $getid) || ($memberid == $friend)) {
-
Show the full code please. According to the copy manual that should work as long as the paths are correct.
-
<?php $file = "Gallery\Large\3.jpg"; $newfile = "Gallery\3.jpg"; copy($file, $newfile); ?> That should do what you want.
-
You would just use the paths, not the actual file.