Jump to content

chasethemetal

Members
  • Content Count

    169
  • Joined

  • Last visited

Everything posted by chasethemetal

  1. Hey all. I'm not a javascript whiz. I am a beginner slowly getting better. I am working with the Google Geo Map API right now, and I can't figure out how to change a var when a region is clicked. My problem is the var "options['region'] = 'world';" needs to be changed to the contents of "(regionData)". Right now when you click the region it will fire off the region code in alert(regionData). But instead of firing that in an alert I need it to change say "options['region'] = 'world';" to "options['region'] = 'US';" Any help would be appreciated! Heres the full code below. <script type="text
  2. chasethemetal

    Preg_Match

    Hey everyone! I have a script someone on the forum helped me with awhile back that takes the contents of src="" from an embedded video. It works fine with I run this script in a while loop. But I am trying to get the match to work on the fly with $_POST method instead now, and it's not working. Here's the code... and I'm confused as to why it doesnt work by getting the content from a $_POST but gets it when its pulling it from a database in a while loop. the working script while($info = mysql_fetch_array( $data )) {$pattern[1] = '/src="([^"]+)"/i';preg_match($pattern[1], $info['file'], $match
  3. Hey all,I am having difficulties figuring out how to create a script that will load and run my 'upload gif' ONLY when a file is being uploaded... I have a script that will run a certain gif when the page is loading, you know like a loading your profile please wait and it kills after all elements of the page have loaded... But what I need assistance on, is making a script that will trigger the GIF in a DIV only during an upload...Any pointers or guides would be great. I am pretty new to javascript, if anyone can think of a way to do this in PHP I am comfortable with that. Thanks.
  4. Also... I've noticed that gmail will render my transparent png as black.. hmmm.
  5. So I tried this method <?phpheader(Content-Type: image/png);readfile('/path/to/image.png')tracking script here?> And in Gmail the image is rendered, but the tracking script doesnt seem to run. But if I right click and view the script from my server in my browser it works fine... It is strange to me that gmail will render the image but it doesnt trigger the rest of the script on my server...Thoughts?
  6. Yes I figured that much as I am a gmail user. But luckily for me the emails we are sending contain graphic material. Barley any text. So I figure mosstt people will choose to display the images. Fingers crossed. Ok thanks for everyones help.
  7. Ok so if I get what your saying its simpler than I thought...Like it could look like this <img src="http://www.site.com/script.php" />And in the php script just include an image in the header so something actually renders?
  8. Hey all,So I am currently writing a nice little application that allows users to create email flyers then blast them out to fellow email list subscribers. Initially I was planning on tracking by placing an iFrame in the email body that was 0x0 which inside holds my tracking scripts. Though quickly I found out this is impossible as most email clients like Gmail and the such don't allow them to load... So after some quick research I believe most people accomplish this by placing a small invisible image in the email then they track how many times that image was rendered...I guess my question is,
  9. Thank you. Ill be reading up on my regex
  10. Oh wow. That is a much more efficient method. Thank you. What is this called ([^"]+)"/i' I know it's a way to kind of define how the pattern is looked at or built right?I ended up changing it to...$pattern[1] = '/src="([^"]+)"/i';that way it would pick up most all video embed types such as youtube. If you could point me in the direction of some good info on how to do that would be great, this is something I must practice and learn. Thanks so much.
  11. OK I GOT IT. I really just worked this one out live. If anyone is having this problem this should do it. If anyone sees anything that might be better let me know! $data = mysql_query("SELECT * FROM video ORDER BY id DESC") or die(mysql_error());while($info = mysql_fetch_array( $data )){ $file = $info['file'];$patternA[1] = '/"[0-9][0-9]"/';$patternA[2] = '/"[0-9][0-9][0-9]"/';$patternA[3] = '/"[0-9][0-9][0-9][0-9]"/';$numStrip = preg_replace($patternA,"", "".$file.""); $iframe = ''.$numStrip.'';$patternB[1] = "/<iframe src=\"/";$patternB[2] = "/\" width=/";$patternB[3] = "/ height= fr
  12. Ok got it. Kind of. I just have to pray no one uses something smaller than 100 or larger than 1000. See any ways to accomplish this? $data = mysql_query("SELECT * FROM video ORDER BY id DESC") or die(mysql_error());while($info = mysql_fetch_array( $data )){ $file = $info['file'];$numStrip = preg_replace('/"[0-9][0-9][0-9]"/',"", "".$file.""); $iframe = ''.$numStrip.'';$pattern[1] = "/<iframe src=\"/";$pattern[2] = "/\" width=/";$pattern[3] = "/ height= frameborder=\"0\">/";$replace[1] = "";$replace[2] = "";$replace[3] = "";$url = preg_replace($pattern, $replace, $iframe);echo '<
  13. So this is working, except I know I am not using range() correctly... And can't see why really... Any help in getting $width and $height to equal a range from 0-1000 at the same time. $data = mysql_query("SELECT * FROM video ORDER BY id DESC") or die(mysql_error());while($info = mysql_fetch_array( $data )){ $file = $info['file']; $iframe = ''.$file.''; foreach (range(0, 400) as $width) { foreach (range(0, 225) as $height) {$pattern[1] = "/<iframe src=\"/";$pattern[2] = "/\" width=\"".$width."\"/";$pattern[3] = "/ height=\"".$height."\" frameborder=\"0\">/";$replace[1] = "";$rep
  14. This is where I am at. Maybe the foreach isn't the right approach... anyways if the range doesnt happen to end on width it does not work... makes sense because the end value is outside the loop... I am just trying to figure out a way to assign $number equal to an entire range at the same time. $iframe = '<iframe src="http://player.vimeo.com/video/00000000?title=0&byline=0&portrait=0" width="400" height="225" frameborder="0"></iframe>';foreach (range(398, 400) as $number) {$pattern[1] = "/<iframe src=\"/";$pattern[2] = "/\" width=\"".$number."\"/";$strip1 = preg_replace(
  15. Ok I am following you. I think I will find the pattern by looking for all the similar tag openings.. src, width.... and the assign $x = range(0,1000); that way the heights and widths will equal the range that they would and could fit in... I'll report back with code.
  16. Also let me explain what I'm trying to accomplish.I have iframes stored in a database. These iframes are actually vimeo videos. I am trying to rip the URL's out and then place them in another iframe of much smaller size, creating thumbnails of the video...So I figured if I could get the urls attached to a variable I could then loop them in a new iframe of much smaller width and height. Again the original iframe widths and heights change so I couldnt use preg_match to isolate because the patterns arent the same all the time.Agian, thanks any tips would be great.
  17. Hey all,I am trying to figure out a way to search a string and return only the url in it. My string is an iframe so it looks something like this...<iframe src="http://www.site.com/something" width="400" height="200" frameborder="0"></iframe>And I'd like to search this and return only the URL. I guess the catch is that the URL will change in length and value so I need a function that will work dynamically.I was able to do it for a static URL, but I am having a difficult time coming up with a way to strip the iframe code out only leaving the URL left no matter how long or different t
  18. Thank you. This is the final line of code that makes for a successful import.exec("mysql user_test -u user_testuser -ptestpass < /home/user/public_html/website.com/sql/fillDB.sql");Thank you. This topic has been solved.
  19. Yes thats what I figured... This is what I am doing. I know the credentials are correct. See anything that looks fishy?exec("mysql -h {$config['localhost']} -D {$config['user_test']} -u {$config['user_testuser']} -p {$config['testpass']} < {$config['/home/user/public_html']}/website.com/sql/template.sql");The SQL file is set up to CREATE TABLE IF NOT EXISTS. And all information inside seems correct. Yet when I run this script nothing happens. the script is located at website.com/signup/fillDB.php
  20. Hey all. Still having difficulties trying to import a .sql file from PHP into a database. I tried justsomeguy's method...exec("mysql -h {$config['db_host']} -D {$config['db_name']} -u {$config['db_user']} -p{$config['db_pass']} < {$config['file_root']}/sql/copy_records.sql");But it didn't do anything... Though I could have done something silly, most likely with the 'file_root' part, anyways... Let me explain my simple situation a little more clearly.I have an empty database named "test" it has a user named testuser with a pass of testpass, it has full permissions to this database. now locat
  21. Update. Using the XML API php class I was able to create a database and add a user! <?phpinclude ('xmlapi.php');$db_host = "localhost";$cpaneluser = "username";$cpanelpass = "password";$databasename = "testtest";$databaseuser = "testuser";$databasepass = "testuser";$xmlapi = new xmlapi($db_host);$xmlapi->password_auth("".$cpaneluser."","".$cpanelpass."");$xmlapi->set_debug(1);//output actions in the error log 1 for >true and 0 false$xmlapi->set_output('array');$xmlapi->set_port(2083);//You will have to use 2082 if you don't have cURLSSL or OpenSSL compiled in you PHP binary;
  22. I'd like to try. I know early you posted an example. Though before I even try I'm sure I will need to include my cPanel login information no? How would that code look? Any guides on accessing cPanel through PHP would be very helpful.
  23. <form action="" method="post"><input type="text" name="name" /><br /><input type="submit" value="Submit" name="submit" /></form><?if(isset($_REQUEST['submit'])) {$name = $_POST['name'];echo '<br />';echo 'http://sitename.com/?referral=$name';}?>
  24. Thanks for the advice. Funny enough I spoke too soon. I thought I had the create of a database down (working in mamp), but in fact apparently it is impossible to create a database and add a user from a PHP script on my shared host. They require that I use phpMyAdmin or if I want that functionality I must upgrade to a VPS or Dedicated server. Does anyone think there is a work around and my hosting company is telling a tall tale?
  25. Yes I understand how to do this manually inside phpmyadmin. But what I am trying to do is have a php script do this when a user "creates" an account. I am searching for an automated way to do this via php without having to type out the structure. If no one has any ideas, its looking like I may just have to do this by writing out the structure in php? really wish you could import structure from a .sql file in php.
×
×
  • Create New...