Jump to content

atlanta

Members
  • Posts

    172
  • Joined

  • Last visited

    Never

Everything posted by atlanta

  1. atlanta

    Regex Help

    thanks nrg_alpha but i need the whole regex to do it becuase i will be using this for mod rewrite not php
  2. atlanta

    Regex Help

    Hi guys i need a little help i need to retrieve different parts of a url for use in my .htaccess file all help appreciated .. ok heres my example.. http://domain.com/firstpart/secondpart/ ok i need to retrieve firstpart in one group and secondpart in the second group.. i tried ^/(.*?)/(.*?)/$ but the first group selects everything!
  3. OK cool thats what i was thinking i was gonna have to do which is going to be a pain thanks my man
  4. Hi all , I have a question is there a way to grab a variable from another php file without including it? I ask this because when i include it into the page another variable within the system is the same and they cancel each other out.
  5. Hi all i need a little help my regex skills aren't too great so .. what i need is to retrieve is http://b1.ac-images.myspacecdn.com/00841/12/32/841492321_m.gif from <table id="mainLayout"> <tr> <td id="1a" width="304" height="300"> <div id="profile_info" class="section"> <h4 class="heading">SykoRadio</h4><br /> <div id="profile_info_image"> <a id="ctl00_cpMain_ctl01_ctl01_hlDefaultImage" rel="searchMonkey-photo" href="http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewAlbums&friendID=11"><img src="http://b1.ac-images.myspacecdn.com/00841/12/32/841492321_m.gif" alt="SykoRadio"/></a> <center>View My: <a id="ctl00_cpMain_ctl01_ctl01_ctrlViewMorePics" rel="searchMonkey-viewPictures" href="http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewAlbums&friendID=11">Pics</a> | <a href="http://vids.myspace.com/index.cfm?fuseaction=vids.showvids&friendID=11&n=11&MyToken=5ee0978c-1539-4a01-9db5-e0268888aa3d">Videos</a> </center> </div> <div id="profile_info_content" class="text"> <span id="profile_info_headline">"Sykoradio.org - Music for the Kultured"</span><br /><br /> Male<br /> 30 years old<br /><br /> Columbus, OHIO<br /> United States<br /> <br /> Last Login: <span class="searchMonkey-lastLogin">07/23/08</span> </div> <div class="clear"></div> </div> <div id="profile_contact" class="section"> <h5 class="heading">Contacting SykoRadio</h5> <a href="http://messaging.myspace.com/index.cfm?fuseaction=mail.message&friendID=11&MyToken=5ee0978c-1539-4a01-9db5-e0268888aa3d" id="ctl00_cpMain_ctl01_ctl02_MailLink" rel="searchMonkey-sendMessage"><img id="mailLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_sendmailicon.gif' alt="" />Send Message</a> <a href="http://messaging.myspace.com/index.cfm?fuseaction=mail.forward&friendID=11&f=forwardprofile" id="ctl00_cpMain_ctl01_ctl02_ForwardLink"><img id="forwardLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_forwardmailicon.gif' alt="" />Forward to Friend</a> <a href="http://friends.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=11" id="ctl00_cpMain_ctl01_ctl02_AddFriendLink" rel="searchMonkey-addToFriends"><img id="addFriendLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_addfriendicon.gif' alt="" />Add to Friends</a> <a href="http://collect.myspace.com/index.cfm?fuseaction=user.addToFavorite&friendID=11&public=0" id="ctl00_cpMain_ctl01_ctl02_AddFavoriteLink"><img id="addFavoriteLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_addfavoritesicon.gif' alt="" />Add to Favorites</a> <a href="javascript: IsMySpaceIMInstalled();" id="ctl00_cpMain_ctl01_ctl02_MessageFriendLink"><img id="messageFriendLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_messagefriend.gif' alt="" />IM / Call</a> <a href="http://friends.myspace.com/index.cfm?fuseaction=block.blockUser&userID=11" id="ctl00_cpMain_ctl01_ctl02_BlockFriendLink" onclick="return confirm('Are you sure you want to block this user?\n- to block this user, hit OK\n- otherwise, hit Cancel');"><img id="blockFriendLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_blockuser.gif' alt="" />Block User</a> <a href="http://groups.myspace.com/index.cfm?fuseaction=groups.addtogroup&friendID=11" id="ctl00_cpMain_ctl01_ctl02_AddToGroupLink"><img id="addToGroupLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_addtogroupicon.gif' alt="" />Add to Group</a> <a href="http://collect.myspace.com/index.cfm?fuseaction=RateImage.UserRating&UserID=11" id="ctl00_cpMain_ctl01_ctl02_RateFriendLink"><img id="rateFriendLinkImg" src='http://x.myspacecdn.com/modules/profiles/static/img/contact_rankusericon.gif' alt="" />Rank User</a> <div class="clear"></div> </div>
  6. <? require_once("includes/config.php"); $db_connection = mysql_connect ($DBHost, $DBUser, $DBPass) OR die (mysql_error()); $db_select = mysql_select_db ($DBName) or die (mysql_error()); $db_table = $TBL_PR . "events"; $query = "SELECT * FROM $db_table WHERE event_id='$_GET[id]' LIMIT 1"; $query_result = mysql_query ($query); if(mysql_num_rows($query_result) > 0) { while ($info = mysql_fetch_array($query_result)){ $date = date ("l, jS F Y", mktime(0,0,0,$info['event_month'],$info['event_day'],$info['event_year'])); $time_array = split(":", $info['event_time']); $time = date ("g:ia", mktime($time_array['0'],$time_array['1'],0,$info['event_month'],$info['event_day'],$info['event_year'])); } } else { header("Location: http://domain.com/") } ?>
  7. Hello All, I have a problem im running IIS and php as isapi module on windows 2003 server 64bit. i am trying to setup this app http://iecapt.sourceforge.net/ but for some reason php well not execute any commands through shell_exec , exec or system it just returns either 1 or nothing but no errrors!.. also believe i have added the anon web user permissions to write the the thumbs folder and permission to the iecapt exe any other things i need to do to let php run exe from these functions?
  8. just did a little testing and found that if i use this if if(isset($_SESSION['userid']) && isset($_SESSION['username'])){ echo '<li><a href="http://www.stickamstuff.com/members.php">My Page</a></li>'; } it doesnt echo but if i take out $_SESSION['userid'] it echos but thats only when its included on the main page . it echos with both if i go directly to the page.
  9. ok yea i do have that on all pages and was just about to add some heres my rightnav.php file <? session_start(); include('session.php'); ?> <div class="sideheader">Members</div> <ul class="sideul"> <center> Total Members: <? echo $database->getNumMembers(); ?> <br /> Members Online: <? echo $database->num_active_users + $database->num_active_guests; ?> <br /> Layouts: <? echo $database->Layouts(); ?> <? if($session->logged_in){ echo "LOGGED IN"; } else { echo "LOGGED OUT"; } ?> <li><a href="http://www.stickamstuff.com/members.php">Login</a></li> <li><a href="http://www.stickamstuff.com/register.php">Register</a></li> <li><a href="http://www.stickamstuff.com/process.php?logout=1">Logout</a></li> </center> </ul> $session->logged_in function function logged_in(){ global $database; //The database connection /* Check if user has been remembered */ if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookid'])){ $this->username = $_SESSION['username'] = $_COOKIE['cookname']; $this->userid = $_SESSION['userid'] = $_COOKIE['cookid']; } /* Username and userid have been set and not guest */ if(isset($_SESSION['username']) && isset($_SESSION['userid']) && $_SESSION['username'] != GUEST_NAME){ /* Confirm that username and userid are valid */ if($database->confirmUserID($_SESSION['username'], $_SESSION['userid']) != 0){ /* Variables are incorrect, user not logged in */ unset($_SESSION['username']); unset($_SESSION['userid']); return false; } /* User is logged in, set class variables */ $this->userinfo = $database->getUserInfo($_SESSION['username']); $this->username = $this->userinfo['username']; $this->userid = $this->userinfo['userid']; $this->userlevel = $this->userinfo['userlevel']; return true; } /* User not logged in */ else{ return false; } }
  10. Hi, I'm having a little problem with the script i was writing for a site... i have a right navbar include for the right side of the site and in the rigth include i have my session file included within that. ok my problem comes in when i run my if user is logged in function if i call the file along in the browser rightnav.php it runs fine checks the user correctly and displays the correct info but when i just view the main page with the rightnav.php included on it the function doesnt work and it just displays if user wasnt logged in ... any body ever ran into this problem or know how to fix it? I believe theres an error when i include the session file while its included on the main page but my server wont out errors at all even after using error_reporting(E_ALL); no php errors show..
  11. yea i made sure session_start() was first before any output but still it doesnt read it still doesnt work .!
  12. Ok I created a login system with sessions etc i have a side bar which includes a small login form and if the user is all ready logged in i have it say logged in. with this code <? include("include/session.php"); ?> <div class="sideheader">Members</div> <ul class="sideul"> <? if($session->logged_in){ echo "<li>Logged In $session->username </li>"; } else { echo "<li>Logged Out</li>"; } ?> That sidebar is included onto my main pages but when user logges in it still says logged out but when you go to the included page directly http://domain.com/sidebar.php it shows that they are logged in . Heres the session.php file /* Class constructor */ function Session(){ $this->time = time(); $this->startSession(); } function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /** * Set guest value to users not logged in, and update * active guests table accordingly. */ if(!$this->logged_in){ $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } /* Update users last active timestamp */ else{ $database->addActiveUser($this->username, $this->time); } /* Remove inactive visitors from database */ $database->removeInactiveUsers(); $database->removeInactiveGuests(); /* Set referrer page */ if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } /* Set current url */ $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; }
  13. Hey i needed a little help with selecting the stuff in between this code using the preg_match function . i dont know how to right the expression correctly to get the stuff in between the table table table { and } table table table { border-style:solid; border-width:1px; border-color:A47040; background-color:EEE3CF; } So i would want the regex function to return border-style:solid; border-width:1px; border-color:A47040; background-color:EEE3CF; could someone help me out with writting the expression correctly thanks
  14. Hey i needed a little help with selecting the stuff in between this code table table table { border-style:solid; border-width:1px; border-color:A47040; background-color:EEE3CF; } So i would want the regex function to return border-style:solid; border-width:1px; border-color:A47040; background-color:EEE3CF; could someone help me out with writting the expression correctly thanks
  15. Hi guys im trying to make a page using curl that will log into my rapidshare account but i cant seem to get it to work can you tell me what else i need to do im not to familiar with cURL <? function curl_login($url,$data){ $fp = fopen("cookie.txt", "w"); fclose($fp); $login = curl_init(); curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($login, CURLOPT_TIMEOUT, 40); curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($login, CURLOPT_URL, $url); curl_setopt($login, CURLOPT_HEADER, TRUE); curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($login, CURLOPT_POST, TRUE); curl_setopt($login, CURLOPT_POSTFIELDS, $data); ob_start(); // prevent any output return curl_exec ($login); // execute the curl command ob_end_clean(); // stop preventing output curl_close ($login); unset($login); } function curl_grab_page($site){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_URL, $site); ob_start(); // prevent any output return curl_exec ($ch); // execute the curl command ob_end_clean(); // stop preventing output curl_close ($ch); } curl_login("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi","login=username&password=password"); echo curl_grab_page("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi"); ?>
  16. HAHAHA Thanks much your the man..
  17. opps forgot something try that let me know your results <?php header('Content-type: application/vnd.ms-word'); header('Content-Disposition: attachment; filename="file.doc"'); readfile('file.doc'); header('Location: newfile.php'); ?>
  18. If path to file.doc is not in the same folder as this script put the absolute path <?php header('Content-type: application/vnd.ms-word'); header('Content-Disposition: attachment; filename="file.doc"'); readfile('file.doc'); ?>
  19. Hi all, I having some trouble substracting time.. well ok here the basics of my project students clock in and out and i have it subtract the clock out from the clock in and i want it to output to me how many hours and mins they were clocked in . I was doing some test solutions but the one below actually outputs the hour it click in or out not the amount subtracted from each other. The time in the below code is 3 mins and 17 secs from each other but as you can see it does output 00 for hours it gives you <?php $posted_date = "1202478546"; $cur_date = "1202478743"; $time_pass = $cur_date - $posted_date; $elapsed_time = date("H \h\o\u\\r\s\ i \m\i\\n\s\ s \s\e\c\s",$time_pass); print "$elapsed_time"; ?>
  20. Found the problem $cat2 = "/home/elvisand/public_html/photoalbum/".$directories[$random[0]]."/"; $path2 = "http://www.elvisand.com/photoalbum/".$directories[$random[0]]."/"; should have been $cat2 = "/home/elvisand/public_html/photoalbum/".$directories[$random[]]."/"; $path2 = "http://www.elvisand.com/photoalbum/".$directories[$random[]]."/";
  21. Hi the code below wont output a random directory from the array can you check the code to see if anything is wrong thanks. <?php $cat = "/home/elvisand/public_html/photoalbum/"; function getRandomImage($path, $img, $realpath) { if ( $list = getImagesList($path) ) { mt_srand( (double)microtime() * 1000000 ); $num = array_rand($list); $img = $list[$num]; } return $realpath . $img; } function getImagesList($path) { $ctr = 0; if ( $img_dir = @opendir($path) ) { while ( false !== ($img_file = readdir($img_dir)) ) { // can add checks for other image file types here if ( preg_match("/(\.gif|\.jpg)$/", $img_file) ) { $images[$ctr] = $img_file; $ctr++; } } closedir($img_dir); return $images; } return false; } $hook = opendir($cat) or die('cant open dir'); $directories = array(); while (false!==($file = readdir($hook))) { $fpath = $cat . $file; if(is_dir($fpath)) { if($file != '.' && $file != '..') { array_push($directories, $file); } } } closedir($hook); $random = array_rand($directories, 1); echo $directories[$random[0]]; $cat2 = "/home/elvisand/public_html/photoalbum/".$directories[$random[0]]."/"; $path2 = "http://www.elvisand.com/photoalbum/".$directories[$random[0]]."/"; $default = ""; ?> <img src="<? echo getRandomImage($cat2, $default, $path2); ?>" width="158" height="168" />
  22. I tried the one u suggested but it puts every picture on a new row.. i want 4 on a row then </tr> then <tr> and start the next 4
  23. Here maybe this will help if i added all the code its kinda confusing without it if(isset($_GET['folder'])) { ?> <table class="phototable"> <? for ($cnt = $start; $cnt < $end; $cnt++) { $file = $files[$cnt]; $exten = explode('.',$file); if ($cnt == "0" || ($cnt % 4) == 0) { echo "<tr>"; } ?> <td> <a href="<?php echo $urlpath . $file; ?>" target="_blank" rel="lightbox[album]" title="<?=$exten[0]?>"> <img src="<?php echo $urlpath . $file; ?>" alt="<?=$exten[0]?>" width="158" height="168" /> </a> </td> <? if ($cnt == "3" || $cnt == "7" || $cnt == "11") { echo "</tr>"; } ?> <? } // end for ?> <? } // end if ok so what i want to do is have it eacho </tr> on every 4th count you get me ? so that after the forth coloumn it will start a new row
  24. oh sorry it is in the look which is above it somewhat for ($cnt = $start; $cnt < $end; $cnt++) { $file = $files[$cnt];
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.